HomeDocumentationCode SamplesAnnouncementsModelsRelease NotesFAQGitHubVideos
Developer HubAPI StatusSupport
Documentation
Developer HubAPI StatusSupport

Using Postman for Selling Partner API Models

Using Postman for Selling Partner API models

This document explains how to set up and use Postman for Selling Partner API (SP-API) models. You can use Postman to generate Login with Amazon (LWA) access tokens, import SP-API models, make calls to SP-API endpoints, and make calls to SP-API sandbox endpoints.

Credentials required to make a call

Generate a Login with Amazon (LWA) access token using Postman

Login with Amazon (LWA) allows Amazon customers to log in to registered third-party websites or mobile apps ("clients") using their Amazon username and password. Clients can ask customers to share some personal information from their Amazon profile, including name, email address, and zip code. Before you can use Postman with SP-API models, you must first generate an access token to authenticate to SP-API.

  1. Open Postman and sign in to your account.

  2. For Workspaces, choose your workspace.

  3. Choose New.

  4. On the Create New dialog box, choose HTTP Request.

    The Create New Window, which shows the HTTP Request as the first item to choose from.

  5. For Request, choose POST.

    The Request dropdown menu with POST selected.

  6. Copy and paste the following link into the text box.

    https://api.amazon.com/auth/o2/token
    

    the link pasted into the request field.

  7. Choose the Authorization tab and for Type, choose No Auth.

    The Type dropdown menu with No Auth selected.

  8. Choose the Body tab, and select x-www-form-urlencoded.

    The Body tab selected and x-www-form-urlencoded selected.

  9. In the Body table, add the following key-value pairs:

    KeyValue
    grant_typerefresh_token
    refresh_token[your refresh token value]
    client_id[your client id value]
    client_secret[your client secret value]

    The key-value pairs from the table entered into the table on the Body tab.

  10. Choose Send.

The response returns the access token that you use to authenticate to SP-API.

"access_token": "Atza|*****",
  "refresh_token": "Atzr|*****"'
  "token_type": "bearer", 
  "expires_in": 3600

Import an SP-API model into Postman

Before you call an SP-API endpoint, you must import the SP-API model into Postman.

  1. Open the selling-partner-api-models folder on GitHub.

  2. In the list of folders, locate and select the API model that you want to download, then choose the JSON file.

  3. On the JSON file view, choose Raw to view the source code or select the download icon to download the raw file.

  4. Copy the model source code.

  5. Open a text editor (such as Notepad) and paste the model text. Then, save the file with a ".json" extension.

  6. Sign in to Postman.

  7. For Workspaces, choose your workspace.

  8. Choose Import, select your JSON file, and then choose Open.

  9. On the Import dialog box, select Postman Collection and choose Import.

    The Choose how to import your API pop-up page. The Postman Collection option is chosen and has a red box surrounding it. The Import button on the bottom right of the page is also surrounded by a red box.

A success message displays when the file is successfully imported.

A success message stating that 1 out of 1 element was imported and the name of the collection Selling Partner API for Sellers.

Call an SP-API endpoint

  1. Sign in to Postman.

  2. For Workspaces, choose your workspace.

  3. On the Collections tab, select the newly imported API and choose the GET operation.

  4. If you haven't already, Generate an LWA Access Token using Postman. You will need an LWA Access Token to generate a refresh token.

  5. On the Headers tab, add the following key-pair:

    | Key | Value |
    | x-amz-access-token | [your access token value] |

    The On the Headers tab, when the x-amz-access-token Key is highlighted and the Value is entered with sample text.

  6. Choose Send.

The response text populates in the Response window.

Call an SP-API sandbox endpoint

The process for making calls to Selling Partner API sandboxes is identical to making production calls, except you direct the calls to the Selling Partner API sandbox endpoints. The Selling Partner API provides two sandbox environments that allow you to test your applications without affecting production data or triggering real-world events.

The Selling Partner API static sandbox uses pattern matching to return static, mocked responses. The Selling Partner API dynamic sandbox routes requests to a sandbox backend that can return realistic responses based on the request parameters.

Refer to Selling Partner API sandbox for more information.

  1. Sign in to Postman.

  2. Import the Swagger model for the API you are using to your Postman workspace. For example, the Orders API Swagger Model.

  3. For Workspaces, choose your workspace.

  4. On the Collections tab, choose your collection and choose the GET operation. For example, if you want to test a GET Orders API call, select the get Orders API call.

  5. Set the {{baseUrl}} as Selling Partner API sandbox.

  6. On the Params tab, pass the static request values from the Swagger Model. For example, the Orders API.

    The Params tab, which has the CreatedAfter and Markdetplaceids Keys.

  7. When calling a sandbox endpoint, you'll need to check that your request includes all required parameters as defined in the corresponding Swagger model. Refer to the following example of an Order API v0 Swagger Model, where Get Order API call is highlighted with a successful response:

    The Get Order API call, which has a successful response.

  8. If you haven't already, Generate an LWA Access Token using Postman. You will need an LWA Access Token to generate for a refresh token.

  9. On the Headers tab, add the following key-pair:

    KeyValue
    x-amz-access-token[your access token value]

    The On the Headers tab, when the x-amz-access-token Key is highlighted and the Value is entered with sample text.

  10. Choose Send.

  11. Verify that the response returns a payload that matches the Swagger model.

    The response text populates in the Response window.

    The Sandbox response example, which shows the returned order information.