Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

CRUD operations using Constellation DX API’s

To work with Constellation DX APIs, you must use the Pega Community Edition exclusively.

In App Studio, create a new data type, making sure that the pyGUID is both autogenerated and set to
read-only.

Add newly created field in primary tab.


Configure OAuth 2.0 Client Registration.

Click on Create and Open

Deselect the client credentials checkbox and select the password credentials checkbox.

Click on View and download button.

Now client ID and Client secret is downloaded into your system.

Click on save.

Done.
For accessing Constellation DX API’s, we have service package called Application.

Open Application Service Package.

Scroll down to find data/{data_view_id} API.

Open that API.


For this URL we are required to pass Savable Datapage.

Copy the URL and paste it in Postman for CRUD operations.

1. CREATE operation:

For create operation use POST method in Postman as shown.


In the authorization tab in the Postman select grant type as OAuth 2.0.

Enter all required information, including Token Name, Grant Type, Access Token URL, Client ID, Client
Secret, Username, and Password from the file which you downloaded.

Note: You need to manually create a new operator ID in Pega Community Edition and
use the same Username and Password in Postman.
Click on Get New Access Token. Once authentication is successful, click on Use Token.

In Postman, enter the details in JSON format for the property or properties you need to add in the
Datatype.

Now, click on send.

You will get 200 as response code that means record is successfully inserted into the data type.
Let’s check the same in our Pega Datatype.

Refresh it.

Data record is successfully inserted.

2. UPDATE operation:

For update operation use PUT method in Postman as shown.


Copy the pyGUID from the CREATE operation which we have done earlier.

My pyGUID is "pyGUID": "6cf80996-67f3-4d70-9b43-b22a93f6f0a1"


In the body, provide the JSON in below format as shown

Click on send.

Note: if access token is expired, then generate new access token.


We got 200 as response code which means the record is updated in the Datatype.

Let’s check.

Refresh.

Here, “Beta” is updated with the new value called “Gamma”


3. DELETE operation:

For update operation use DELETE method in Postman as shown.

For DELETE operation we don’t have body. So, we need to pass the pyGUID as a parameter.

In the param tab in DELETE operation, provide the details as shown.

Here we have to pass parameter in the JSON format only,

Now click on send.

You will be getting an error, and response code as 400 that means bad request. So here we need to
pass the pyGUID in an encoded format.
For encoding, visit https://www.urlencoder.org/ and paste pyGUID in that website.

Paste pyGUID in the JSON format.


Scroll down and click on encode.

Copy the encoded text and paste it in Postman.


Click on send.

We got 200 as response code which means data record in deleted in the Datatype.

Now let’s check in the Datatype.

Refresh.

Data record is deleted.

THANK YOU

You might also like