0% found this document useful (0 votes)
3 views

API_Masterclass_Activity_Guide

The document is an activity guide for an API Masterclass provided by PagerDuty University, detailing how to set up a developer account, generate API keys, and utilize the PagerDuty API using tools like Postman. It includes instructions for creating user requests, handling pagination, and testing API calls with error handling exercises. Additionally, it provides links to the API reference and sample data for practical application.

Uploaded by

asif ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

API_Masterclass_Activity_Guide

The document is an activity guide for an API Masterclass provided by PagerDuty University, detailing how to set up a developer account, generate API keys, and utilize the PagerDuty API using tools like Postman. It includes instructions for creating user requests, handling pagination, and testing API calls with error handling exercises. Additionally, it provides links to the API reference and sample data for practical application.

Uploaded by

asif ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

API Masterclass:

Activity Guide
PagerDuty University
https://developer.pagerduty.com/

Proprietary & Confidential


Developer Account

Proprietary & Confidential


Developer Account: Generate API Key

Proprietary & Confidential


Developer Account: Generate API Key

Proprietary & Confidential


Developer Account: Generate API Key

Proprietary & Confidential


Developer Account: Generate API Key

Proprietary & Confidential


The API Reference
https://developer.pagerduty.com/api-reference/

● The complete resource for


public REST API

● Details on all required and


optional fields for each
endpoint request schema

● Details on the contents of


each response

Proprietary & Confidential


API Docs : Users : Create User Deep Dive

Proprietary & Confidential


API Docs : Users : Create User Deep Dive

Proprietary & Confidential


API Docs : Users : Create User Deep Dive

Proprietary & Confidential


API Docs : Users : Create User Deep Dive

Hover over to see


available options

Proprietary & Confidential


Basic Workflow using the API Reference
● Click on “Try It”
● Set the required and
optional headers
● Click on Body

Proprietary & Confidential


Basic Workflow using the API Reference
● Create the desired
request body
● Use API Reference as a
guide to use required
and optional fields as
needed

Proprietary & Confidential


Code Generators!

Proprietary & Confidential


PagerDuty API: Extra Credit Activity

Proprietary & Confidential


Postman Setup for PagerDuty API
Visit Postman (https://www.postman.com/downloads/) and install.

Proprietary & Confidential


Postman Setup for PagerDuty API
Visit Postman (https://www.postman.com/downloads/) and install.

Proprietary & Confidential


Import PagerDuty API Postman Collection
Visit PagerDuty’s API Reference (https://developer.pagerduty.com/api-reference) and click on “Run in Postman”

Proprietary & Confidential


Setup PagerDuty Postman Collection

Proprietary & Confidential


Using Postman
In the PagerDuty Postman Collection, open the ‘Users’ endpoint folder. Double click on the ‘List Users’
request to open.

Proprietary & Confidential


Setup the Postman Request

Proprietary & Confidential


Setup the Postman Request
● Under the request’s ‘Headers’ section, add the following configurations to set the ‘Authorization’
header to use the desired API Tokens.
● Press ‘Save’. Multiple values can be entered and toggled on/off for specific use.

Proprietary & Confidential


Setup the Postman Request
● Under the request’s ‘Params’ section, add the ‘total’, ‘limit’ and ‘offset’ params.
● These will be required for API requests to endpoints that support pagination and 100’s-1000’s of
results may exist.
● Save the request.

Uncheck
these!

Proprietary & Confidential


Setup the Postman Request
● Under the request’s ‘Params’ section, add the ‘total’, ‘limit’ and ‘offset’ params.
● These will be required for API requests to endpoints that support pagination and 100’s-1000’s of
results may exist.
● Save the request.

Proprietary & Confidential


Run the Request
● Toggle on/off or set ‘params’ based on your API request requirements.
● Press ‘Send’ to execute the API query.
● In this example, the first 25 users are retrieved and displayed in the response body.
● Scrolling to the bottom of the response body shows ‘more’ is true indicating there are more users
available.

Proprietary & Confidential


Get Test Data
https://pagerduty-samples.github.io/pdu-api-workshop/

Proprietary & Confidential


Get Test Data
https://pagerduty-samples.github.io/pdu-api-workshop/

Proprietary & Confidential


GET Teams : Pagination Activity

Proprietary & Confidential


GET Teams : Pagination Activity

Proprietary & Confidential


GET Teams : Pagination Activity

Proprietary & Confidential


GET Teams : Pagination Activity

Proprietary & Confidential


GET Teams : Pagination Activity

Proprietary & Confidential


PagerDuty Events API: Activity

Proprietary & Confidential


PagerDuty Events API: Activity

Proprietary & Confidential


PagerDuty Events API: Activity
Add Folder

Name Folder

Proprietary & Confidential


PagerDuty Events API: Activity
Add Request Name Request

Proprietary & Confidential


PagerDuty Events API: Activity
Setup Request

Proprietary & Confidential


PagerDuty Events API: Activity
Build Request

Proprietary & Confidential


PagerDuty Events API: Activity
Response

Proprietary & Confidential


PagerDuty Events API: Activity

Proprietary & Confidential


PagerDuty Events API: Activity

dedup_key
identifies
incident to be
acknowledged

Proprietary & Confidential


PagerDuty Events API: Activity

HTTP Response Code

Proprietary & Confidential


API Errors Activity
Take one of the API call you made in POSTMAN today and purposefully mess it up by doing one (or
more) of the following.

● Remove your API Key from the Authorization header


● Change the endpoint to something incorrect like “/team” instead of “/teams”
● Mess up the body of the Event request we just made

Look at the response you receive and answer these questions:


● Which HTTP response code was given?
● Which error code?
● What was the error message?
● How would you handle this type of response in your code?

Proprietary & Confidential


terraform init

Proprietary & Confidential


terraform plan

Proprietary & Confidential


Proprietary & Confidential
terraform apply

Proprietary & Confidential


Proprietary & Confidential

You might also like