Search

Home

Home

REST API Invocation and Response

REST API Invocation and Response

Invocation

An example of a request body sent to invoke a GRAVITY service in JSON format:

Description of the requestobject:

call_alias
Yes, when invoked using the callandgetdata batch method.
string
Indicates which trigger should be executed (the Alias field in the trigger definition).
Attribute
Required?
Type
Description
cache_time
No. If this attribute is not provided, the data returned by the trigger will not be stored in the cache.
int
Specifies how long (in seconds) the data returned by the trigger should be stored in the cache. Each access to the cached data extends the cache lifetime by the value of this parameter. This is useful when retrieving data in batches. Cached data can be accessed using the process_id parameter.
process_id
Required for retrieving data from the cache.
int
An identifier of the processing execution, returned in the response from a given trigger and used to reference cached data. If the specified process_id exists in the cache, the trigger will not be executed and the data will be returned directly from the cache. If the process_id is not found in the cache, the trigger will be executed, new data will be returned, and a new process_id value will be generated.
get_data
No, if the project triggered contains only a single OUTPUT DATAOUTPUT DATA operator and you do not intend to paginate, filter, or sort the data.
Array[output_data]
An array of output_data objects. This parameter controls how data is returned from OUTPUT DATAOUTPUT DATA operators defined in the project.
parameters
Yes, if the project uses parameters.
object
Provides a way to pass parameters to the project, including both simple parameters and object parameters used by the INPUT DATAINPUT DATA operator.

Description of the output_data object:

records_count
No. Required only when retrieving data in batches.
int
Specifies the number of records to return. Can be used together with process_id(=returned in the first service response). In this case, subsequent data batches are retrieved from the cache and the trigger is not executed again.
Attribute
Required?
Type
Description
description
Yes
string
The name of the OUTPUT DATAOUTPUT DATA operator as defined in the project.
offset
No. Required only when retrieving data in batches.
int
Specifies the offset (next page of data).
filter
No. Required only when filtering data.
Array[“field”, “condition”, “value”]
A parameter defined as a three-element array containing: field – the data field to filter on condition – the filter condition value – the value to compare against Both field and value can be expanded into arrays according to the rules described above. Can be used together with the process_id parameter. Possible values for condition are listed below.
sort
No. Required only when sorting results.
Array[sort]
An array of sort objects defining how the data returned from the specified OUTPUT DATAOUTPUT DATA operator should be sorted.. Can be used together with the process_idparameter.

condition attribute of the filter array:

Value
Type
Description
and
logical
Used to combine conditions; all conditions joined by this operator must be met.
or
logical
Used to combine conditions; at least one of the conditions joined by this operator must be met.
== or =
comparison
Equal to
!=
comparison
Not equal to
>
comparison
Greater than
>=
comparison
Greater than or equal to
<
comparison
Less than
<=
comparison
Less than or equal to
contains
comparison
Contains the specified string (case-insensitive).
containscasesensitive
comparison
Contains the specified string (case-sensitive).
startswith
comparison
Starts with the specified string.
endswith
comparison
Ends with the specified string.

Description of the parameters object:

Attribute
Required?
Type
Desciption:
[parameter_name]
depends on the parameter definition in the project
depends on the parameter definition in the project
parameter_name depends on the parameters defined in the project, as does its type. Any parameter defined in the project can be passed as a property of the parameters object.
[DATA INPUT operator name]
depends on the parameter definition in the project
object (structure defined in the project)
If the project uses the INPUT DATAINPUT DATA operator, the object name must match the operator name. The value is an object whose structure is defined in the operator’s JSON template field.

Description of the sort object:

selector
Yes
string
Name of the field in the data returned by the process by which the data will be sorted
Attribute
Required?
Type
Desciption:
desc
Yes
bool
Sort direction

Answers

  • Correct answer:

Description of the responseobject:

Attribute
Type
Description
process_id
string
Identifier of the trigger execution process. If the cache_time parameter was used in the request, this value can be used to retrieve data from the cache.
state
string
Execution status. Possible values: Success or Fault.
output_data
Array[output_data]
Array of OUTPUT DATAOUTPUT DATA operators defined in the service call. Contains the operator parameters and the returned data.

Description of theoutput_dataobject:

Attribute
Type
Description
output_description
string
Name of the OUTPUT DATAOUTPUT DATA operator from which the data is returned.
records
int
Total number of records returned by the OUTPUT DATAOUTPUT DATA operator.
filtered_records
int
Number of records returned after applying filters. Not present if no filters are applied.
input_parameters
object
Object containing the invocation parameters passed for this specific OUTPUT DATAOUTPUT DATA operator.
data — the property name may vary, depending on the output schema configured on the OUTPUT DATAOUTPUT DATA operator.
object
Data returned by the OUTPUT DATAOUTPUT DATA operator. The structure depends on the JSON schema configuration defined on the operator.
  • Incorrect answer:
{
    "process_id": 0,
    "state": "Fault",
    "error": "There is no such a call_alias: article1"
}

Description of the errorobject:

Attribute
Type
Description
process_id
string
Identifier of the trigger execution process.
state
string
Execution status. Possible values: Success or Fault.
error
string
Error description.