Station endpoint for data streaming

Use an API station endpoint to stream observation data for process and output measures directly into station data tables.

Endpoint configuration

This route connects to the station resource for data streaming, https: //spc.minitab.com/Station/?apikey=12478781287471824&action=streamData&args=[{JSON}}

The request body accepts the following properties:
  • Apikey – the API key for authentication and authorization
  • Action – “streamData” – the name of the API action
  • Args – JSON array that contains the serialized request body. For this API, it is a serialized DataStreamingRequestDTO model type.
Each data streaming request can have data for up to 50 subgroups with 1000 observations.

Request properties

Properties for [DataStreamingRequestDTO]:

Provide either the external_station_id or the sys_id for the station.

  • string   external_station_id

    External station identifier, usually station name, or work station in SAP Digital Manufacturing.

  • int  station_id

    Sys_id for the station.

  • int   sampling_plan_id 

    Sys_id for the samplng plan. Optional for a single sampling plan; required if multiple sampling plans are associated with the station.

  • array[SubgroupWithObservationsRequestDTO]   subgroups 

    List of subgroups with their properties and observations to create.

Properties for [SubgroupWithObservationsRequestDTO] :
  • datetime  timestamp

    Timestamp for the observations. Optional, datetime in ISO 8601, defaults to current date and time for server if not provided. For more information, go to Timestamp data requirements.

  • array[Descriptor_valueRequestDTO]  descriptors

    Descriptors and their values for the subgroup. Optional.

  • array[ObservationRequestDTO]   observations

    Observations for this subgroup, at least 1 observation is required.

Properties for [DescriptorValueRequestDTO] :

Provide either the external_descriptor_id or the sys_id for the descriptor.

  • string  descriptor_value

    Descriptor value is required.

  • string   external_descriptor_id

    External descriptor identifier.

  • int descriptor_id

    sys_id for the descriptor.

Properties for [ObservationRequestDTO] :

Provide either the external_measure_id or the sys_id for the measure.

  • string   external_measure_id

    External measure identifier for the observation.

  • int measure_id

    sys_id for the measure.

  • float   observation 

    Value for the observation is required.

  • array[Descriptor_valueRequestDTO]  descriptors 

    Descriptors and their values for the observation. Optional.

Sample JSON arrays

The following request body contains minimum required fields using ids:
[
  {
    "station_id": 14,
    "subgroups": [
      {
        "observations": [
          {
            "observation": 3.5,
            "measure_id": 7
          }
        ]
      }
    ]
  }
]
The following request body contains minimum required fields using external ids:
[
  {
    "external_station_id": "Ribbon Manufacturing Station",
    "subgroups": [
      {
        "observations": [
          {
            "observation": 3.5,
            "external_measure_id": "Roll Width"
          }
        ]
      }
    ]
  }
]
The following request body contains all available fields using external ids:
[
  {
    "external_station_id": "Ribbon Manufacturing Station",
    "sampling_plan_id": 11,
    "subgroups": [
      {
        "timestamp": "2024-12-11 19:55:18Z",
        "descriptors": [
          { 
            "external_descriptor_id": "Batch Number",
            "descriptor_value": "4973" 
          }
        ],
        "observations": [
          {
            "observation": 3.5,
            "external_measure_id": "Roll Width",
            "descriptors": [
              { 
                "external_descriptor_id": "Roll Color",
                "descriptor_value": "Blue" 
              }
            ]
          }
        ]
      }
    ]
  }
]

Request results

For data streaming, Real-Time SPC returns the number of successful and failed records.
{
  "success_count": 40,
  "failure_count": 2        
}

Validation schema

To save time and reduce errors, use the following JSON schema with an external validator to validate your data streaming to station endpoint requests.
{
  "title": "DataStreamingRequestDto",
  "description": "",
  "type": "object",
  "properties": {
    "sampling_plan_id": {
      "type": ["integer","null"],
      "minimum": 1
    },
    "external_station_id": {
      "type": "string",
      "minLength": 1,
      "maxLength": 255
    },
    "station_id": {
      "type": "integer",
      "minimum": 1
    },
    "subgroups": {
      "type": "array",
      "maxItems": 50,
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/SubgroupWithObservationsRequestDto"
      }
    }
  },
  "required": ["subgroups"],
  "oneOf": [
    {
      "required": ["external_station_id"]
    },
    {
      "required": ["station_id"]
    }
  ],
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "DescriptorValueRequestDto": {
      "title": "DescriptorValueRequestDto",
      "description": "",
      "type": "object",
      "properties": {
        "descriptor_value": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255,
          "pattern": "^(?!\\s*$).+"
        },
        "external_descriptor_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "descriptor_id": {
          "type": "integer",
          "minimum": 1
        }
      },
      "required": ["descriptor_value"],
      "oneOf": [
        {
          "required": ["external_descriptor_id"]
        },
        {
          "required": ["descriptor_id"]
        }
      ]
    },
    "ObservationRequestDto": {
      "title": "ObservationRequestDto",
      "description": "",
      "type": "object",
      "properties": {
        "external_measure_id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 255
        },
        "measure_id": {
          "type": "integer",
          "minimum": 1
        },
        "observation": {
          "type": ["number", "null"],
          "minimum": -10000000000,
          "maximum": 10000000000
        },
        "descriptors": {
          "type": ["array", "null"],
          "maxItems": 100,
          "items": {
            "$ref": "#/$defs/DescriptorValueRequestDto"
          }
        }
      },
      "required": ["observation"],
      "oneOf": [
        {
          "required": ["external_measure_id"]
        },
        {
          "required": ["measure_id"]
        }
      ]
    },
    "SubgroupWithObservationsRequestDto": {
      "title": "SubgroupWithObservationsRequestDto",
      "description": "",
      "type": "object",
      "properties": {
        "timestamp": {
          "type": ["string", "null"],
           "pattern": "^(\\d{4}-\\d{2}-\\d{2}[T ]\\d{2}:\\d{2}:\\d{2}(?:Z|(?:[+-]\\d{2}:\\d{2})|)?)$",
          "$comment": "Value must be a valid date-time with optional timezone.",
          "examples": [
            "\"2025-01-01T01:23:45\"",
            "\"2025-01-01 01:23:45\"",
            "\"2025-01-01T01:23:45Z\"",
            "\"2025-01-01 01:23:45Z\"",
            "\"2025-01-01T01:23:45-05:00\"",
            "\"2025-01-01 01:23:45-05:00\""
          ]
        },
        "descriptors": {
          "type": ["array", "null"],
          "maxItems": 100,
          "items": {
            "$ref": "#/$defs/DescriptorValueRequestDto"
          }
        },
        "observations": {
          "type": "array",
          "maxItems": 1000,
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/ObservationRequestDto"
          }
        }
      },
      "required": ["observations"]
    }
  }
}