Execute API (v4)
Execute multiple calculations from a Spark service.
Returns: Service execution response.
Each Spark service can be called to perform calculations by calling the Execute API. The v4 specification of the Execute API supports synchronous batching enabling multiple requests to be submitted at the same time. This API specification also forms the basis for using the Batch APIs and Introduction to XConnector.
This endpoint should not be used for very large number of input records because there is an execution time limit of 55 s and an error will be returned.
For very large numbers of input records, we recommend using applications that utilize the Batch APIs.
POST /{tenant}/api/v4/execute
POST /{tenant}/api/v4/public/executeAuthorization
Bearer {token}accessible from Authorization - Bearer token or systematically via Client Credentials.The request headers should include a key for
Authorizationwith the valueBearer {token}.
API key created from Authorization - API keys. The API key groups must contain User groups that are also assigned to Permissions - Features permissions
Spark.SyncBatch.jsonorSpark.AllEncompassingProxy.json.The request headers should include the keys
x-synthetic-keyandx-tenant-namewith the values of the API key and tenant name respectively.
No Authorization is required for Authorization - Public APIs.
Path parameters
tenant *
Tenant is part of your Log in to Spark URL and also available in the User menu.
Request body
Content-Type: application/json
inputs
service
URI or service_id of the service being called.
Example 1: stocks/NVDA
Example 2: stocks/NVDA[1.4.3]
Example 3: stocks/NVDA[1.4] take the latest version starting with 1.4.
Example 4: stocks/NVDA[1] take the latest version starting with 1.
Example 5: /folders/stocks/services/NVDA
Example 6: a5e3f03a-57ca-4889-adae-0630be54bd87
version_id
version_id of the requested service version.
Example: 8183f03a-57ca-4889-adae-0630be54bd87
version_by_timestamp
Timestamp to resolve the service version for Manage service versions and effective dates.
Use Timestamp Converter to convert dates to ISO 8601.
When call to a service is made using a URI or
service_idthis is used to determine the latest version of a service which have effective start and effective end dates that boundversion_by_timestamp.If omitted, the current date and time is used.
If the
version_by_timestampdoes not fall within the effective start and effective end dates of any versions, then the response will be an error.
When calling a specific version using
versionorversion_idthis field has no effect.
Example: 2023-10-31T01:30:00.000-05:00
output
Array of strings to denote the outputs to keep in the results. The strings can also contain regular expressions.
Example 1: ["value_*", "valuation_by_*"]
Alternatively direct references to Excel ranges are possible.
For Neuron 1.17.0 and later this can be enabled In Excel by adding a Named Range referenced to a cell called xBuildParams. The cell contents must contain '--direct_addressing=true.
Example 2: ["@Sheet1!B2:D4"]
Example 3: ["@MyNamedRange"]
Furthermore if #SparkFormulaValueVector is added to these requests, only the calculated results would be returned.
compiler_type
Calculation engine for the request. By default this uses the setting defined in Change the Default Service Type. Note that Type3 is not supported with this version of the API specification.
Example: Neuron or Xconnector
manual_now
Neuron behavior:
Default behavior in Spark for the Excel NOW() and TODAY() functions are to return the value based upon server time. If a Unix epoch time is provided, then that will be used to derive the current time and date instead.
Example: 1650593119 would represent 2024-10-29T02:44:48
call_purpose
Tag API Call. Can be queried in API Call History.
Example: admin system p
correlation_id
Tag API Call. Can be queried in API Call History.
Example: 456
source_system
Tag API Call. Can be queried in API Call History.
Example: mycicd
subservice
Comma separated string of subservice names. Reference How to: Work with subservices.
When this is not specified or set as #Default#, outputs not related to subservices are shown.
Example 1: subservice1 will only show the the outputs from subservice1.
Example 2: subservice1,subservice2 will only show the outputs from subservice1 and subservice2.
Example 3: #Default#,subservice2 will show outputs not relating to subservices and from subservice2.
Example 4: * all subservices will be included
inputs definitions
inputs definitionsRefer to Execute API (v3) request_data for information about input definitions and data types.
Synchronous request of inputs using JSON objects
If using JSON objects, a synchronous request containing multiple records can be made by stacking the request objects together within the inputs array. The requests are formatted in a similar way to the Execute API (v3) request_data. The response will also be returned in a similar format, with outputs being an array of JSON objects corresponding to each record.
In this example, the service has 2 inputs: A is a single value and B is a 3x2 table comprising of the headers B1 and B2. This request includes 2 records for calculation.
Synchronous request of inputs using JSON arrays
If using JSON arrays, a synchronous request containing multiple records can be defined in the following structure:
The first row contains the name of the inputs in an array.
The subsequent rows define the values for the corresponding records, in this case
AandB. If an input is a table, its table headings are also included in the data, in this caseB1andB2are repeated in each entry.This format is much more compact for large datasets and used for the Batch APIs and Introduction to XConnector.
The response will also be returned in a similar format.
In this example, the service has 2 inputs: A is a single value and B is a 3x2 table comprising of the headers B1 and B2. This request includes 2 records for calculation.
Parameters to resolve Spark service versions
Spark will use the parameters version_id, service, and version_by_timestamp in order to resolve down to the most appropriate version_id to use for an API call. Learn more about the version resolution in the section Manage service versions and effective dates.
version_id will be resolved by Spark the quickest.
Execute API will always resolve the version_id parameter first, service_id parameter second, and then service last. It is possible that these 3 may refer to different services entirely but Spark will resolve the reference in the same order.
Sample request
The 2 sample requests will give equivalent results with different JSON formatting.
A11is a single value.A33is an input table with headersA1,A2,A3.A44is an input table with headingsA1,B(with subheadingsB1,B2), andC1.
Response body
Content-Type: application/json
outputs
Array of outputs. The elements of the array correspond to the input request records.
Outputs will be formatted in a similar way to the inputs. The layout of outputs depends on whether the inputs comprised of an array of JSON objects or JSON arrays.
process_time
Array representing the time for Spark to process each record of the API call. The elements of the array correspond to the input request records.
Example: [39, 24]
errors
Array of errors. The elements of the array correspond to the input request records. Reference response_data.
warnings
Array of warnings. The elements of the array correspond to the input request records. Reference response_data.
service_id
service_id of the resolved service.
Example: 48a953cc-ed34-4454-b5c7-1141912f2f8d
version_id
version_id of the resolved service version.
Example: 6bf49dca-5bc2-4144-9710-5988a0f44163
version
Resolved service version number.
Example: 4.15.2
call_id
Universally unique identifier for this API Call. This can be referenced in the API Call History.
Example: f6123393-d33f-4ff6-86a4-a663111afd82
compiler_version
Compiler version of this service version.
Example: 4.15.2
correlation_id
Value from Request body.
request_timestamp
Request timestamp.
Example: 2020-10-29T09:53:18.8314052Z
Sample response
HTTP 200 OK Content-Type: application/json
Last updated
