The Request Object
#
Basic UsageThe JSON object that is sent to the API is comprised of three components:
auth
[required]: Anobject
used to identify the user.options
[optional]: Anobject
used to set certain behaviours of the request.functions
[required]: Anarray
of objects defining a sequence of functions you would like to run.
auth
#
The JSON object that is sent to the API must contain the auth
key at the top level of the object. The auth
object takes the following properties:
Key | Type | Description |
---|---|---|
username (required) | string | Your SkyCiv username used to sign into the platform. |
key (optional) | string | Your SkyCiv API key from the account settings page. |
session_id (optional) | string | The session_id provided in the response from the first call to the API. Providing this session_id in lieu of key will allow you to skip the verification process for subsequent calls within 30 minutes of the first call. |
The initial call object:
Subsequent calls object (within 30 mins of making the initial call):
important
If you provide key
and session_id
, the session ID will be used to authenticate. If the session ID has expired, the key
will be used to start a new session. If key
is not provided and the provided session ID has expired, the request will fail.
username
(required)#
The username
property should have a string value of your SkyCiv username.
key
(optional)#
The key
property should contain a string value of your SkyCiv API key. This can be obtained from the account settings page. If this is not provided, then session_id
is required.
session_id
(optional)#
Providing the session_id
property in lieu of key
will allow you to skip the verification process for subsequent calls within 30 minutes of the first call. If the session_id
property is not provided, you must provide key
.
When using the S3D.session.start
function, you can opt to keep your session open by setting the keep_open
property to true
. This means that after you run a batch of functions, you can keep the session open for 30 minutes. This allows you to re-visit the session without having to re-authenticate therefore increasing the speed of subsequent calls.
If you set the keep_open
property to true
, the API will return a last_session_id
that you can use for the next authentication. The code block below shows the response from the initial call containing the last_session_id
:
options
#
The options property allows you to provide an object which specifies certain behaviours of the request. The options object accepts the following values:
Key | Type | Description | Default |
---|---|---|---|
validate_input (optional) | boolean | Verify the model input with SkyCiv's built in model validator. | false |
response_data_only (optional) | boolean | Only respond with data from the last function specified in the functions array. | false |
timeout (optional) | int | Timeout override option (in ms). Only implement in calls that need more time to complete. Otherwise, by default SkyCiv will use smarter timeout times based on the function and model size attempted. | false |
return_log (optional) | boolean | Returns a log of the API processes, useful for debugging. | false |
response_webhook_url (optional) | string | Longer API calls can be returned to the user via a user-defined webhook URL. Include a URL here and your response will be sent here rather than back to the client. | false |
timezone (optional) | number | Any number | UTC offset of the timezone used for the datetime printed on output reports. For example Sydney, Australia would be 10 as it is GMT+10. |
validate_input
(optional)#
The validate_input
property indicates if your input should be verified. If true
is provided, a fast and descriptive response will be returned if there is any issues with the input. It is not recommended to omit this key (or use false
) unless you are confident of the API call input data.
response_data_only
(optional)#
The API response contains the following components:
response
(object) - Contains the data from the final function and some other useful information.functions
(array) - Each object in this array provides results for the respective function.
To keep the response size down, you can set response_data_only
to true
. This means you will only receive the response object. This will contain the data
from the last function called. response_data_only
defaults to false
.
functions
#
The functions
property takes an array
of objects - each object defines a function to be executed. The functions should be in order of desired execution.
#
Common argumentsKey | Type | Accepts | Description | Default |
---|---|---|---|---|
return_data | boolean | true , false | Omits data object from the response for the respective function. | false |
The following is a list of available functions: