Quickstart Guide: Importing Functional Test Data

Support / Quickstart Guide: Importing Functional Test Data

Who is this Quickstart Guide for?

  • Anyone scoping an integrate to send test data to Instrumental
  • Anyone creating their first test integration to Instrumental

Looking for full Data Streams API documentation?  See this page.

TIP: Instrumental recommends you use a test project when trying your first integration. If you have not gotten access to a test environment, it’s easy to get one! Contact your Instrumental representative to get one within 24 hours.

Table of Contents

 

Sending Test Results

Once your account is set up and you have an API Key, you can start sending test results in minutes.

Here’s an example of a JSON body with the structure the API accepts:

{
  "inspections": [
    {
      "serialNumber": "SN12345",
      "stationName": "Camera Functional Test",
      "timestamp": {
        "iso8601Time": "2022-05-09T05:45:30.000Z",
        "ianaTimeZone": "Asia/Shanghai"
      },
      "data": [
        {
          "name": "Overall Camera Test [P/F]",
          "value": {
            "string": "PASS"
          }
        }
      ]
    }
  ]
}

In the Instrumental Web App you’ll see:

See the full Data Streams API documentation page for more details.

Doing your first upload

  1. Log in to the Instrumental Web App
  2. Get an API Key by opening the API Keys modal, then clicking the purple “ADD KEY” button:
    Screenshot of API Keys link Data Streams API Keys modal
    Treat all API keys like passwords and share them securely.
  3. Upload sample data with one of these scripts, using your API key
    • You can copy the minimal examples below in the language of your choice. Or, if you prefer to try parsing some data into the correct format, you can use this sample CSV:
      Serial,Timestamp,Station Name,Overall Result,Battery Voltage [V],Battery Voltage Min [V],Battery Voltage Max [V],Test Suite Version
      RY76253,2019-10-05T07:22:10.000Z,Final Functional Test,TRUE,3.873,3.75,3.9,1.2a_DVT
      RY35726,2019-10-05T08:01:07.000Z,Final Functional Test,FALSE,3.992,3.75,3.9,1.2a_DVT
      RY73014,2019-10-05T07:23:36.000Z,Final Functional Test,TRUE,3.808,3.75,3.9,1.2a_DVT

      Screenshot of CSV example in Excel

    • Click to see cURL sample
      curl -v -XPOST --data '{"inspections": [{"serialNumber": "Serial Number","stationName": "Station Name","timestamp": {"iso8601Time": "2022-04-12T18:34:40.000Z","ianaTimeZone": "Asia/Shanghai"},"data": [{"name": "Voltage (V)","value": {"double": 4.2}},{"name": "Version","value": {"string": "1.0"}}]}],"measurementLimits": {"Voltage (V)": {"in.datatypes.measurementlimit.NumberMeasurementLimit": {"passingUpperBound": 5,"passingLowerBound": 3.3}}}}' -H 'instrumental-api-key: YOUR_API_KEY' -H 'content-type: application/json' https://api.instrumental.ai/api/v1/externalData/ingest
      
    • Click to see Python 3 sample

      This example uses the requests library with Python 3. If you get a ModuleNotFoundError when running it, run python -m pip install requests and try again.

      import json
      import requests
      
      response = requests.post(
          "https://api.instrumental.ai/api/v1/externalData/ingest",
          data=json.dumps({
              "inspections": [
                  {
                      "serialNumber": "Serial Number",
                      "stationName": "Station Name",
                      "timestamp": {
                          "iso8601Time": "2022-04-12T18:34:40.000Z",
                          "ianaTimeZone": "Asia/Shanghai"
                      },
                      "data": [
                          {
                              "name": "Voltage (V)",
                              "value": {"double": 4.2}
                          },
                          {
                              "name": "Version",
                              "value": {"string": "1.0"}
                          }
                      ]
                  }
              ],
              "measurementLimits": {
                  "Voltage (V)": {
                      "in.datatypes.measurementlimit.NumberMeasurementLimit": {
                          "passingUpperBound": 5,
                          "passingLowerBound": 3.3
                      }
                  }
              }
          }),
          headers={
              "content-type": "application/json",
              "instrumental-api-key": YOUR_API_KEY
          }
      )
      print(response)
      
    • Click to see JavaScript sample
      fetch(
          "https://api.instrumental.ai/api/v1/externalData/ingest",
          {
              method: "POST",
              headers: {
                  "instrumental-api-key": YOUR_API_KEY,
                  "content-type": "application/json",
              },
              body: {
                  "inspections": [
                      {
                          "serialNumber": "Serial Number",
                          "stationName": "Station Name",
                          "timestamp": {
                              "iso8601Time": "2022-04-12T18:34:40.000Z",
                              "ianaTimeZone": "Asia/Shanghai"
                          },
                          "data": [
                              {
                                  "name": "Voltage (V)",
                                  "value": {"double": 4.2}
                              },
                              {
                                  "name": "Version",
                                  "value": {"string": "1.0"}
                              }
                          ]
                      }
                  ],
                  "measurementLimits": {
                      "Voltage (V)": {
                          "in.datatypes.measurementlimit.NumberMeasurementLimit": {
                              "passingUpperBound": 5,
                              "passingLowerBound": 3.3
                          }
                      }
                  }
              }
          }
      )
      .then(response => response.json())
      .then(data => console.log(data));
      
  4. Check that the data shows up in the Instrumental Web App
  5. Start uploading your own data into the test project
  6. Review data with your Instrumental contact
  7. Start pushing data to a production project

Learn More

By following the steps above you should have uploaded test data. The next step is to parse and upload your production data. These documentation pages should be useful to you in doing that:

You may also want to bring in images and videos captured on your manufacturing line:

You may also want to export your unit data from Instrumental, including Instrumental AI results from Monitors and Measurements: