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 Code Description

200

Everything went fine. No errors.

400

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.

401

Unauthorized. You need to log in or the provided token is not valid.

403

Forbidden. You have credentials, but you are trying to access data or execute an operation you don’t have permissions.

404

Not found. The resource you are trying to access does not exist.

409

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.

500

Internal error. This happens when something went wrong and was not expected. If you get this type of errors please contact support.

503

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

firstName

First name of the owner of the account.

lastName

Last name of the owner of the account.

email

Email of the owner of the account.

password

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

validationErrors

400

If 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
    }
  ]
}

forbidden

403

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

appName

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

status

Indicates if it is available. Values could be:

  • available: app name is available.
  • notUnique: there is another app with same name.
  • invalid: the name is not valid.

For notUnique and invalid you will also get a field message with more details about the problem.

message

If status is notUnique or invalid you will get more details about the problem in this field.

Possible errors

Error code HTTP Status Code Description

Unauthorized

401

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."
}
Back to top