Custom script response code and response content after sccessful execution

After I am able to successfully execute a custom script, would it be a good practice to return the http code and content? Like say this is my script

result = platform.api.post( "cldbgps/_table/positions", position_data );
// Executed successfully and was able to post a record

event.response.status_code = 200;
event.response.content = {"success": "OK"};

return;

Will the ‘result’ variable hold a HTTP Status code after execution?

And also , is the “return;” at the end a good practice?

Thanks,
M.M

Hi @m_menon,

result.status_code has the HTTP Status code, you can use it wherever you want, inside script.
You can return your own status code, if you think it suits better.

If you use “return” statement the status code will be 200 by default. Since DF2.1 you can set your status code and content type, so there is no need to keep using “return”.

Alright thanks a lot for the clarification :slight_smile:

Cheers,
M.M