Partner REST API

General documentation for the partner REST API to create and manage accounts in the platform.

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 CodeDescription
200Everything went fine. No errors.
400Request 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.
401Unauthorized. You need to log in or the provided token is not valid.
403Forbidden. You have credentials, but you are trying to access data or execute an operation you don’t have permissions.
404Not found. The resource you are trying to access does not exist.
409Optimistic 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.
500Internal error. This happens when something went wrong and was not expected. If you get this type of errors please contact support.
503Service 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 an 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"
}

PathDescription
firstNameFirst name of the owner of the account.
lastNameLast name of the owner of the account.
emailEmail of the owner of the account.
passwordPassword 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"
}

Error codeHTTP Status CodeDescription
validationErrors400If there are validation errors. When this happens you will get the details of the errors in the body: { "code": "validationErrors", "message": "There are validation errors", "errors": [ { "field": "firstName", "fieldLabel": null, "code": "required", "message": "First name cannot be empty", "additionalInfo": null } ] }
forbidden403You 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

ParameterRequiredDefaultDescription
appNameyes-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"
}

PathDescription
statusIndicates if it is available. Values could be:

StatusDescription
availableApp name is available.
notUniqueThere is another app with the same name.
invalidThe name is not valid.
For notUnique and invalid you will also get a field message with more details about the problem.
messageyes

Possible errors

Error codeHTTP status codeDescription
Unathorized401You 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."
}