Question
Merkle
CA
Last activity: 7 Jan 2016 0:02 EST
How to build REST service with JSON format (7.1.9 ver)
hello
I am looking for detailed steps to build a REST service in PRPC7.1.9 using JSON format. Can some one point to relevant documentation, wizards? also i am looking for sample Request Response Structures for this kind of a service.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
PEG
IN
Sample json(request/response) would be something similar as below.
For page property:
{"pyEmailAddress":"[email protected]","pyPhoneNumber":"12345"}
For pagelist property:
[{"pyEmailAddress":"[email protected]","pyPhoneNumber":"12345"},{"pyEmailAddress":"[email protected]","pyPhoneNumber":"67890"}]
Here pyEmailAddress and pyPhoneNumber are properties in PRPC.
PEG
IN
Regarding REST Service creation, unfortunately we don't have wizard to create the same as we do in SOAP. We need to create the rules manually.
In order to create the Service-REST rule we need to follow below steps.
- Create Service Package data instance.
- Create Service-REST with GET/POST/PUT/DELETE methods.
- Call Service activity in any of the methods.
- Map request/response parameters accordingly to JSON.
Pegasystems Inc.
GB
Hi Sudesh,
If you just wish to expose a read-only PRPC-Provided REST Service: you can do this without much configuration at all on 719: just use the 'Pega API' drop-down menu from the Designer Studio.
See these links for some examples:
Create a Data Page: Access it over REST, Create a PDF.....
Pega API : Get to Play Quickly !
https://pdn.pega.com/integration/getting-started-with-the-pega-api
Thanks !
John
Merkle
CA
Thanks Gangababu, John. I will look into the steps and article links you have posted.
Currently I have a Service HTTP fully implemented as a POC. Older versions used Service HTTP implementation for RESTful services. 7+ versions now have Service REST Rule type.
So I have well defined Request Response XMLs with data for testing, corresponding XSDs and all PRPC rules (Parse, XML stream, activity, workflow, service package) etc.
Now what I am trying to do is: Build equivalent Rest service and convert or reuse most of the rules/assets already created for Service HTTP implementation. Not sure how much of it can be reused.
Pegasystems Inc.
CA
If you already have the data model created off XSDs and you now want to use JSON with Service REST, it should be pretty simple. Just choose JSON as the map from/to option and provide the page property corresponding to the root element from the XSD as the map from/to key option. Pega automatically builds out the outbound JSON based on the properties set in the hierarchy of this embedded page. For inbound JSON, data is automatically mapped to this page structure.
Merkle
CA
hi John, Gangababu & Praneeth -- I have started my journey in building a REST JSON service now and poking around, digging around how best to implement it and what OOTB rules to reuse.
Can I post questions on this same thread as they come up?
I have manually built 1) Service package, 2) Service Rest rule, 3) Service Activity and playing around with different configuration options for Service Rest rule tabs and certain functions in Pega.
LMK
PEG
IN
Please raise separate post for specific issues you faced while building service.