This page is meant for developers that want to program an API to connect their service with SlapLab! If you are a SlapLab user, please check our FAQ on more Information on how to actually use the API Interface!
This is the API Documentation for our Slaplab API Interface! To clarify: This is not the Documentation of an API that we provide. It is the Documentation of an API that you can build for your Service to Interface it with the Slaplab Apps Preset Database!
SlapLab does simple GET & POST HTTP calls on Port 80 or 443 if the user is using https://
Parameters will be sent according to the endpoints documentation with either POST or GET.
We expext your API to return valid UTF8 encoded JSON. We tried to make this documentation as easy to understand as possible, that is why we have included not only a formal documentation of the parameters and expected response, we have also included sample requests and responses, so it should be easy for you to figure out what our interface actually expects. We are currently woking on a developer mode in SlapLab, that will allow you to output the requests and reponses from your API, so you can figure out if and where you may have Problems!
Authentification will be performed via a Token. You can provide your Users with an access token that they can use in our App to query your Services API!
Users can enter the API Token along with your API Url in our Apps Preset API Settings. This will unlock the UI Buttons for the Preset Database in our App
When Users use these Database Options the App will query your API according the the Endpoints specified below!
The Token will be transfered as an "Authentification" Header in the Bearer Style!
GET /v1/check HTTP/1.1 Host: your.api.url User-Agent: Unity (SomeVersion) Authentification: Bearer YOUR_TOKEN ...
The Check Endpoint is called when a User enters the API Credentials!
- none -
GET http://your.api.url/v1/check
{ "status": { "code":0, "message":"OK" } }
{ "error": { "code":ERROR_CODE, "message":"Invalid API Key" } }
The Categories Endpoint should return a list of Categories. But only if the requested Type has at least one Item in this Category, to avoid empty Categories!
This Endpoint is NOT Paginated and will always return all Options. For ease of access the returned List should also be sorted by Name!
GET http://your.api.url/v1/categories?type=Toy
{ "data": [ { "id": "24", "name": "Category1" }, { "id": "14", "name": "Category2" }, { "id": "49", "name": "Category3" }, { "id": "6", "name": "Category6" } ] }
The Import Endpoint is used to upload new Items from our App into your Database. You should implement a basic review process into your Service!
POST http://your.api.url/v1/import form.AddField("type", context.type); form.AddField("name", context.Name); form.AddField("description", context.Description); if (this.context is Action) { form.AddField("actioncount", (context as Action).Value); form.AddField("actiontype", (context as Action).Type.ToString()); form.AddField("karma", (context as Action).Karma); } if(this.context is Rule) { form.AddField("actioncount", (context as Rule).Value); form.AddField("actiontype", (context as Rule).Type.ToString()); form.AddField("goodkarma", (context as Rule).GoodKarma); form.AddField("badkarma", (context as Rule).BadKarma); } if(this.context is Regulation) { form.AddField("karma", (context as Regulation).Karma); } if (includeImage) { form.AddBinaryData("image",imgdata); }
{ "status": { "code":0, "message":"OK" } }
The Search Endpoint should return a list of items that contain a specific search phrase!
GET http://your.api.url/v1/search?type=Toy&p=5%q=Name
{ "data": [ { "id": 20, "name": "Some Name", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 103, "name": "Some Name#2", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 56, "name": "Some Name#4", "description": "", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" } ], "hasNext": false }
The New Endpoint should return a list of items that were recently added (This is the Default Endpoint in our App)!
GET http://your.api.url/v1/new?type=Toy&p=40
{ "data": [ { "id": 20, "name": "Some Name", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 103, "name": "Some Name#2", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 56, "name": "Some Name#4", "description": "", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" } ], "hasNext": false }
The Popular Endpoint should return a list of items that were most popular (We do not specify how you should Filter these, you can implement your own sorting algorithms)!
GET http://your.api.url/v1/popular?type=Toy&p=40
{ "data": [ { "id": 20, "name": "Some Name", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 103, "name": "Some Name#2", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 56, "name": "Some Name#4", "description": "", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" } ], "hasNext": false }
The Most Views Endpoint should return a list of items that were most viewed (We do not specify how you should Filter these, you can implement your own sorting algorithms)!
GET http://your.api.url/v1/mostviews?type=Toy&p=40
{ "data": [ { "id": 20, "name": "Some Name", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 103, "name": "Some Name#2", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 56, "name": "Some Name#4", "description": "", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" } ], "hasNext": false }
The Most Downloads Endpoint should return a list of items that were most downloaded (We do not specify how you should Filter these, you can implement your own sorting algorithms)!
GET http://your.api.url/v1/mostdownloads?type=Toy&p=40
{ "data": [ { "id": 20, "name": "Some Name", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 103, "name": "Some Name#2", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 56, "name": "Some Name#4", "description": "", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" } ], "hasNext": false }
The Featured Endpoint should return a list of items that you want to appear as featured (We do not specify how you should Filter these, you can implement your own sorting algorithms)!
GET http://your.api.url/v1/featured?type=Toy&p=40
{ "data": [ { "id": 20, "name": "Some Name", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 103, "name": "Some Name#2", "description": "Some Desc", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" }, { "id": 56, "name": "Some Name#4", "description": "", "image": "http://some/img/url.jpg", "thumbnail": "http://some/img/url.jpg" } ], "hasNext": false }
The Item Endpoint should return Detailed Infos about a single Item!
GET http://your.api.url/v1/item?id=40
{ "id": 40, "name": "Name of your Item", "description": "Some Description", "image": "http://url.to/your.image.jpg", "thumbnail": "http://url.to/your.thumb.jpg", "karma": 0, "goodkarma": 0, "badkarma": 0, "actiontype": null, "actioncount": 0 }