出荷計画の作成

このチュートリアルでは 、「出荷の作成 」と同じトピックを使用して作業を続行します。また、タンペレピルカ空港からヘルシンキ空港を経由してベルリンブランデンブルク空港まで飛行機で向かう同じルートの出荷計画を作成します。

前提条件

ユーザーにログイン

ユーザーにログインこれにより、ユーザーアクセス トークンuserTokenが返されます。 後続のリクエストに必要です。

出荷計画の作成

curl -X POST \
    'https://tracking.api.here.com/shipments/v4/plans' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {userToken}' \
    -d '{
        "name":"From Tampere-Pirkkala to Berlin Brandenburg",
        "description":"A shipment from the Tampere-Pirkkala airport to the Berlin Brandenburg airport",
        "autoStart":"true",
        "segments": [
            {
                "name":"From Tampere-Pirkkala to Helsinki",
                "description":"Origin of the shipment",
                "transportMode":"air",
                "origin":"LOC-f79d965d-9124-446d-b0b4-f71ae793f602",
                "destination"LOC-7e814132-2821-11ec-ba1d-00155ddd7ddb",
                "durationS":"3600"
            },
            {
                "name":"Dwelling at Helsinki",
                "description":"Waypoint of the shipment where shipment dwells",
                "transportMode":"undefined",
                "origin":"LOC-7e814132-2821-11ec-ba1d-00155ddd7ddb",
                "destination"LOC-7e814132-2821-11ec-ba1d-00155ddd7ddb",
                "durationS":"22500"
            },
            {
                "name":"From Helsinki to Brandenburg",
                "description":"Destination of the shipment",
                "transportMode":"air",
                "origin":"LOC-7e814132-2821-11ec-ba1d-00155ddd7ddb",
                "destination"LOC-878c8e9e-2821-11ec-8fc2-00155ddd7ddb",
                "durationS":"9000"
            }
        ]
    }'
{
  "shipmentPlanId": "SHPP-3de93876-2837-11ec-aecc-00155ddd7ddb"
}

出荷計画から出荷を作成

出荷計画はテンプレート として機能し、事前に入力された詳細情報で出荷を作成するために使用できます。

curl -X POST \
    'https://tracking.api.here.com/shipments/v4' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {userToken}' \
    -d '{
        "shipmentPlanId":"SHPP-3de93876-2837-11ec-aecc-00155ddd7ddb",
        "shipmentDeparture":"2021-10-01T06:30:00Z"
    }'
{
  "shipmentPlanId": "SHP-8bd8fbe6-2839-11ec-bc08-00155ddd7ddb"
}

セグメントにデバイスを割り当てます

この配送では、各セグメントで 1 つのデバイスが使用されます。

curl -X PATCH \
    'https://tracking.api.here.com/shipments/v4/SHP-8bd8fbe6-2839-11ec-bc08-00155ddd7ddb' \
    -H 'Content-Type: application/json' \
    -H 'Authorization: Bearer {userToken}' \
    -d '{
        "name":"From Tampere-Pirkkala to Berlin Brandenburg",
        "description":"A shipment from the Tampere-Pirkkala airport to the Berlin Brandenburg airport",
        "autoStart":"true",
        "segments": [
            {
                "transportMode":"air",
                "trackingId":"{trackingId}",
                "origin":"LOC-f79d965d-9124-446d-b0b4-f71ae793f602",
                "destination":"LOC-7e814132-2821-11ec-ba1d-00155ddd7ddb"
            },
            {
                "transportMode":"undefined",
                "trackingId":"{trackingId}",
                "origin":"LOC-7e814132-2821-11ec-ba1d-00155ddd7ddb",
                "destination":"LOC-7e814132-2821-11ec-ba1d-00155ddd7ddb"
            },
            {
                "transportMode":"air",
                "trackingId":"{trackingId}",
                "origin":"LOC-7e814132-2821-11ec-ba1d-00155ddd7ddb",
                "destination":"LOC-878c8e9e-2821-11ec-8fc2-00155ddd7ddb"
            }
        ]
    }'

これにより、デバイスがセグメントに割り当てられ、成功した場合はステータスコード 204 の空の応答が返されます。

」に一致する結果は 件です

    」に一致する結果はありません