Modifying post response


#1

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”;
}
);
}


#2

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.


#3

Hi

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

I need to change POST RESPONSE

Regards