Modifying post response

By default DSP responds to a successful POST request with { “id”: '1" }. I need to modify this response so it sends back the full object plus some calculated value. It seems that I should be able to use the server-side scripting put.post_process event. it is working for get but not post. Is there way I can alter response?
if (event.response.record) {
_.each(event.response.record, function(record) {
// add a calculated field
record[“tid”]=“1234”;
}
);
}

If you POST a single record you’ll get back a single record (no ‘record’ array wrapper).

If you POST an array of records you’ll get back an array which is what your script is expecting.

I recommend always creating with the array format even it’s a single record.

1 Like

Hi

its $event[“response”][“content”][“resource”]
writable in post Process Event Scripts ???

I need to change POST RESPONSE

Regards