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

Upload Spark service files

Request

  1. Setup a POST request to https://excel.{environment}.coherent.global/{tenant}/api/v3/folders/{folder}/services/{service}/upload.

    • {folder} and {service} should represent the target destination for the uploaded service.

  2. Setup the request headers for the API call.

    • Include the necessary Authorization.

    • Note that the Content-Type should be multpart/form-data.

    • Postman may automatically create some headers for you.

  3. For the request body:

    1. Create the serviceFile key and change the key type to File. Then you can select the Excel file you want to upload.

    2. Enter the values for engineUploadRequestEntity as 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"
              }
      }
  4. 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

  1. Setup a GET request to https://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.

  2. {nodegen_compilation_job_id} can be found from Upload Spark service files Response.

  3. Setup the request headers for the API call.

    • Include the necessary Authorization.

    • Postman may automatically create some headers for you.

  4. 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.

  1. Setup a POST request to https://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.

  2. Setup the request headers for the API call.

    • Include the necessary Authorization.

    • Note that the Content-Type should be application/json.

    • Postman may automatically create some headers for you.

  3. For the request body, use the JSON below and complete the following parameters:

    1. Replace {service} with the name used and previous steps.

    2. Replace {original_file_documentid} and {engine_file_document_id} with the values returned from Upload Spark service files Response.

    3. For information about customizing the values, see Upload Excel file to Spark.{

  4. Send the API call.

Response

HTTP 200 OK Content-Type: application/json

The service is now published!

Last updated