These are the steps necessary
to create a JSON REST API. To change from JSON to XML is easy, but I will focus
on JSON.
• Create or identify the record that you will be
using. I created four records. Three records that will be used for employee
data. X_ERROR will be used to place error messages coming from the API.
• Create documents from the records. Each of the
records created will be used to create a document.
These are the documents that were created based on
records
• Create additional documents to be used in your http
GET and POST requests. The documents created from records are not enough to get
all the information that you need. In this case I want to retrieve the employee
id, name, all her email addresses, and all her phone numbers. To accomplish
that, I need create another document. This additional document will use the
documents that were created from records.
•
Create messages based on documents. I will only create two messages. One to be
used as template and the other that will contain the employee data and error
messages (if any)
•
Create Service. One service needs to be created in which different Service
Operations can be added
• Create Service Operation within Service. Once the
Service has been saved, Service Operations can be added. In this case I am
adding the GET Service Operation. A couple of things to note here. One is the
URL that will be used to get the data and the other is the word
"nothing" The template needs to have something there.
"nothing" is there to identify that nothing will be passed on the
template.
• Add Security to Service Operation. This security is a permission list that will access to this Service Operation. Since this is just a demo, I am granting access to PTPT1000 but on a production environment, this will be decided by your favorite security administrator.
• Create application package. The code below is used
to populate the data into the message that will be sent to the user.
• Update Service Operation Handlers with the
application package. The Service Operation needs to have a request handler.
• Test. Remember thing 1 from the Service Operation
image, that is the URL that will be used for testing. In my PUM image, the URL
is http://hostname:8000/PSIGW/RESTListeningConnector/PSFT_HR/X_GET_EMPLOYEE_DATA.v1/nothing
Final thoughts. If everything went well, you will have see a nice empty JSON result. If you want to see some data, you can do some insert statements on the three employee records and refresh your page. This URL with the security that was added will always return the PS data because that will be default user. If you scroll back to the Service Operation Image, you will see on the top right that there is a checkbox for User/Password Required. For this demo, that was left unchecked but in practice you should enable at least Basic Authentication and SSL.
Thanks,
Manoranjan
Thank you. This information is very helpful.
ReplyDeleteyou are welcome
DeleteHi, Need some help on PeopleSoft Consuming JSON MQ message.
ReplyDeleteWe configured JMSTARGET node and were able to establish the connection between MQ series and PS local node as per PS Documentation.
We are not able to consume the JSON message. We tried to use Non-rowset message (as Peoplesoft don't have the ability to create message out of JSON Schema, we used online tool to convert JSON to XML and then got XSD and used in non-rowset creation). And created Service operation and added Handler code. But, we are not able to consume the message as it throws "Connection manager thrown GeneralFrameworkException" error.
Then, we tried to use Document to create the message (Created same JSON structure document) and created the Service operation but when we try to consume message, it says "Unknown JMS message Format".
Could you please help me on how to consume MQ series JSON message using Document/non-rowset method? Thanks.
Hi Manoranjan,
ReplyDeletethanks for the article it really helps everyone who are looking for the same.
Thanks for the great article. Can you please show your application package? Please tell us how you created application package and application class for this REST API.
ReplyDeleteHiMuhammad, the original article is posted at https://www.linkedin.com/pulse/how-create-get-json-rest-api-peoplesoft-jose-ponce?trk=portfolio_article-card_title
ReplyDeleteIt has screenshots of the application package