This API is for partners that need to create accounts or apps on the Slingr platform on behalf of other people.
You can access the API at the following endpoint:
https://developer-portal.slingrs.io/api
Notice that you always have to use HTTPS. Trying to access out API using HTTP will return an error.
Additionally, all calls should have the following headers:
Content-Type: application/json
Accept: application/json
token: <token received after login>
General error codes
Here are some general error descriptions. Then on each method you will see a better description to some of the errors that can show up.
HTTP Status Code | Description |
---|---|
|
Everything went fine. No errors. |
|
Request is not valid. This can be due to validation errors in the data you are sending or because the operation you are trying to do is not valid. |
|
Unauthorized. You need to log in or the provided token is not valid. |
|
Forbidden. You have credentials, but you are trying to access data or execute an operation you don’t have permissions. |
|
Not found. The resource you are trying to access does not exist. |
|
Optimistic locking exception. This happens when two users tries to update the same record at the same time. The once that enters in the second place will get this error. |
|
Internal error. This happens when something went wrong and was not expected. If you get this type of errors please contact support. |
|
Service unavailable. This is when the application is under maintenance. |
Authorization
In order to call methods in this API you will need a partner token. You need to request this token to the Platform team support (support@slingr.io). So for all request you will need to send the header token
with the partner token.
Create account
POST /accounts
Creates a new account in the platform. This account will be associated to the partner that created it.
Request
POST /accounts
> Content-Type: application/json
> Accept: application/json
> token: token
{
"firstName": "first name",
"lastName": "last name",
"email": "name@company.com",
"password": "abcd1234"
}
Path | Description |
---|---|
|
First name of the owner of the account. |
|
Last name of the owner of the account. |
|
Email of the owner of the account. |
|
Password to set this this account. |
Response
The created account in JSON format.
POST /accounts
< Content-Type: application/json
{
"id": "asdw432j4bu9bdf92323",
"firstName": "first name",
"lastName": "last name",
"email": "name@company.com",
"status": "ACTIVE",
"timeZoneMode": "AUTO"
}
Possible errors
Error code | HTTP Status Code | Description |
---|---|---|
|
|
If there are validation errors. When this happens you will get the details of the errors in the body:
|
|
|
You don’t have permissions to create an account. You should check the token. |
Samples
creates a new account
POST /accounts
> Content-Type: application/json
> Accept: application/json
> token: token
{
"firstName": "first name",
"lastName": "last name",
"email": "name@company.com",
"password": "abcd1234"
}
POST /accounts
< Content-Type: application/json
{
"id": "asdw432j4bu9bdf92323",
"firstName": "first name",
"lastName": "last name",
"email": "name@company.com",
"status": "ACTIVE",
"timeZoneMode": "AUTO"
}
Check app name
GET /utils/checkAppName
Checks if an app name is available.
Request
GET /utils/checkAppName
> Accept: application/json
> token: token
Parameter | Required | Default | Description |
---|---|---|---|
|
yes |
This is the app name to check availability. |
Response
The response indicating if the app name is available.
GET /utils/checkAppName
< Content-Type: application/json
{
"status": "available"
}
Path | Description |
---|---|
|
Indicates if it is available. Values could be:
For |
|
If |
Possible errors
Error code | HTTP Status Code | Description |
---|---|---|
|
|
You are not authenticated or credentials are invalid. |
Samples
checks a name that is available
GET /utils/checkAppName?appName=uniqueAndValidName
> Accept: application/json
> token: token
GET /utils/checkAppName?appName=uniqueAndValidName
< Content-Type: application/json
{
"status": "available"
}
checks a name that is not unique
GET /utils/checkAppName?appName=notUniqueName
> Accept: application/json
> token: token
GET /utils/checkAppName?appName=notUniqueName
< Content-Type: application/json
{
"status": "notUnique",
"message": "Code is already in use."
}
checks an invalid name
GET /utils/checkAppName?appName=$invalid#
> Accept: application/json
> token: token
GET /utils/checkAppName?appName=$invalid#
< Content-Type: application/json
{
"status": "invalid",
"message": "Only lowercase letters and numbers are allowed. The first character must be a letter."
}