Scheda dell'endpoint

POST /1.0/shipments/green-index

Carrier-neutral shipment Green Index

Shipments Sustainability POST

Endpoint

Scegli l'ambiente e l'indirizzo cambia con lui.

http://173.249.30.252/spedireweb/api/1.0/shipments/green-index

Richiesta

Quelli segnati come necessari non si possono omettere.

3
Nome Dove Tipo Serve Descrizione
Authorization header string Sì Bearer access token. Example: Bearer <TOKEN>.
Accept header string Sì Expected response format.
Content-Type header string No Request body format when a JSON body is sent.
Authorization Serve
header string

Bearer access token. Example: Bearer <TOKEN>.

Accept Serve
header string

Expected response format.

Content-Type
header string

Request body format when a JSON body is sent.

Esempio richiesta

Metti il tuo token dove c'è scritto TOKEN.

cURL
curl -X POST "http://173.249.30.252/spedireweb/api/1.0/shipments/green-index" \
     -H "Authorization: Bearer <TOKEN>" \
     -H "Accept: application/json" \
     -H "Content-Type: application/json" \
     -d '{\"carrier\":\"poste_italiane\",\"context\":{\"scope\":1,\"environment\":1,\"courier_service_id\":1},\"filters\":{\"date_to\":\"2026-09-22\",\"products\":[\"PDB Standard\",\"PDB Express\"],\"date_from\":\"2026-09-01\",\"cost_centers\":[\"CDC-00073352\"],\"delivery_type\":[\"TUTTE\"],\"acceptance_type\":[\"TUTTE\"]}}'

Corpo richiesta

{
    "carrier": "poste_italiane",
    "context": {
        "scope": 1,
        "environment": 1,
        "courier_service_id": 1
    },
    "filters": {
        "date_to": "2026-09-22",
        "products": [
            "PDB Standard",
            "PDB Express"
        ],
        "date_from": "2026-09-01",
        "cost_centers": [
            "CDC-00073352"
        ],
        "delivery_type": [
            "TUTTE"
        ],
        "acceptance_type": [
            "TUTTE"
        ]
    }
}

Risposta

Un blocco per ogni risposta che l'endpoint può dare.

9

{
    "kind": "green_index",
    "trend": [
        {
            "year": 2026,
            "year_over_year": -2.5,
            "annual_emissions": 120
        }
    ],
    "phases": [
        {
            "phase": "Trasporto",
            "shipments": 10,
            "total_ghg_emissions": 8.4
        }
    ],
    "date_to": "2026-09-22",
    "filters": {
        "products": [
            "PDB Standard"
        ],
        "cost_centers": [
            "CDC-00073352"
        ],
        "delivery_type": [
            "TUTTE"
        ],
        "acceptance_type": [
            "TUTTE"
        ]
    },
    "metrics": {
        "total_km": 300,
        "total_emissions": 12.5,
        "shipments_entrusted": 12,
        "shipments_calculated": 10,
        "low_emission_vehicle_percentage": 25
    },
    "success": true,
    "provider": "poste_pdb",
    "date_from": "2026-09-01",
    "request_id": "REQ-1",
    "updated_at": "2026-09-22T12:00:00.000",
    "customer_code": "CLIENT-1"
}

{
    "error": {
        "code": "REQUEST_1001",
        "message": "Invalid request."
    },
    "success": false,
    "request_id": "req_01k5example000000000000000"
}

{
    "error": {
        "code": "AUTH_1001",
        "message": "Authentication required."
    },
    "success": false,
    "request_id": "req_01k5example000000000000000"
}

{
    "error": {
        "code": "AUTH_1003",
        "message": "Permission denied."
    },
    "success": false,
    "request_id": "req_01k5example000000000000000"
}

{
    "error": {
        "code": "APP_1004",
        "message": "Resource not found."
    },
    "success": false,
    "request_id": "req_01k5example000000000000000"
}

{
    "error": {
        "code": "VALIDATION_1001",
        "message": "Validation failed."
    },
    "success": false,
    "request_id": "req_01k5example000000000000000"
}

{
    "error": {
        "code": "RATE_LIMIT_1001",
        "message": "Too many requests."
    },
    "success": false,
    "request_id": "req_01k5example000000000000000"
}

{
    "error": {
        "code": "SERVER_1001",
        "message": "Internal server error."
    },
    "success": false,
    "request_id": "req_01k5example000000000000000"
}

{
    "error": {
        "code": "SERVER_1001",
        "message": "The selected carrier does not implement Green Index."
    },
    "success": false,
    "request_id": "req_01k5example000000000000000"
}

Da sapere

Returns normalized sustainability/emissions metrics through the selected carrier adapter. Requires analytics.read. When shipment_id or order_token is used, the shipment must belong to the authenticated API-key owner. The provider can also be selected explicitly with carrier/courier_id or inferred from context.courier_service_id. Requires a Bearer access token.