Programmatically Add Files to SystemLink Test Result

Updated Apr 9, 2025

Environment

Software

  • SystemLink Test Module
  • SystemLink Server

This article demonstrates how a SystemLink Test Result can be programmatically modified, including adding a new file as an attachment.

 

This process involves using the  /v2/update-results HTTP API. With this API, existing Test Results uploaded to the SystemLink Server can be updated, including, but not limited to:

  • Changing/adding properties
  • Changing/adding keywords
  • Adding/adding files
  • Changing Serial Number

 

For demonstration purposes, this article focuses solely on adding a new file to the Test Result. However, a full list of Test Result metadata that can be modified can be found at the bottom of this article.

 

To programmatically modify an existing SystemLink Test Result, follow the steps below.

 

  1. From the SystemLink web UI, access the Test Insights >> Results page.

 

 

  1. From the top right-hand corner, click the question mark icon and select HTTP API.
    • This launches a new tab to the Swagger UI, an interactive manual for testing SystemLink's HTTP API.

 

 

  1. In the new Swagger UI tab, ensure that Test Monitor Service is selected from the top drop-down menu.
    • This is the list of API used to interact with Test Results.

 

 

  1. Scroll through the list of API to find the /v2/update-results HTTP POST request under the Results header.
    • This can be used to programmatically modify an existing Test Result.

 

 

  1. Click on the API to expand details. Then click on Try it out to test the API.

 

 

  1. Modify the requestBody to include only the below JSON string.
    • When modifying a Test Result, an id must be provided at minimum. The remaining JSON keys can be included optionally.
    • The replace key defines whether new data should replace the result's existing data. If set to false, new values will be added on top of the already existing values.

 

{
  "results": [
    {
      "id": ""
    }
  ]
  "replace": false,
  "determineStatusFromSteps": false
}

 

  1. To identify the ID of a Test Result, open the Test Result in the SystemLink UI and copy the string on the end of the URL.

 

 

  1. Insert this string as the value of id in the requestBody.

 

{
  "results": [
    {
      "id": "3d311451-4948-47e4-b3f8-6a666ca9a669"
    }
  ]
  "replace": false,
  "determineStatusFromSteps": false
}

 

  1. From the SystemLink UI, select the Utilities >> Files page.

 

 

  1. From here, upload a file that you wish to add to your Test Result.
  2. Once uploaded, double-click on the file to view it's details in the SystemLink web UI.
  3. Copy the string on the end of the URL to obtain the file ID.

 

 

  1. Modify the requestBody in the Swagger UI to include a fileIds array key. Paste your file ID as the value.

 

{
  "results": [
    {
      "id": "3d311451-4948-47e4-b3f8-6a666ca9a669",
"fileIds": [
        "67b70fef24e34e7508a66ae3"
      ]
}
  ],
  "replace": false,
  "determineStatusFromSteps": false
}

 

  1. Click the blue Execute button to test programmatically adding this file to an existing Test Result.

 

 

  1. Scroll down to see Responses section. A response with code 200 indicates that the API executed successfully.

 

Once complete, the Test Result uploaded to the SystemLink UI will change to reflect your modifications. The Request Body tested on the Swagger UI can then be re-purposed in any external programming environment that supports HTTP requests.

 

Below is a full list of Test Result metadata that can be modified using the HTTP API. To understand the exact syntax of each, refer to the default Request Body used in the Swagger UI's ​/v2​/update-results API:

  • programName - a string that defines the name of the test program associated with the result.
  • statusType - a string that defines whether the overall sequence passed, failed, errored or was terminated.
  • statusName - a string defining the name of the status.
  • systemId - a string defining the system that the Test Result is associated with.
  • hostName - a string defining the name of the host that the Test Result is associated with.
  • properties - a dictionary consisting of key-value pairs that define custom properties added to the Test Result.
  • keywords - an array of strings defining custom keywords added to the Test Result.
  • serialNumber - a string defining a DUT or product Serial Number associated with the Test Result.
  • operator - a string defining the name of the operator that executed the Test Result.
  • partNumber - a string defining a DUT or product Part Number associated with the Test Result.
  • fileIds - an array of strings defining files to upload as attachments with the Test Result.
  • startedAt - a string consisting of date and time (in ISO 8601 format) that represents the timestamp for when the Test Result was started.
  • totalTimeInSeconds - a floating point number representing the duration of the Test Result in seconds.
  • workspace - a string that defines the ID of the Workspace that the Test Result belongs to.
  • replace - a boolean defining whether new values should replace existing values in the Test Result.
  • determineStatusFromSteps - a boolean defining whether the Test Result status should be automatically determined based on each step result.