Inbound REST call logging

Sebastiaan de V
Kilo Guru

For an integration with a third party system, we are building a REST integration using import sets with the Import API. We would like to track all REST communication (incoming and outgoing). 

Is it possible in the REST Import API to see and log (e.g. in a table) the incoming REST message, either the actual complete REST request or only the body (JSON). I couldn't find the question on the community. You can see the REST message if you enable REST debugging (glide.rest.debug=true), but I don't think you can access that in a script.

Anyone found a solution for this without resorting to a Scripted REST API?

 

10 REPLIES 10

ARG645
Tera Guru

I know this thread is 7 months Old. But I am curious to know why not use log statements[or any custom logging table] in the Scripted Rest API resource ? That is the best possible approach I can think of, and I implemented it multiple times. You can literally log whatever you want[The headers, body and parameters etc etc]

Below is the code snippet of Scripted Rest API Post Resource 

(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
	
	var requestBody = request.body;
	var requestData = requestBody.data;
	gs.log("Request Body "+new JSON().encode(requestBody));
	gs.log("Request Data "+new JSON().encode(requestData));
	
	/*
	    Your Code
	*/
	
})(request, response);

Thank you,

Aman Gurram

Please mark the answer as correct/helpful if applicable.