PDQ Connect API

PDQ Connect provides an HTTP based, REST-style API that enables admins to securely integrate with their own scripts, integrations, and other tools. The API allows admins to read and search for device details, such as which software packages and versions and updates are installed, network and disk information, and more. The API can also be used to deploy software to devices using simple HTTP requests.

More detailed API usage documentation is available at https://app.pdq.com/v1/docs

Authentication

Before you can use the API, you will need to set up authentication using Connect’s secure, token-based authentication system.

 

PDQ Connect only accepts encrypted HTTPS requests.

First, generate a new API key using the new “API key management” page in Connect’s settings page located in the lower left-hand corner of the console. 1.png

 

Then, in the “API keys” page, click on the “Create API key” button.

Give your API key a descriptive name that helps you remember what you are using it for. This helps if you create more than one. Then press the “Create” button to generate the key.

2.png

 

After you press the “Create” button, you will be given an opportunity to copy the API key to your computer’s clipboard. Press the copy button to the right of the hidden API key to copy it.

 

Make sure to save the API key somewhere safe, as this is the only chance you have to see the API key. If you lose it, you will have to make a new one.

3.png

 

Request Header Authentication

To use the new API key you generated, you will need to include it in an HTTP header to the Connect API endpoint. It must be included in each request.

Invoke-RestMethod -Uri http://app.pdq.com/v1/api/devices -Headers @{'Authorization' = 'Bearer API_KEY_HERE'}

You can now use the API key to interact with the Connect API. If you ever stop using an API key or if you have reason to believe your key has been viewed by someone who shouldn’t have API access, remember to revoke the API key as soon as possible. You can revoke a key by pressing the “Revoke” button and following the prompts.

4.png

Examples using PowerShell

Get Devices

#Get Devices
$ConnectApiBaseUrl = "https://app.pdq.com/v1/api"
$ConnectApiToken = "YOUR CONNECT API TOKEN"
$headers = @{'authorization' = "Bearer $ConnectApiToken" }

Invoke-RestMethod -Headers $headers -Uri "$ConnectApiBaseUrl/devices"

Get groups

#Get groups
$ConnectApiBaseUrl = "https://app.pdq.com/v1/api"
$ConnectApiToken = "YOUR CONNECT API TOKEN"
$headers = @{'authorization' = "Bearer $ConnectApiToken" }

Invoke-RestMethod -Headers $headers -Uri "$ConnectApiBaseUrl/groups"

Get devices in group

#Get devices in group
$ConnectApiBaseUrl = "https://app.pdq.com/v1/api"
$ConnectApiToken = "YOUR CONNECT API TOKEN"
$headers = @{'authorization' = "Bearer $ConnectApiToken" }

Invoke-RestMethod -Headers $headers -Uri "$ConnectApiBaseUrl/devices?group=[groupId]"

Get packages by name contains

#Get packages by name contains
$ConnectApiBaseUrl = "https://app.pdq.com/v1/api"
$ConnectApiToken = "YOUR CONNECT API TOKEN"
$headers = @{'authorization' = "Bearer $ConnectApiToken" }

Invoke-RestMethod -Headers $headers -Uri "$ConnectApiBaseUrl/packages?filter[name]=~windows"

Get package versions

#Get package versions
$ConnectApiBaseUrl = "https://app.pdq.com/v1/api"
$ConnectApiToken = "YOUR CONNECT API TOKEN"
$headers = @{'authorization' = "Bearer $ConnectApiToken" }

Invoke-RestMethod -Headers $headers -Uri "$ConnectApiBaseUrl/packages/[packageId]"

Start a deployment

#Start a deployment
$ConnectApiBaseUrl = "https://app.pdq.com/v1/api"
$ConnectApiToken = "YOUR CONNECT API TOKEN"
$headers = @{'authorization' = "Bearer $ConnectApiToken" }

Invoke-RestMethod -Headers $headers -Method Post -Uri "$ConnectApiBaseUrl/deployments?package=[packageId, or packageVersionId]&targets=[deviceId or groupId]"

 

Still have a question or want to share what you have learned? Visit our Community Discord to get help and collaborate with others.