Using Postman with Datadog APIs

Overview

The Datadog API allows you to get data in and out of Datadog. It uses resource-oriented URLs and status codes to indicate the success or failure of requests, then returns JSON from all requests.

This article explains how to use Postman to perform API calls to Datadog by showing the actions available within the Datadog API, and by providing a high-level introduction to using Postman to GET, POST, PUT, and DELETE.

Prerequisites

You have:

Setup

Import the Datadog collection into Postman

Start by logging into Postman. Datadog recommends downloading the Postman application.



This collection works in Postman for Web or in your Postman application. It may take several seconds to load.

Note: Configure the collection variables of the Datadog API collection with your API and application key values.

Postman environment setup

After the Postman collection is imported, a full list of available Datadog API calls is structured by folder in the left pane of Postman.

Authentication

Add your Datadog API and application keys to the collection variables for authentication.

Follow these steps to set up your environment:

  1. Select the Datadog API Collection.

  2. Click the Variables tab.

  3. Add your valid Datadog API and application key values to the Current value field of the api_key and application_key variables, respectively.

  4. Click Save.

The Datadog API Collection with api_key and application_key collection variables configured

Switch the API endpoint

If you are accessing a Datadog site other than https://api.datadoghq.com, you need to switch the Postman collection to access a different endpoint URL.

Follow these steps to update the instance to your selected site ():

  1. In the Datadog API Collection folder on the left pane, click the three dot menu, and then select Edit.

    View more actions
  2. On the Variables tab, deselect the site variable with the value datadoghq.com and select the site with the value .

  3. Click Update.

Working with the collection

After setup is complete, you are ready to begin making API calls. In the Postman -> Datadog folder, there are subfolders for each type of API category listed in the Datadog API Reference. Expand the subfolders to see the HTTP methods and API call names.

Builder

When you click on an API call in the collection, it loads in the Builder pane on the right. On this pane you can send the API call and see the returned status, response time, and API response code.

postman_api_response

Description

When you click on the Endpoint name a description of the endpoint and all required/optional parameters is displayed to help you build your requests:

Params

The Params tab shows all parameters and values that are on the API call. Here, you are able to add parameters and values. View the available arguments in the corresponding section of the Datadog API documentation.

postman_param

This tab is an alternative to viewing the param1:value1&param2:value2 structure of the API call.

Notes:

  • The ampersand (&) and colon (:) are not needed in the params table. Postman inserts these for you.
  • All placeholders follow the format: <PLACEHOLDER> . They should be replaced before running a query.
PREVIEWING: may/unit-testing