Use REST API with Postman
Postman is an API platform that makes it easier to explore, test and consume APIs. In this guide we will see how to use Postman as the API client to work with Metadata Service REST API.
Importing the API definition
To use Metadata REST API with Postman, the first thing you would need is to import the API definition. You can
first download it from Swagger UI by
clicking on the metadata/v1/api.yml
link that appears just below the header.
Once you have downloaded the definition, follow these steps to import it into Postman.
- Select Import in the sidebar
- Select the Metadata REST API definition file you have just downloaded
- Select to import the definition as a Postman Collection and select Import
- An Import Complete message will display in the footer. In the message, select the link icon to open the imported collection
Configuring authentication
This section assumes that you already have an account with access to Application Collection.
TIP: If you configure authentication per-collection and let the individual requests inherit the configuration, you will avoid having to manually configure it for each request.
Basic authentication
You can configure your Metadata Service collection to use tokens and send them through Basic
authentication. This
section assumes you already have a valid access token. If this is not the case, you can check how to get one
here.
Once you have a valid access token, follow these steps:
- Go to the Authorization tab of your collection and select Basic Auth from the Type drop-down list
- Input your user email in the Username box
- Input your access token in the Password box
Make sure you save ctrl+s
to store the configuration. Postman will include in your requests an
Authorization header with a Base64 encoded string representing your username and password values, appended to the
text Basic
.
Sending an API request
Once you have imported the Metadata REST API definition as a collection, you will find all the requests you can do with it, organized in folders.
Sending a request is as easy as clicking on the Send button that you will find on the top right corner of the request. If your request needs to input any param or request body, you can do it in the corresponding tabs.
Postman will display the response data sent from the server in the lower pane.