How to: Upload Spark service files via API
To upload and publish a service to a new environment, we recommend using the following 3 step process:
This guide walks through how to use the 3 APIs together. All 3 APIs are necessary to create a new service. This guide uses Postman to interact with the APIs, but you can use any tool you like.
Authorization
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.ServiceUpload.json,Spark.ServiceCompilationProgress.json, andSpark.ServicePublish.jsonor justSpark.AllEncompassingProxy.json.The request headers should include the keys
x-synthetic-keyandx-tenant-namewith the API key and tenant name respectively.
Upload Spark service files
Request
Setup a
POSTrequest tohttps://excel.{environment}.coherent.global/{tenant}/api/v3/folders/{folder}/services/{service}/upload.{folder}and{service}should represent the target destination for the uploaded service.
Setup the request headers for the API call.
Include the necessary Authorization.
Note that the
Content-Typeshould bemultpart/form-data.Postman may automatically create some headers for you.
For the request body:
Create the
serviceFilekey and change the key type toFile. Then you can select the Excel file you want to upload.
Enter the values for
engineUploadRequestEntityas described below. For information about customizing the values, see Upload Excel file to Spark. These values are placeholders as they will be updated in Publish service.{ "request_data": { "version_difference":"minor", "effective_start_date":"2010-01-01", "effective_end_date":"2120-01-01" } }
Send the API call. Spark will inform you if the service name already exists.
Response
HTTP 200 OK Content-Type: application/json
The success response should look similar to the output below. Take note of the nodegen_compilation_jobid, original_file_documentid, and engine_file_documentid as this information is needed for the subsequent steps.
Check compilation status
After the Excel file is uploaded, the file is converted from Excel to code using the Neuron compiler. It's important to check the status of the compilation to ensure that the job completed successfully before the service can be published. We'll use the following API to do so.
Request
Setup a
GETrequest tohttps://excel.{environment}.coherent.global/{tenant}/api/v3/folders/{folder}/services/{service}/getcompilationprogess/{nodegen_compilation_job_id}.{folder}and{service}should represent the target destination for the uploaded service. This should be the same as the previous API call.
{nodegen_compilation_job_id}can be found from Upload Spark service files Response.Setup the request headers for the API call.
Include the necessary Authorization.
Postman may automatically create some headers for you.
Send the API call.
Response
HTTP 200 OK Content-Type: application/json
If the progress is 100, the compilation has completed.
Publish service
Once the compilation was successful, we can publish the uploaded service.
Request
The success response should look similar to the output below. Take note of the nodegen_compilation_jobid, original_file_documentid, and engine_file_documentid as this information is needed for the subsequent steps.
Setup a
POSTrequest tohttps://excel.{environment}.coherent.global/{tenant}/api/v3/folders/{folder}/services/{service}/publish.{folder}and{service}should represent the target destination for the uploaded service. This should be the same as the previous API calls.
Setup the request headers for the API call.
Include the necessary Authorization.
Note that the
Content-Typeshould beapplication/json.Postman may automatically create some headers for you.
For the request body, use the JSON below and complete the following parameters:
Replace
{service}with the name used and previous steps.Replace
{original_file_documentid}and{engine_file_document_id}with the values returned from Upload Spark service files Response.For information about customizing the values, see Upload Excel file to Spark.{
Send the API call.
Response
HTTP 200 OK Content-Type: application/json
The service is now published!
Last updated
