Use Postman with the Shipium API
Use the Postman app to test Shipium API requests with both API key and OAuth 2.0 authentication.
About using Postman with Shipium APIs
Postman is a popular API testing tool that makes it easy to test and develop API integrations. This guide walks you through configuring Postman to work with the Shipium API using both authentication methods:
- API key authentication. Uses Postman's Basic Auth helper
- OAuth 2.0 authentication. Uses Postman's OAuth 2.0 helper with automatic token management
Postman handles credential encoding automatically, so you don't need to manually base64-encode your credentials.
Prerequisites
- You must already have created either an API key or OAuth 2.0 credentials. You can find instructions for doing so in Create API Credentials.
- You must have installed Postman.
- You should have your API key or OAuth credentials ready.
Set up your Postman environment
What is an environment in Postman?An environment is a set of variables you can use in your Postman requests. Using environments makes it easy to switch between different API credentials or environments (test vs. production).
For more information, see Managing Environments in the Postman user guide.
Create a new environment
To create a new environment in the Postman application:
- Click Environments on the left sidebar.
- Click the + plus button to create a new environment.
- Enter a name for your environment (e.g., "Shipium Production" or "Shipium Test").
- Add variables based on your authentication method (see sections below).
- Click Save.
Variables for API key authentication
If you're using API key authentication, create these variables:
| Variable name | Initial value | Description |
|---|---|---|
API_KEY | Your API key from Shipium Console | The API key secret value |
RESOURCE_SERVER | <<api_url>> | The Shipium API base URL |
Variables for OAuth 2.0 authentication
If you're using OAuth 2.0 authentication, create these variables:
| Variable name | Initial value | Description |
|---|---|---|
CLIENT_ID | Your OAuth Client ID | From Shipium Console |
CLIENT_SECRET | Your OAuth Client Secret | From Shipium Console |
TOKEN_URL | <https://auth.shipium.com/oauth/token> | OAuth token endpoint |
RESOURCE_SERVER | <<api_url>> | The Shipium API base URL |
Postman data entry requirementPostman requires you to enter initial and current values for environment variables. By default, Postman will automatically copy the initial value into the current value field.
API key authentication in Postman
Postman's Basic Auth helper makes API key authentication simple by automatically handling the base64 encoding for you.
Configure Basic Auth for API keys
- Create a new request or select an existing one.
- Click the Authorization tab.
- From the Type dropdown, select Basic Auth.
- Enter the following:
- Username:
{{API_KEY}} - Password: Leave this field blank.
- Username:
- Postman will automatically encode your credentials and add the correct
Authorization: Basicheader.
Test with the ping API
You can verify your setup by calling the ping API:
- Create a new request in Postman.
- Set the request method to GET.
- Enter the URL:
{{RESOURCE_SERVER}}/api/v1/deliveryexperience/ping - Configure Basic Auth as described above.
- Select your environment from the environment dropdown (top right corner).
- Click Send.
The ping API should respond with JSON that resembles this:
{
"info": "pong",
"status": 1
}
Use this pattern for all API callsOnce you've configured authorization, you can use this same setup for all Shipium API endpoints. Simply change the URL and request method as needed for different API calls.
OAuth 2.0 authentication in Postman
Postman's OAuth 2.0 helper automates the token retrieval process and can even refresh tokens automatically when they expire.
Configure OAuth 2.0
- Create a new request or select an existing one.
- Click the Authorization tab.
- From the Type dropdown, select OAuth 2.0.
- On the right side, under Configure New Token, enter the following:
- Token Name:
Shipium OAuth Token(or any descriptive name) - Grant Type: Select Client Credentials.
- Access Token URL:
{{TOKEN_URL}} - Client ID:
{{CLIENT_ID}} - Client Secret:
{{CLIENT_SECRET}} - Client Authentication: Select Send as Basic Auth header.
- Token Name:
Get your access token
- Click the Get New Access Token button at the bottom of the configuration section.
- Postman will make a request to Shipium's OAuth server and retrieve an access token.
- A dialog will appear showing your new token details.
- Click Use Token to apply it to your request.
Postman will automatically add the token to your request's Authorization: Bearer header.
Test with the ping API
- vWith your token configured, enter the URL:
{{RESOURCE_SERVER}}/api/v1/deliveryexperience/ping - Set the request method to GET.
- Select your environment from the environment dropdown.
- Click Send.
The ping API should respond with:
{
"info": "pong",
"status": 1
}Manage token expiration
OAuth 2.0 access tokens expire after a certain time (shown in the expires_in field of the token response). When your token expires:
- Go back to the Authorization tab.
- Click Get New Access Token again.
- Click Use Token to apply the new token.
Automatic token refreshSome versions of Postman can automatically refresh expired tokens. Check your Postman version's documentation for this feature.
Troubleshooting
Common mistakes
❌ Using OAuth 2.0 type for API keys If you're using an API key, select Basic Auth as the authorization type, not OAuth 2.0. The OAuth 2.0 type is only for OAuth 2.0 credentials.
❌ Forgetting to select your environment Make sure you've selected the correct environment from the dropdown in the top right corner of Postman. Your variables won't populate if no environment is selected.
❌ Including password with API Key When using Basic Auth with an API key, leave the password field blank. Only enter your API key in the username field.
Token errors
If you receive an invalid_token error when using OAuth 2.0:
- Verify that your Client ID and Client Secret are correct in your environment variables.
- Check that you've clicked "Use Token" after retrieving a new token.
- Ensure the token hasn't expired. Generate a new token if needed.
More information on the API responsesAs with all Shipium API responses, this API follows the API Response Codes standards unless otherwise specified.
Resources
Your Shipium team member is available to help along the way. However, you might find these resources helpful:
Updated 1 day ago
