CS.SPARK_UDFCALLAPI (legacy)
This functionality is deprecated and not supported.
This implementation of Xcall has two parts, the Xcall block to define the request, and a user-defined function SPARK_UDFCALLAPI to receive responses.

Sample files
In this example we are using two files (upstream and downstream) to show the functionality of the Xcall using Coherent Assistant.

The downstream Excel file contains 2
Xoutputs (Output1,Output2), whereOutput1is a single value andOutput2is a separate JSON object having its own outputs.

The upstream Excel file contains the
Xcallblock, JSON response, and the user-defined functions (UDFs).
You can use these files to follow along:
Preparation
Downstream service
The downstream service must be an existing service in the same Spark tenant.
You will need the downstream folder name, service name and a sample of the request body.
You can get the folder name and service name of the downstream service from the Folder overview.
For the request body, select your downstream service and select the API Tester. Under API Request (Inputs), you can see inputs in different formats. Select Raw view and note the request body for the following steps.
Upstream service
Request
Create an xcall_block block in the upstream service to make an API call. The xcall_block can be anywhere in your workbook but must be on the same sheet as your CS.SPARK_UDFCALLAPI function.
This table needs the following mandatory fields:
CALLTYPE:SparkServiceFOLDERNAME: Name of the folder containing the downstream service.SERVICENAME: Name of the downstream service.REQUESTBODY: Payload for calling the downstream service. Must be in JSON format. You can copy theREQUESTBODYfrom the downstream service API Tester. If this is your first time usingSparkService, leave the content of request_meta empty. Spark will use the latest version and the default Service Type to execute this service. Therequest_metafollows the parameters that can be defined in request_meta.

REQUESTBODY example (v3 format):
Response
With Coherent Assistant, a user-defined function CS.SPARK_UDFCALLAPI(xcall_block) can be defined in an Excel worksheet of the upstream service to receive an API response from the downstream service.
xcall_blockis the location ofXcalltable in upstream service. e.g.$A$1:$B$4. You can also use a named range for convenience.The function must be on the same sheet as the
XCallTable.The function will return a JSON formatted string with two parts.
The first,
metadata, contains information about the call to the downstream service such asstatus,error_code, andresponse_time.The second,
data, contains the response body of the downstream service.
Sample response
Last updated
