When calling a script via REST API, the framework provides a few implicit variables that you can utilize. For the inbound body you would need to use "requestBody" which will only be put in the hashmap if something exists (so if you sometimes provide something, and other times do not, be aware that trying to retrieve the variable might fail). If you need to return something to the calling program, you use the variable "responseBody" to build the response. In both cases, don't use the double quotes when referencing the variables.
If you need to retrieve query parameters or some other piece of data, there is a "request" implicit variable that exposes the OslcRequest. So for example, you can call:
request.getQueryParam("wonum")
And that would return the wonum query parameter if it was provided.
Both inbound and outbound, I would ensure you put this in a proper JSON format so you can easily parse it & build it. If you've never used the JSONObject java class, it's pretty simple. You would have something like this:
from com.ibm.json.java import JSONObject
requestBodyObject=JSONObject.parse(requestBody)
and then you would be able to do:
requestBodyObject.get("wonum")
------------------------------
Steven Shull
Director of Development
Projetech Inc
Cincinnati OH
------------------------------