API - Getting Started

Base Url

https://console.springserve.com/

API Caps

We are limiting the requests to our API as such:

1) max 240 request/minute per account 
2) max 10 requests/minute to the reporting API endpoint 
3) max 3 requests/minute to the reporting API endpoint by domain/app bundle 


Authentication

To create a new API user, simply login into your account, and in the Settings → Users section, create a new user. As email for the API user, you should put your regular email but add +api to the name (ex. name.lname+api@gmail.com). This will help you identify the origin of any change made in the UI. If you do not receive a password via email contact support@springserve.com

SDK

SpringServe is using Link to handle it's configuration. Link is a way to centrally configure your database, API handles. It has support for SpringServe API connections. For more, see the link documentation. https://link-docs.readthedocs.org/en/latest/

Link will be installed when you install SpringServe

To configure link for SpringServe:

Open iPython and run the following. This will edit your link.config. By default this will be ~/.link/link.config.
You can change this directory location by setting the environment variable LNK_DIR

Run the following to set up your config:

In [1]: import springserve

In [2]: springserve.setup_config()
Enter a user name: {enter email here}
Enter password:
Would you like to write[Y/n] y
writing config to: /Users/{username}/.link/link.config
done: refreshing config

REST API

Method: POST

Endpoint URL: /api/v0/auth

Parameters:
  • email - (required, type: string) API user email.
  • password - (required, type: integer) API user password.

Request:

POST /api/v0/auth

Content-Type: application/json

{
	"email": "user@example.com",
	"password": "123abc"
}


Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
	"token": "fbfc74f22e796a9bb1891ff"
}

Notes:

A token expires after two hours.

Once you receive the token, you need to add it to your header for all further API requests. Thus for future requests your header will need to be formatted like below:

Content-Type application/json
Authorization "yourAuthToken"

Examples

Python Example

import requests
import json

url = "https://console.springserve.com/api/v0/auth"

payload = json.dumps({
  "email": "user@example.com",
  "password": "123abc"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)


NodeJS Example

var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://console.springserve.com/api/v0/auth',
  'headers': {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "email": "user@example.com",
    "password": "123abc"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});