Table of Contents | ||
---|---|---|
|
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 SpringServe is using link Link to handle it's configuration. Link is a way to centrally configure your database, api API handles. It has support for Springserve api SpringServe API connections. For more, see the link documentation. https://link-docs.readthedocs.org/en/latest/
Link will be installed when you install springserveSpringServe
To configure link for SpringServe:
Open ipython 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:
Code Block | ||||
---|---|---|---|---|
| ||||
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
...
Headers
ContentType application/json
Body
...
email - (required, type: string) API user email.
password
- (required, type: integer)
API user password
.
Request:
Code Block | ||||
---|---|---|---|---|
| ||||
POST /api/v0/auth
Content-Type: application/json
{
"email": "user@example.com",
"password": "123abc"
} |
Required parameters: email, password
Response
Status code 200
...
Response:
Code Block | ||||
---|---|---|---|---|
| ||||
HTTP/1.1 200 OK Content-Type: application/json { "token": "zyxfbfc74f22e796a9bb1891ff" } |
Notes:
A token expires after two hours.
...
Authorization "yourAuthToken"
Examples
Python Example
Code Block | ||||
---|---|---|---|---|
| ||||
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
Code Block | ||||
---|---|---|---|---|
| ||||
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);
}); |