Scripted REST API dynamically send data as key values pairs in response body

Sowmya T
Kilo Expert

Hi Community,

As per our client requirement, I am trying to assign dynamic data as key value pairs in response body through scripted REST API. But I am getting error in REST API Explorer. Please find below screenshots for reference.

Any help would be appreciated!

Scripted REST API function:

calling this function in scripted API only:

find_real_file.png

Error in REST API Explorer:

POST test throgh REST exp - is the short description of the incident.

Here the problem is to assign the key dynamically to the response object.

find_real_file.png