Global API
Response
5min
this response is the information returned from the request call this will be returned in the form of a map\<string, object> below are the list of keys or parameters returned in the response map key (string) value (object) additional detail version ‘1 0’ returns the same version sent in the request action see the list of available actions returns the same action sent in the request timestamp timestamp in milliseconds (unix) the time at which the response was returned this can be used to troubleshoot validrequest either true or false true if the request satisfies the breadwinner validations; false if it does not apierrors returns response docid\ lps5q5vqcwrv0ujenpbls list as a json string list of errors that occurred while validating the request before making the request to netsuite responsejson returns the response of the record(s) as a json string includes the records data as well as any errors that were sent to breadwinner from netsuite error key (string) data type description code string a short string indicating the error code reported message string a detailed explanation of the error occurred example breadwinner was unable to process the request as the action parameter was invalid errors before requesting netsuite errors that occur while validating the request, or while making a request to netsuite are returned as ‘apierrors’ in the response after requesting netsuite errors occurred within netsuite while processing the request, or while processing the data in breadwinner are sent as ‘errors’ in the responsejson key of the response map examples breadwinner does validation prior to calling out to netsuite invalid request { action=readcustomer, apierrors={"errors" \[ {"message" "breadwinner was unable to process the request as the version parameter was not valid ", "code" "invalid version" } ] }, timestamp=1635186915365, validrequest=false, version=1 1 } this is an error sent back from netsuite that was reformatted for easier reading 400 { action=createcustomer, responsejson={ "customers" null, "errors" \[ { "message" "please enter value(s) for first name, last name", "code" "user error" } ], "status" "400" }, timestamp=1635239587001, validrequest=true, version=1 0 } sample structure on how to parse the response apex if(respmap containskey('apierrors') && respmap get('apierrors')!=null){ // add any custom apex code } else if(respmap containskey('responsejson') && string isnotblank((string)respmap get('responsejson'))){ response responsereturn = new response(); map\<string,object> soresponsejsonmap = (map\<string,object>)json deserializeuntyped((string)respmap get('responsejson')); if(soresponsejsonmap !=null && soresponsejsonmap containskey('status') && soresponsejsonmap get('status')!=null){ responsereturn statuscode = (string)soresponsejsonmap get('status'); } if(soresponsejsonmap !=null && soresponsejsonmap containskey('salesorders') && soresponsejsonmap get('salesorders')!=null){ list\<object> soobj = (list\<object>)soresponsejsonmap get('salesorders'); map\<string,object> savedso = (map\<string,object>)soobj\[0]; responsereturn recordid = (string)savedso get('salesforceid'); } if(soresponsejsonmap !=null && soresponsejsonmap containskey('errors') && soresponsejsonmap get('errors')!=null){ responsereturn error = json serialize((list\<object>)soresponsejsonmap get('errors')); } //return responsereturn; }