データストリーミングのためのステーションエンドポイント

APIステーションエンドポイントを使って、プロセスおよび出力測定のための観測データを直接ステーションデータテーブルにストリーミングできます。

エンドポイント構成

このルートはデータストリーミングのためにステーションのリソースに接続します。

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

リクエストボディは以下の性質を受け入れます:
  • APIKEY – 認証と認可のためのAPIキー
  • アクション – 「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"]
    }
  }
}