Skip to main content
Version: 8.0.2

API Requests

As you (probably) know, with Pega Platform you can use API requests for many purposes: to create the case, get case info, perform an action, etc.

And it`s really a good idea to use them in the test automation! Test Maker provides methods for all the types of API requests:

  • sendGetRequest
  • sendDeleteRequest
  • sendHeadRequest
  • sendPostRequest
  • sendPutRequest
  • sendPatchRequest

We almost don't have hardcoded API requests in the PEGA Model Library because our experience proved they are very different every time. Anyway, we have some "best practices" as a recommendations on how to perform these requests in a better way, how to handle error messages and get required data.

Basic Authorization

For the basic authorization, you can include username and password to the url (operators manager can be useful too in this case):


URL Format

In order to have enough flexibility, it is recommended to parametrise such elements:

  • username
  • password
  • url
  • caseTypeID
  • case Id
  • request body
  • possible response code
  • runInfo (in order to get all the details from the current configuration)

A try-catch block will intercept errors and help understanding the reason of failure (if any).

Possible request configuration that returns case data (a GET request):

async getCaseDataByPegaCaseId(args: { operator: any, 
runInfo: any,
caseTypeID?: string,
pegaCaseId: string,
body?: any,
successfulStatus?: number,
environment?: string}) {
let successfulStatus: number;
let envName;
let caseTypeID = '';
if (args.environment) {
envName = args.environment;
} else {
envName =;
if (args.caseTypeID) {
caseTypeID = args.caseTypeID;
} else {
caseTypeID = `.......-WORK`; // case type Id in Pega

const getCaseDetailsSrc =

if (!args.successfulStatus) {
successfulStatus = 200;
} else {
successfulStatus = args.successfulStatus;

try {
const response: HttpResponse<any> = await I.sendGetRequest(getCaseDetailsSrc);
if (response.status == successfulStatus) {
if (typeof !== 'undefined') {
} catch (error) {
await logger.log(error);

If you have a certification issue while performing an API testing, execute this command at the beginning of your test:

process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';