Authorization¶
Authorization should be sent in the header.
curl -1 <url> -H 'Authorization: apikey <user>:<api_key>'
Format¶
-
GET
<url>
¶ Query Parameters: - format -- One of 'json', 'xml' (default json). Utilization API also supports 'csv'.
Example request:
Pagination¶
-
GET
/api/v1/<resource>/
¶ Query Parameters: - limit -- Limit the number of return values for each query. (default 20) :query offset: The offset into the list of return values to start at. (default 0)
Alternately, the 'meta' section in the response will contain 'next' and 'previous' keys that, if not None, are the URLs of the next / previous pages of results.
Example request:
curl -1 https://scswiftcontroller.tatamediaservices.com/api/v1/clusters?limit=2 -H 'Authorization: apikey <user>:<api_key>'
Example response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | {
"meta": {
"limit": 2,
"next": "https://platform.swiftstack.com/api/v1/clusters?limit=2&offset=2",
"offset": 0,
"previous": null,
"total_count": 4
},
"objects": [
{
"name": "ProductionCluster",
"resource_uri": "/api/v1/clusters/3/",
"uuid": "e2e88667-e609-401e-8df6-3ae7c1ecf35b"
},
{
"name": "TestCluster",
"resource_uri": "/api/v1/clusters/2/",
"uuid": "e94f1dc0-dd6b-4382-9189-1479857f539b"
},
],
}
|
Example request:
curl -1 https://scswiftcontroller.tatamediaservices.com/api/v1/clusters?limit=2&offset=2 -H 'Authorization: apikey <user>:<api_key>'
Example response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | {
"meta": {
"limit": 2,
"next": null,
"offset": 2,
"previous": "https://platform.swiftstack.com/api/v1/clusters?limit=2",
"total_count": 4
},
"objects": [
{
"name": "StagingCluster",
"resource_uri": "/api/v1/clusters/1/",
"uuid": "e2e88667-e609-401e-8df6-3ae7c1e9835b"
},
{
"name": "DemoCluster",
"resource_uri": "/api/v1/clusters/4/",
"uuid": "e94f1dc0-dd6b-4382-9349-1479857f539b"
},
]
}
|
Filtering¶
When performing GET on lists, filters can be sent as a part of the query string. Spaces and special characters must be url encoded.
Example request:
curl -1 https://scswiftcontroller.tatamediaservices.com/api/v1/clusters?name=StagingCluster -H 'Authorization: apikey <user>:<api_key>'
Example response:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | {
"meta": {
"limit": 2,
"next": null,
"offset": 2,
"previous": "https://platform.swiftstack.com/api/v1/clusters?limit=2",
"total_count": 4
},
"objects": [
{
"name": "StagingCluster",
"resource_uri": "/api/v1/clusters/1/",
"uuid": "e2e88667-e609-401e-8df6-3ae7c1e9835b"
},
]
}
|
When a list can be filtered on the value of another object that also supports filters, you can concatenate the filters separated by '__'.
Example request:
In this example, users can be filtered by cluster which can be filtered by name.
curl -1 https://scswiftcontroller.tatamediaservices.com/api/v1/users?cluster__name=StagingCluster -H 'Authorization: apikey <user>:<api_key>'