Discussion

4
Replies
4406
Views
JOHNPW_GCS Member since 2009 17 posts
PEGA
Posted: 5 years ago
Last activity: 5 years 3 months ago
Closed

Pega API : Get to Play Quickly !

If like me, you couldn't wait to start messing about about with the new 'Pega API' facility in PRPC 7.1.8: here's a couple of quick startup tips so you can get going:

Out of the box: There are two basic requirements for getting going here:

1. You'll need to add the ROLE 'PegaRULES:PegaAPI' to your ACCESS GROUP.

2. You'll need be running HTTPS on your PRPC App Server.

If you are just messing about in on a scratch system - and you don't have time to set up HTTPS - you can swich over to using HTTP for testing.

This means your username/password will be sent over 'in the clear' - so anybody on your network with the right tools could read them : probably fine in a testing envrionment , definitely not fine at all for production systems...

INSTRUCTIONS for 1:

1. Login in as you Administrator User. (You will be using the DESIGNER STUDIO).

2. Top Right Hand Side: Click your Username and then 'Access Group':

a.png

3. Add in in the ROLE to your ACCESS GROUP and SAVE the changes.

b.png

4. Log out, log back in.

INSTRUCTIONS for 2:

1. Login as your administrator user.

2. Enter "api" into the search box (top right) and hit enter.

3. This will bring back more than a page of results : scroll to the bottom and click the link labelled "Show all results in new window".

c.png

4. Scroll down the new window until you find "Service Package| Api" - click the word 'Api' to navigate to the rule itself.

d.png

5. On the "Service Package : api" rule - uncheck the checkbox 'Use TLS/SSL (Rest only) - and save the rule - there is no need to logout.

e.png

Now try it: fire up the Pega API screen : Resources (top right)  | Pega API

f.png

This will bring up the main Pega API Landing Page - where you can test the REST methods directly - choose '[GET] /casetypes' for instance:

Click the 'Try it out!' button :

g.png

This will ask you to provide login credentials (it is using BASIC HTTP AUTHENTICATION):

h.png

After entering the details correctly - the server will respond in JSON , with a list of Case Types ( I have only one here ):

{ "pxObjClass":
"Pega-API-CaseManagement", "caseTypes":
[
{ "ID": "GCS-GCSApp-Work-MYWORK", "name": "MYWORK", "pxObjClass": "Pega-API-CaseManagement-CaseType", "startingProcesses":
[
{ "ID": "pyStartCase", "name": "MYWORK", "pxObjClass": "Pega-API-CaseManagement-Process" }
]
}
]
}



i.png

It is even nice enough to:

1. Provide you with a URL you can try directly from any HTTP client (just stick it in any old browser - or even a WGET cmdline, or a Python script or a Java Program or an Internet-Of-Things Thing of your choice.....)

2. Warn you that you that you are not using HTTPS:

{  "warning": "299 xxxxxx \"Use of TLS/SSL is strongly recommended for services using Basic Authentication\"",
  "content-type": "application/json;charset=UTF-8",
  "content-length": "277"
}



So there you have it : hope the new API brings you much hAPIness :-|

Data Integration
Moderation Team has archived post
Share this page LinkedIn