The Scalingo v1 Database API is a publicly available interface allowing developers to control Scalingo’s database as a service platform and the interface is stable and currently used by the Scalingo database dashboard (an Ember.js app). However, changes are occasionally made to improve performance and enhance features. See the changelog for more details.
Scalingo being available on multiple regions, the Database API hostname depends
on the region your database is hosted on. It’s designated by DB_API_URL
in this documentation and must be replaced with one of the following value:
db-api.osc-fr1.scalingo.com
db-api.osc-secnum-fr1.scalingo.com
Requests to the Database API must be authenticated. The authentication uses a Bearer Token. Those tokens are delivered by Scalingo main API. The process to get such token is explained on this documentation page. Then, use this token in the HTTP request as shown in the example.
Example request:
curl -H "Accept: application/json" -H "Content-Type: application/json" \
-H "Authorization: Bearer $DB_BEARER_TOKEN" \
-X GET https://$DB_API_URL/api/databases/my-db-123
To find the database ID you must use our addon API documentation.
The ID to use correspond to the addon’s id
field.
The API sends and receives JSON, XML is not accepted, please ensure JSON is used. All the
returned object are object
, there is never an array
as root element.
Resources are rooted, it means that they have a parent key corresponding to its name. This key may be plural if a collection of items is returned.
{
"database": {
// database
}
}
{
"backups": [
{
// backup
}, {
// backup
}
]
}
All the dates are sent with the ISO 8601: YYYY-MM-DDThh:mm:ss.μμμZ
Example:
2015-01-13T09:20:31.123+01:00
This format is commonly understood, here are some examples:
Javascript:
var date = new Date("2015-01-13T09:20:31.123+01:00")
Tue Jan 13 2015 09:20:31 GMT+0100 (CET)
Ruby:
require 'date'
DateTime.iso8601("2015-01-13T09:20:31.123+01:00")
=> #<DateTime: 2015-01-13T09:20:31+01:00 ((2457036j,30031s,123000000n),+3600s,2299161j)>
Go:
/*
* go run iso8601.go
* 2015-01-13 09:20:31.123 +0100 CET
*/
date, _ := time.Parse(time.RFC3339Nano, "2015-01-13T09:20:31.123+01:00")
fmt.Println(date)