USPS / api-examples

86 stars 19 forks source link

How to access the Tracking API? #28

Open jat255 opened 8 months ago

jat255 commented 8 months ago

I have created an app in the developer portal, and only see the following options for "selecting an API":

image

When I obtain an OAuth token from the v3 endpoint, I receive the following response:

{
  "access_token": "abcd1234",
  "token_type": "Bearer",
  "issued_at": 1711509594428,
  "expires_in": 28799,
  "status": "approved",
  "scope": "international-prices addresses service-standards prices",
  "issuer": "api.usps.com",
  "client_id": "abcd1234",
  "application_name": "MyApp",
  "api_products": "[Shipping Default]",
  "public_key": "abcd1234"
}

As shown, the tracking scope is not included in the response, and when I try to issue a GET request to https://api.usps.com/tracking/v3/tracking/{{tracking_number}}?expand=summary, I receive the following error response:

{
  "apiVersion": "/tracking/v3",
  "error": {
    "code": "401",
    "message": "",
    "errors": []
  }
}

Is there any way to access the tracking API to track packages via the API? I see the API documented here, but can't seem to access it.

Also, I have tried supplying "scope": "tracking" in my OAuth token POST request, but that doesn't seem to work and I receive the following token response (with an empty scope value):

{
  "access_token": "abcd1234",
  "token_type": "Bearer",
  "issued_at": 1711509594428,
  "expires_in": 28799,
  "status": "approved",
  "scope": "",
  "issuer": "api.usps.com",
  "client_id": "abcd1234",
  "application_name": "MyApp",
  "api_products": "[Shipping Default]",
  "public_key": "abcd1234"
}

Any help here would be great.

jat255 commented 8 months ago

@stevenfdearborn any ideas here? I noticed that when I create an app on developer-cat.usps.com, it gets given access to the "[Shipping Version 3]" API product, rather than the "[Shipping Default]" product that developer.usps.com assigns. Is there a reason this is different?

grakes87 commented 7 months ago

were you able to figure this out? I'm having the same issue.

jat255 commented 7 months ago

@grakes87 Nope. I emailed their support twice with no response, and nothing here either. Not sure what else I could do at this point

nandorholozsnyak commented 7 months ago

I'm in the same situation but with the Locations API. Support does not reply for any mails... :(

jat255 commented 7 months ago

Pinging @stevenfdearborn again. Is this API supported? It's difficult to build applications against it without any feedback/support.

verbunk commented 4 months ago

I'm in the same boat - in my case my App Product is "Public Access I" and gives by default,

"scope": "addresses international-prices service-standards prices shipments",

If I manually request "scope":"tracking" it comes back empty. There are no other App Products I can select using https://developer.usps.com login and app account management.

rileyzDakota commented 3 months ago

Has anyone solved this? I'm in the same boat as verbunk.

verbunk commented 3 months ago

Hey Everyone - The path forward is to create a business account and email their dev support team for access. You will be asked to fill out a google forms doc with extra information and then some QA on why you need this, also, inexplicably the google docs from will require 400% cpu for all ~6 pages. The scope is intentionally not provided in the default. I guess (hinting in email) they will add the scope AND some monitoring to prevent abuse of the endpoint.