The Subspace API is based on REST, has resource-oriented URLs, returns JSON-encoded responses, and returns standard HTTP response codes.
The base URL for the API is: https://api.subspace.com/
https://api.subspace.com/v1
Subspace authenticates your API requests using JWT Bearer tokens. To use any Subspace API, you must pass a Bearer token with each request. If you do not include your Bearer token when making an API request, or use one that is incorrect or disabled, Subspace returns an error.
Bearer tokens are granted by requesting one (as noted below) and presenting your publishable (clientid) and secret (clientsecret) tokens.
Subspace provides two types of API tokens: publishable (clientid) and secret (clientsecret). These are available in the Subspace console. * Publishable API tokens (clientid) are meant solely to identify your account with Subspace, they aren’t secret. They can be published in places like your website JavaScript code, or in an iPhone or Android app. * Secret API tokens (clientsecret) should be kept confidential and only stored on your own servers. Your account’s secret API token will allow you to acquire a valid JWT token authorized to perform any API request to Subspace.
Subspace uses auth0 for JWT token management. You can acquire a JWT token by utilizing https://id.subspace.com
and following the instructions in the curl example below.
Subspace uses HTTP response codes to indicate the success or failure of an API request.
General HTML status codes: * 2xx Success. * 4xx Errors based on information provided in the request. * 5xx Errors on Subspace servers.
We provide a valid, signed certificate for our API methods. Be sure your connection library supports HTTPS with the SNI extension.
Making your first REST API call is easy and can be done from your browser. You will need: * Your secret token and public client token, both found in the Console. * The URL for the type of data you would like to request.
First, acquire a JWT Bearer Token. Command line example:
curl --request POST \\
--url \"https://id.subspace.com/oauth/token\" \\
--header 'content-type: application/json' \\
--data '{ \"client_id\": \"YOURCLIENTID\", \"client_secret\": \"YOURCLIENTSECRET\", \"audience\": \"https://api.subspace.com/\", \"grant_type\": \"client_credentials\" }'
REST calls are made up of:
* Base url: Example: https://api.subspace.com
* Version: Example: v1
* The API Endpoint and any parameters: accelerator/acc_NDA3MUI5QzUtOTY4MC00Nz
where acc_NDA3MUI5QzUtOTY4MC00Nz
is a valid accelerator ID
* Accelerator ids are always of the format acc_NDA3MUI5QzUtOTY4MC00Nz
, with a \"acc\" prefix followed by 22 characters.
* Project ids are always of the format prj_00Iaqxjo71vNL1uLKKo5Kn
, with a \"prj\" prefix followed by 22 characters.
* Token header: All REST requests require a valid JWT Bearer token which should be added as an “Authorization” header to the request:
`Authorization: Bearer YOUR_TOKEN_HERE`
If your API token was “myapitoken”, you would add...
Authorization: Bearer my_api_token
...to the header.
To list your current open packetaccelerators using the token “myapi_token”:
curl -H “Authorization: Bearer my_api_token” https://api.subspace.com/v1/accelerator
Alternately, to get the details of a specific accelerator whose id is 'abcd-ef01-2345':
curl -H “Authorization: Bearer my_api_token” https://api.subspace.com/v1/accelerator/abcd-ef01-2345
Subspace will release new versions when we make backwards-incompatible changes to the API. We will give advance notice before releasing a new version or retiring an old version.
Backwards compatible changes: * Adding new response attributes * Adding new endpoints * Adding new methods to an existing endpoint * Adding new query string parameters * Adding new path parameters * Adding new webhook events * Adding new streaming endpoints * Changing the order of existing response attributes
Versions are added to the base url, for example:
* https://api.subspace.com/v1
Current Version is v1: https://api.subspace.com/v1
Using the library from inside your program
use subspace_openapi_client::apis::*;
Configuration:
Set the JWT token, and pass in &my_config on all API calls.
let mut my_config = subspace_openapi_client::apis::configuration::Configuration::new();
my_config.oauth_access_token = Some("YOUR_JWT_TOKEN".to_string());
// Example call:
let list_accelerators = subspace_openapi_client::apis::accelerator_service_api::accelerator_service_list(&my_config,None,None,None).await;
dependencies.reqwest in Cargo.toml may need to have its features list updated to append "default-tls" or "rustls-tls" to enable your preferred TLS library for HTTPS connections.
This API client was generated by the OpenAPI Generator project. By using the openapi-spec from a remote server, you can easily generate an API client.
Put the package under your project folder and add the following to Cargo.toml
under [dependencies]
(assuming installation is to directory subspace-client):
subspace_openapi_client = { path = "./subspace-client" }
All URIs are relative to https://api.subspace.com
Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- AcceleratorServiceApi | acceleratorservicecreate | POST /v1/accelerator | AcceleratorServiceApi | acceleratorservicedelete | DELETE /v1/accelerator/{id} | AcceleratorServiceApi | acceleratorserviceget | GET /v1/accelerator/{id} | AcceleratorServiceApi | acceleratorservicelist | GET /v1/accelerator | AcceleratorServiceApi | acceleratorserviceupdate | PUT /v1/accelerator/{id} | GlobalTurnServiceApi | globalturnservicegetglobalturn | POST /v1/globalturn | *ProjectServiceApi* | projectservicecreate | POST /v1/project | *ProjectServiceApi* | projectserviceget | GET /v1/project/{id} | *ProjectServiceApi* | projectservicelist | GET /v1/project | *ProjectServiceApi* | projectserviceupdate | PUT /v1/project/{id} | *SessionServiceApi* | sessionservicelist | GET /v1/accelerator/{acceleratorid}/session | SessionServiceApi | sessionservicelist2 | GET /v1/accelerators/{acceleratorid}/sessions | *SipTeleportServiceApi* | sipteleportservicecreate | POST /v1/sipteleport | SipTeleportServiceApi | sipteleportservicedelete | DELETE /v1/sipteleport/{id} | *SipTeleportServiceApi* | sipteleportserviceget | GET /v1/sipteleport/{id} | SipTeleportServiceApi | sipteleportservicelist | GET /v1/sipteleport | *SipTeleportServiceApi* | sipteleportserviceupdate | PUT /v1/sipteleport/{id} |
To get access to the crate's generated documentation, use:
cargo doc --open
sales@subspace.com