데이터 스트리밍을 위한 스테이션 엔드포인트

API 스테이션 엔드포인트를 사용하여 관측 데이터를 스트리밍하여 프로세스 및 출력 측정값을 스테이션 데이터 테이블로 직접 전송할 수 있습니다.

엔드포인트 구성

이 경로는 데이터 스트리밍을 위해 스테이션 자원과 연결됩니다.

https: //spc.minitab.com/api/app/spc/Station/?apikey={APIKEY}&action=streamData&args=[{JSON}]

요청 기관은 다음과 같은 속성을 수용합니다:
  • APIKEY – 인증 및 권한을 위한 API 키
  • action – "streamData" – API 동작의 이름입니다
  • args – 직렬화된 요청 본문을 포함하는 JSON 배열입니다. 이 API는 직렬화된 DataStreamingRequestDTO 모델 유형입니다.
각 데이터 스트리밍 요청은 최대 50개의 하위 그룹에 대한 데이터를 포함할 수 있으며, 관측값은 1000개입니다.

요청 속성

[DataStreamingRequestDTO]의 속성:

스테이션의 external_station_id 또는 sys_id을 제공합니다.

  • 스트링   external_station_id

    외부 스테이션 식별자, 보통 스테이션 이름이나 SAP Digital Manufacturing에서는 작업 스테이션입니다.

  • 내station_id  

    Sys_id 역에 가.

  • 내sampling_plan_id    

    샘플링 플랜을 Sys_id. 단일 샘플링 계획의 경우 선택 사항; 여러 샘플링 계획이 방송국과 연관되어 있을 경우 필요합니다.

  • array[SubgroupWithObservationsRequestDTO]   하위 그룹 

    하위 군의 특성과 관찰값 목록.

[SubgroupWithObservationsRequestDTO] 속성 :
  • 날짜 타임  스탬프

    관찰 타임스탬프. 선택 사항으로, ISO 8601의 datetime은 제공되지 않으면 서버의 현재 날짜와 시간이 기본값으로 표시됩니다. 자세한 내용은 다음을 참조하십시오타임스탬프 데이터 요구사항.

  • array[Descriptor_valueRequestDTO]  디스크립터

    서브그룹에 대한 디스크립터와 그 값들. 선택 사항입니다.

  • array[ObservationRequestDTO]   관측

    이 하위 그룹의 관측은 최소 1건의 관측이 필요합니다.

[DescriptorValueRequestDTO] 속성 :

기술자에 대한 external_descriptor_id 또는 sys_id을 제공하세요.

  • 스트링  descriptor_value

    디스크립터 값이 필요합니다.

  • 스트링   external_descriptor_id

    외부 기술자 식별자.

  • 내descriptor_id

    설명 sys_id

[ObservationRequestDTO] 의 속성 :

측정 external_measure_id 또는 sys_id을 제공하세요.

  • 스트링   external_measure_id

    관측에 대한 외부 측정 식별자.

  • 내measure_id

    측정 sys_id 있어.

  • 플로트   관찰 

    관찰 값이 요구됩니다.

  • array[Descriptor_valueRequestDTO]  디스크립터 

    관찰에 대한 기술자와 그 값들. 선택 사항입니다.

참고

연속적인 측정값, 프로세스와 출력만이 스테이션 테이블에 직접 스트리밍될 수 있습니다.

예제 JSON 배열

다음 요청 본문은 id를 사용하여 최소 요구란을 포함합니다:
[
  {
    "station_id": 14,
    "subgroups": [
      {
        "observations": [
          {
            "observation": 3.5,
            "measure_id": 7
          }
        ]
      }
    ]
  }
]
다음 요청 본문은 외부 ID를 사용하는 최소 요구 필드를 포함합니다:
[
  {
    "external_station_id": "Ribbon Manufacturing Station",
    "subgroups": [
      {
        "observations": [
          {
            "observation": 3.5,
            "external_measure_id": "Roll Width"
          }
        ]
      }
    ]
  }
]
다음 요청 본문에는 외부 ID를 사용하는 모든 가능한 필드가 포함되어 있습니다:
[
  {
    "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" 
              }
            ]
          }
        ]
      }
    ]
  }
]

요청 결과

데이터 스트리밍의 경우, Real-Time SPC 성공 및 실패한 레코드 수를 반환합니다.
{
  "success_count": 40,
  "failure_count": 2        
}

검증 스키마

시간을 절약하고 오류를 줄이기 위해, 외부 검증기와 함께 다음 JSON 스키마를 사용하여 스테이션 엔드포인트로 데이터를 스트리밍하는 요청을 검증하세요.
{
  "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"]
    }
  }
}