OS1 Services
...
Integrate with Dispatch
How to: Implement Custom Code in Dispatch Service
6 min
implementing pre configured custom code the pre configured custom code url is available for each api that supports custom code the custom code will be registered and configured for a type like docid\ dnkabqncd3ws7xxmb nnq developers can configure the custom code for create instance , update instance , and apply event implementing custom code in the request body to dynamically modify the custom code config for each api call, we've added two docid\ mz ewp1umtozx39tr2n6k https //docs getos1 com/docs/custom code#section attributes it can be used for creating, updating, and applying requests custom code fields to add custom code in the docid\ kjdpcl9yep5kbek1isxku add the following values in the request body true left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type left unhandled content type 📘 methodnames allowed are createdispatch\ onrequest, updatedispatch\ onrequest, updatedispatchstatus\ onrequest, updatedispatchsubstatus\ onrequest, addparticipant\ onrequest, removeparticipant\ onrequest, addparticipantbulk\ onrequest, addjob\ onrequest, removejob\ onrequest, removemultiplejobs\ onrequest, removejobfromdispatch\ onrequest, removemultiplejobsfromdispatch\ onrequest, addjobbyref\ onrequest, changestatusbyref\ onrequest, changesubstatusbyref\ onrequest, addmultiplejobsbyref\ onrequest, removemultiplejobsbyref\ onrequest, removejobbyref\ onrequest, addparticipantbyref\ onrequest, addmultipleparticipantsbyref\ onrequest, removeparticipantbyref\ onrequest, updatecustomdatabyref\ onrequest, patchcustomdatabyref\ onrequest, addjobbulk\ onrequest, createjob\ onrequest, updatecustomdata\ onrequest, patchcustomdata\ onrequest, updatejobstatus\ onrequest, updatejobsubstatus\ onrequest, custodyin\ onrequest, custodyout\ onrequest, custodyinbatch\ onrequest, custodyoutbatch\ onrequest, createdispatch\ onerror, updatedispatch\ onerror, updatedispatchstatus\ onerror, updatedispatchsubstatus, addparticipant\ onerror, removeparticipant\ onerror, addparticipantbulk\ onerror, addjob\ onerror, removejob\ onerror, removemultiplejobs\ onerror, removejobfromdispatch\ onerror, removemultiplejobsfromdispatch\ onerror, addjobbyref\ onerror, changestatusbyref\ onerror, changesubstatusbyref\ onerror, addmultiplejobsbyref\ onerror, removemultiplejobsbyref\ onerror, removejobbyref\ onerror, addparticipantbyref\ onerror, addmultipleparticipantsbyref\ onerror, removeparticipantbyref\ onerror, updatecustomdatabyref\ onerror, patchcustomdatabyref\ onerror, addjobbulk\ onerror, createjob\ onerror, updatecustomdata\ onerror, patchcustomdata\ onerror, updatejobstatus\ onerror, updatejobsubstatus\ onerror, custodyin\ onerror, custodyout\ onerror, custodyinbatch\ onerror, custodyoutbatch\ onerror expected response from custom code data is expected in response to the custom code with the existing payload in the data fields { data { 	 } } data formation from custom code response the fields returned from custom code inside the data field are replaced with the existing payload as shown below the payload in request body { "dispatchtype" "pudo", "dispatchref" "dsp 0001 0001", "tenantid" "delhivery", } payload returned from custom code { "customdata" { "facilityid" "facility 1", } } final payload that is used to register an instance { "dispatchtype" "pudo", "dispatchref" "dsp 0001 0001", "tenantid" "delhivery", "customdata" { "facilityid" "facility 1", } }