Authentication
As per the OAuth 2.0 Client Credentials Grant.
1. Get a client ID and secret
Create an API Client in SparkForms and take note of the generated client ID and secret.
Note that the client secret should be stored securely and not shared publicly.
It is possible to restrict each client's ability to access data in different workspaces, or the ability to make changes.
2. Get an access token
There are two scopes available, access to which will depend on settings of the client created in step 1:
read- access to read-only methodswrite- access to write methods
If no scope is specified, read will be assumed.
Request an access token using the token endpoint, using appropriate values for {client_id}, {client_secret} and {scope}:
curl -X POST https://app.sparkforms.io/api/token \
-u "{client_id}:{client_secret}" \
-d "grant_type=client_credentials&scope={scope}"
An OAuth 2.0 access token response will be provided:
{
"access_token": "{token}",
"token_type":" bearer",
"expires_in": 900,
"scope": "read"
}
3. Call the API
Use the provided token in subsequent calls to the API:
curl https://app.sparkforms.io/api/workspaces -H "Authorization: Bearer {token}"