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.

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

The collection includes a Postman environment called Datadog Authentication where you can add your Datadog API and application keys for authentication.

Datadog Authentication collection with API and Application Key fields completed

Follow these steps to set up your environment:

  1. Click the Environments dropdown in the upper right corner of Postman. If you don’t currently have an environment selected, the Environments dropdown says No Environment.

  2. Select Datadog Authentication.

  3. Edit the Datadog Authentication environment to add in your Datadog API key as the initial value and current value for the api_key variable, and add your Datadog application key as the initial value and current value for the application_key variable.

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.