API Postman Guidelines

Postman significantly enhances the ability to test and understand Merchant APIs by providing a user-friendly interface to construct, send, and analyze HTTP requests. You can easily craft and modify various API calls (GET, POST, PUT, DELETE) to different endpoints, adjusting parameters, headers, and request bodies to simulate real-world scenarios.

The tool's clear presentation of responses, including status codes, headers, and payloads, allows for quick verification of API behavior and aids in debugging issues. This structured approach accelerates the development lifecycle, improves API quality, and deepens the understanding of the Merchant API's capabilities and intricacies.

Overview

In order to use the MAPI Postman collection on your Postman instance, you need to follow a few steps to configure the environment first. Here is the step by step guidance on how to do that.

For more information on the platform see the Postman description.

1. Service Account configuration

You will get the serviceAccountKey and the api_key

  1. For detailed steps follow how to use a service account to access API
  2. In your Google Cloud Project > Credentials > Create credentials > Service account
  3. Fill the form and click Create and continue
  4. Select role Owner and click Continue
  5. Click Done
  6. To download the JSON key follow these steps:
    1. Click the just created Service account email (something like {YOUR_SERVICE_ACCOUNT}@{RANDOM_DOMAIN}.gserviceaccount.com)
    2. Click Keys tab
    3. Click Add key > Create key
    4. Select JSON and click Create to download the JSON

WARNING: You can download the key only once, if you lose it then you need to create a new key and delete this one

  1. Open Merchant center
  2. In Settings > Access and service click People and access
  3. Click Add person and use the service account ID as the email address for the new user.

2. Postman set up

  1. Download the Postman Environment template JSON
  2. Download the MAPI Postman collection JSON
  3. Sign in Postman or create a new account
  4. Import Postman Environment template
    1. Copy your full JSON into Environment > MyAccount > serviceAccountKey
    2. Copy your private_key from the JSON into collection's Environment > MyAccount > api_key
  5. Import MAPI Postman Collection JSON
  6. Select the environment on the top right corner

3. Developer registration

Link your Merchant Center account to the Google Cloud project by registering as a developer. The users with the API developer role will receive API communications, including mandatory service announcements, developer surveys, and opportunities.

  1. Open Postman > Collections > Merchant API Official
  2. Open accounts_v1 > accounts > accounts.developerRegistration > registerGcp
  3. Replace the {account} placeholder in the path with your MC ID
  4. Replace the {email} placeholder in the body with your email address
  5. Click Send to execute the registration
  6. If everything has been done correctly you will receive a confirmation JSON response like this: json { "name": "accounts/{YOUR_MC_ID}/developerRegistration", "gcpIds": [ "{YOUR_GCP_ID}" ] }

4. Test Merchant API on Postman

  1. Open Postman > Collections > Merchant API Official > accounts_v1 > accounts > list
  2. Click Send
  3. If everything has been done correctly you will receive a confirmation JSON response like this: json { "accounts": [ { "name": "accounts/{YOUR_MC_ID}", "accountId": "{YOUR_MC_ID}", "accountName": "{YOUR_MERCHANT_NAME}", "adultContent": false, "timeZone": { "id": "{YOUR_TIMEZONE}" }, "languageCode": "en-US" } ] }