It is possible to generate a signed tracking URL using the CustomizationAPI. This feature is useful if you want a safer link to the tracking page. Typically, a tracking URL contains the order number or barcode, but with a signed URL, this information is encrypted.
Follow these steps to create a signed tracking URL:
1. Create Client ID and Secret
Start by creating ClientID and ClientSecret:
- In nShift Portal, go to Settings > API Configuration > Clients.
- Create a new Client and choose the scope Public Customization API for customers.
-
Save and remember to note the Client Secret.
For more information on generating the ClientID and ClientSecret, click here.
2. Authenticate
The API supports Bearer Authentication. Use the ClientID and Client Secret to get the token.
Example of how to request a token
curl -X POST "https://account.nshiftportal.com/idp/connect/token"
--header "Content-Type: application/x-www-form-urlencoded"
--data-urlencode "grant_type=client_credentials"
--data-urlencode "client_id={{CLIENT_ID}}"
--data-urlencode "client_secret={{CLIENT_SECRET}}"
Response
{
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjI3QjA1ODk4Nzc1OEUwMkMI1NiIsInR2...",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "public_api_shipmentserver"
}
The Token is valid for 60 minutes before it expires and you have to re-authenticate
Note: If you get the following error, check where your credentials were made. If you have credentials from www.consignorportal.com you need to create new ones on www.nshiftportal.com
All requests must have the token in the Authorization header
curl --location "https://api.nshiftportal.com/track/customization/PublicTrackProfile/signedProfile" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer eyJhbGciO..." \
--data "{{PAYLOAD}}"
3. Create the signed Tracking URL
Use the access token for making the request.
See the documentation on our Swagger page here:
https://api.nshiftportal.com/track/swagger/index.html?urls.primaryName=CustomizationApi
Example request
{
"profileUuid": "50fc034f-3b4b-472a-ka43-a49d3ab7edff",
"query": "70730253110028750",
"expirationDate": "2024-03-10T08:07:47.305Z"
}
Example response
{
"url": "https://www.nshiftportal.com/ui/track/?sid=_oOVP-V4pE-v8kfm4k_rKg"
}
POST PublicTrackProfile is used to create a signed URL to nShift Track's branded tracking page. Read more here: Setting up a branded tracking page. This article also has information about creating a public profile.
The ProfileUuid needed for PublicTrackProfile is located under Settings > Track > Track Public Profile:
POST PublicProfile is used to create a signed URL to Shipment Viewer. Read more here: Creating Shipment Viewer Profiles and public tracking URLs. This article also has information about creating a public profile.
The ProfileUuid needed for PublicProfile is located under Settings >Customizations > Public T&T URL:
Query: shipment number
expirationDate: specify when the URL should expire