Dustyguns API documentation

With our API you get access to tools to create, read, update, and delete items. Before getting started you have to apply for an API key and your application has to approved by Dustyguns.se


Menu


API key and getting started

Start by contacting us on our Facebook page and tell us about your plans and ideas for using the API

Once your request gets approved and you aquire an API key you will also get access to our test/dev environment to test and build your functions and tools

When you are done and want to move over to our live server your application must once again be approved to make sure there is no security issues

Checklist for approval
  1. You must implement atleast CREATE and DELETE functions as a minimum
  2. All URLS must be over a SSL certificate "HTTPS"
  3. You must implement a spamfilter/protection

Item model JSON

Model Field Type Description
Key String Your unique API key
ItemId Integer Once an item is created the API returns a unique ID for use in Read, Update, Delete endpoints. This field is created by Dustyguns
SubCategory String The name of the subcategory the item is going to belong in. More information. This field is only necessary when creating items and cannot be changed
SellerName String Name the seller
SellerEmail String Seller email adress
ContactUrl String URL leading to a page/site where the seller can be contacted
ContactByEmail Bool Is the seller allowed to be contacted by Email (SellerEmail )? true/false
ContactByUrl Bool Is the seller allowed to be contacted by URL (ContactUrl )? true/false
Condition Integer Item condition, value span: 0-10
ItemUrl String Leave field empty when creating or updating item. Dustyguns returns a url for the item. This field is created by Dustyguns
ImageUrl String You have to provide an url to the item image. Must be a source with HTTPS
Title String A title for the item
Description String A description for the item
Town String Town or city where the item is located
Price Integer The requested price for the item
            
    {
        Key: "YOUR_API_KEY",
        ItemId: 0,
        SellerName: "FIRST NAME",
        SellerEmail: "john@doe.com",
        ContactUrl: "https://page.se/CONTACT_URL/",
        ContactByEmail: true,
        ContactByUrl: true,
        Condition: 0,
        ItemUrl: "https://dustyguns.se/item/SLUG",
        ImageUrl: "https://page.se/YOUR_IMAGE_URL",
        Title: "ITEM_TITLE",
        Description: "DESCRIPTION",
        Town: "TOWN",
        Price: 0
    }
                
            

Error codes

When creating or updating items you might stumble upon errors. These error codes make it easier to programmatically catch and deal with errors.

Error Code Error Text Description
1 Title not set The Title field can not be left empty
2 Description not set The Description field can not be left empty
3 Condition out of bounds The Condition field is either lower than 0 or higher than 10
4 Town not set The Town field can not be left empty
5 Seller name not set The SellerName field can not be left empty
6 Seller email not set The SellerEmail field can not be left empty
7 Contact url not set The ContactUrl field can not be left empty
8 Image url not set The ImageUrl field can not be left empty
9 Not allowed to contact seller! ContactByUrl, ContactByEmail are both set to FALSE
10 Sub Category not set The SubCategory field can not be left empty
11 Invalid Sub Category name The given SubCategory value/name does not match with any existing sub categories

List sub categories

Method: GET URL: https://dustyguns.se/API/PARTNER/GET/categories

These are the categories we have on Dustyguns. If you are missing something that can't go any other section, please contact us!

Parent Category Sub Category Description
Airsoft Granater Airsoft/Grenades
Airsoft Karbiner Airsoft/Carbines
Airsoft SMG Airsoft/Small machine gun
Airsoft LMG Airsoft/Light machine gun
Airsoft Pistoler Airsoft/Pistols
Airsoft Sniper Airsoft/Sniper
Taktisk utrustning Anisktsskydd Tactical gear/Facial protection
Taktisk utrustning Väskor och fickor Tactical gear/Bags and pockets
Taktisk utrustning Västar och bälten Tactical gear/Vests and belts
Taktisk utrustning Överlevnad Tactical gear/Survival
Uniformer och kläder Accessoarer Uniforms and clothing/Accessories
Uniformer och kläder Mössor och huvudbonader Uniforms and clothing/Hats and headdress
Uniformer och kläder Handskar Uniforms and clothing/Gloves
Uniformer och kläder Knä och armskydd Uniforms and clothing/Knee and elbow protection
Uniformer och kläder Kängor och skor Uniforms and clothing/Boots and shoes
Uniformer och kläder Uniformer Uniforms and clothing/Uniforms
Vapendelar Interna delar Weapon parts/Internal parts
Vapendelar Yttre delar Weapon parts/External parts
Övrigt Paket Other/Packages
Övrigt Övrigt Other/Other

Create

Method: POST URL: https://dustyguns.se/API/PARTNER/INSERT

If creation is successfull you will be returned with an ItemId. Make sure to save this ItemId as you will need it for editing or removing it in the future

            
    {
        Key: "YOUR_API_KEY",
        ItemId: 0,
        SubCategory: "SubCategory Name"
        SellerName: "FIRST NAME",
        SellerEmail: "john@doe.com",
        ContactUrl: "https://page.se/CONTACT_URL/",
        ContactByEmail: true,
        ContactByUrl: true,
        Condition: 0,
        ImageUrl: "https://page.se/YOUR_IMAGE_URL",
        Title: "ITEM_TITLE",
        Description: "DESCRIPTION",
        Town: "TOWN",
        Price: 0
    }
                
            

Read

Method: POST URL: https://dustyguns.se/API/PARTNER/GET
Get a specific item

If ItemId is included in the request you will get a response with an array with 1 item in it.

            
    {
        Key: "YOUR_API_KEY",
        ItemId: 0
    }
                
            
Get all your items

If you want to get all your items then just leave out the ItemId. All items will be returned in a array

            
    {
        Key: "YOUR_API_KEY",
    }
                
            

Update

Method: POST URL: https://dustyguns.se/API/PARTNER/UPDATE
            
    {
        Key: "YOUR_API_KEY",
        ItemId: 0,
        SellerName: "FIRST NAME",
        SellerEmail: "john@doe.com",
        ContactUrl: "https://page.se/CONTACT_URL/",
        ContactByEmail: true,
        ContactByUrl: true,
        Condition: 0,
        ImageUrl: "https://page.se/YOUR_IMAGE_URL",
        Title: "ITEM_TITLE",
        Description: "DESCRIPTION",
        Town: "TOWN",
        Price: 0
    }
                
            

Delete

Method: POST URL: https://dustyguns.se/API/PARTNER/DELETE

You can only delete items that you have added yourself

            
    {
        Key: "YOUR_API_KEY",
        ItemId: 0
    }