The CreatorCon Call for Content is officially open! Get started here.

Scripted REST API or OOTB API

Joshua Cassity
Kilo Guru

We have a requirement to allow an external system to submit an item out on our service catalog.   Here's what we are doing using the 'Buy Item' resource using the 'SN_SC' api:

1. Peoplesoft initiates a REST call to begin an onboarding catalog item once approval is gathered for the hire. (this is working)

2. RITM is created and populated with that employee's information. (this is working)

3. Response is sent back to Peoplesoft with the RITM number to save on the approval record.

Item 3 poses an issue for us because the response only gives the REQ number and we really need the RITM number to be sent back in the response (which they'll store in their system) instead because if they need to update the RITM with new information (say Mary's last name changes during onboarding because she got married or her first day was going to be Monday but is now Friday, etc...).

Is the only way to handle such a thing is to create a scripted REST api (which we've never done before so it'll be a learning curve for me) or is there some other mechanism in the header or body to specify what needs to go back in the response?

Thanks for your assistance.

24 REPLIES 24

You should be able to use:



ritmGR.variables['<variable_name>'] = '<my_new_value>';



to interface with variables on record.



As per your question around passing in the body, you can access other properties of the "request" object, such as request.body and request.queryParams.my_param.



Full documentation at: RESTAPIRequest - Scoped, Global


Unfortunately I think that's only available in the scoped application for the Service Catalog API.



I ended up figuring it out by simply not adding any parameters in the pathway and using request.body.variablename where my body was {"variablename":"variablevalue"}.



Ex.



{"start_date":"2017-08-20"}



Thank you guys for all your assistance.


Joshua Cassity
Kilo Guru

Our instance is setup so that we do not work any RITM directly but only tasks under the RITM so the RITM would never close until all tasking is completed (which closes the RITM automatically), at which point the PeopleSoft record would be closed for any updates.


Joshua Cassity wrote:



Our instance is setup so that we do not work any RITM directly but only tasks under the RITM so the RITM would never close until all tasking is completed (which closes the RITM automatically), at which point the PeopleSoft record would be closed for any updates.


In which case... is it simply the SCTASKs that need to be pushed over to PeopleSoft, and when each is closed, it messages back to the platform to close, advance and retrieve the next one?


Nothing needs to be pushed over to the PeopleSoft platform other than the RITM number of the onboarding. I'll likely just try to do a scripted api for any updates to RITMs.



~ J ~