Create a Shipment Report
In this tutorial we continue with the topic of shipments and shipment plans
Prerequisites
Log in user
Create a shipment report
The shipment report can be created in multiple ways. Below the six different ways are demonstrated.
Create shipment report for all shipments of all shipment plans
curl -X POST \
'https://tracking.api.here.com/shipments/v4/plans' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}' \
-d '{}'
{
"shipmentReportId": "SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e"
}
Create shipment report for some shipments of all shipment plans
curl -X POST \
'https://tracking.api.here.com/shipments/v4/plans' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}' \
-d '{
"startedAfter": "2021-11-15T15:00:00Z",
"endedBefore": "2021-11-20T15:00:00Z"
}'
{
"shipmentReportId": "SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e"
}
Create shipment report for all shipments of some shipment plans
curl -X POST \
'https://tracking.api.here.com/shipments/v4/plans' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}' \
-d '{
"shipmentPlanIds": ["SHPP-cf12dde9-2424-469b-8486-e529fb923c6e", "SHPP-338971b5-9ac1-4e8d-aa5d-0f4567c59172"]
}'
{
"shipmentReportId": "SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e"
}
Create shipment report for some shipments of some shipment plans
curl -X POST \
'https://tracking.api.here.com/shipments/v4/plans' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}' \
-d '{
"shipmentPlanIds": ["SHPP-cf12dde9-2424-469b-8486-e529fb923c6e", "SHPP-338971b5-9ac1-4e8d-aa5d-0f4567c59172"],
"endedAfter": "2021-11-15T15:00:00Z",
"endedBefore": "2021-11-20T15:00:00Z",
}'
{
"shipmentReportId": "SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e"
}
Create shipment report for all shipments of a shipment plan
curl -X POST \
'https://tracking.api.here.com/shipments/v4/plans' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}' \
-d '{
"shipmentPlanIds": ["SHPP-cf12dde9-2424-469b-8486-e529fb923c6e"],
}'
{
"shipmentReportId": "SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e"
}
Create shipment report for some shipments of a shipment plan
curl -X POST \
'https://tracking.api.here.com/shipments/v4/plans' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}' \
-d '{
"shipmentPlanIds": ["SHPP-cf12dde9-2424-469b-8486-e529fb923c6e"],
"endedAfter": "2021-11-15T15:00:00Z",
"endedBefore": "2021-11-20T15:00:00Z",
}'
{
"shipmentReportId": "SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e"
}
Get shipment report status
Check shipment report generation status.
curl -X GET \
'https://tracking.api.here.com/shipment-reports/v4/SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e/status' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}'
{
"status": "completed"
}
Get shipment report summary
curl -X GET \
'https://tracking.api.here.com/shipment-reports/v4/SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e/summary' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}'
{
"createdAt": "2021-11-25T15:00.570Z",
"totalShipmentPlanCount": 1,
"totalShipmentsCount": 4,
"totalSegmentPlanCount": 3,
"totalSegmentsCount": 12,
"totalLocationCount": 1,
"completedAt": "2021-11-25T15:00.641Z"
}
Get shipment report metrics
In this example one gets locationDwelling
metric from the shipment report SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e
.
curl -X GET \
'https://tracking.api.here.com/shipment-reports/v4/SHPR-ca523d97-8a00-412b-9b1a-585ee81f706e/locationDwelling' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {userToken}'
{
"limit": 100,
"count": 4,
"items": [
{
"ids": {
"shipmentPlanId": "SHPP-cf12dde9-2424-469b-8486-e529fb923c6e",
"segmentPlanId": "SEGP-ff484a70-24f8-4cc6-862b-75f378be2324",
"shipmentId": "SHP-a93996b6-7efb-43e5-8670-ec254574f4fd",
"segmentId": "SEG-91f6583a-af0d-4fce-a48d-96bf0d350d8f",
"locationId": "LOC-e3053264-040f-4871-b238-b0e3f99bfdcd"
},
"statistics": {
"val": 12.004
}
},
{
"ids": {
"shipmentPlanId": "SHPP-cf12dde9-2424-469b-8486-e529fb923c6e",
"segmentPlanId": "SEGP-ff484a70-24f8-4cc6-862b-75f378be2324",
"shipmentId": "SHP-cc8d9c78-8921-4146-9a40-1509bb25ec1d",
"segmentId": "SEG-36f407e1-45fd-4d44-848f-945c8a845f5b",
"locationId": "LOC-e3053264-040f-4871-b238-b0e3f99bfdcd"
},
"statistics": {
"val": 12.557
}
},
{
"ids": {
"shipmentPlanId": "SHPP-cf12dde9-2424-469b-8486-e529fb923c6e",
"segmentPlanId": "SEGP-ff484a70-24f8-4cc6-862b-75f378be2324",
"shipmentId": "SHP-8e6a244b-9611-43fc-87da-0ec448c9f0fa",
"segmentId": "SEG-afa99587-c887-4b57-9bef-0737844a8efb",
"locationId": "LOC-e3053264-040f-4871-b238-b0e3f99bfdcd"
},
"statistics": {
"val": 12.952
}
},
{
"ids": {
"shipmentPlanId": "SHPP-cf12dde9-2424-469b-8486-e529fb923c6e",
"segmentPlanId": "SEGP-ff484a70-24f8-4cc6-862b-75f378be2324",
"shipmentId": "SHP-7386ffd1-5a2a-4acc-bd86-7c277f36a122",
"segmentId": "SEG-1f065644-d4bb-4b97-bc47-aed0e4c7d3b6",
"locationId": "LOC-e3053264-040f-4871-b238-b0e3f99bfdcd"
},
"statistics": {
"val": 14.024
}
}
],
"total": 4
}