ShipEngine / shipengine-php

The official PHP SDK for ShipEngine API
https://www.shipengine.com/docs/
Apache License 2.0
15 stars 11 forks source link

how can i create a tracking page? #32

Closed harryp-art closed 3 years ago

harryp-art commented 3 years ago

Describe the bug

I want to create brand tracking page in development, my api-key is TEST..........z and this is my code:

let data = {
    "tracking_pages": [
      {
        "tracking_number": "890...",
        "carrier_code": "ups",
        "service_code": "ups",
      }
    ]

  };
      var options = {
        method: 'POST',
        url: 'https://api.shipengine.com/v-beta/tracking_page',
        headers: {
          Host: 'api.shipengine.com',
          'API-Key': 'TEST_a1b1c1...z',
          'Content-Type': 'application/json',
        },
        body: JSON.stringify(data),
      }
      request(options, function (error, response) {
        if (error) throw new Error(error)
        console.log(response.body)
      })

but it returns this error

{ "request_id": "b3a5190c-1-4099-1-7151179be0d8", "errors": [ { "error_source": "shipengine", "error_type": "security", "error_code": "unauthorized", "message": "An API key is required. Please see https://www.shipengine.com/docs/auth" } ] }

AnneOReilly commented 3 years ago

Closing as duplicate