Global API

Response

5min
response is the information returned from the request call this will be returned in the form of a map\<string, object> below is 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 error https //app archbee io/docs/garaxzbpu8geodlu0 0q /ogommemoddbei0fciy2t4#ig error list as a json string list of errors that occurred while validating the request before making the request to xero 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 xero 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 xero errors that occur while validating the request, or while making a request to xero are returned as ‘apierrors’ in the response after requesting xero errors occurred within xero 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 xero 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 } the errors that xero returns will be included as "errors"in the "responsejson" below is the example that was reformatted for easier reading 400 { action=createcustomer, responsejson={ "customers" null, "errors" \[ { "message" "please enter value(s) for display name", "code" "user error" } ], "statuscode" "400" }, timestamp=1635239587001, validrequest=true, version=1 0 } sample structure on how to parse the response if(respmap containskey('apierrors') && respmap get('apierrors')!=null){ // add any custom apex code } else if(respmap containskey('responsejson') && string isnotblank((string)respmap get('responsejson'))){ // parse it to map or optionally to a wrapper map\<string,object> invoiceresponsejsonmap = (map\<string,object>)json deserializeuntyped((string)respmap get('responsejson')); if(invoiceresponsejsonmap != null && invoiceresponsejsonmap containskey('statuscode') && invoiceresponsejsonmap get('statuscode')!=null){ // add any custom apex code } if(invoiceresponsejsonmap != null && invoiceresponsejsonmap containskey('invoices') && invoiceresponsejsonmap get('invoices')!=null){ // parse it to object or optionally to a wrapper list\<object> soobj = (list\<object>)invoiceresponsejsonmap get('invoices'); map\<string,object> savedso = (map\<string,object>)soobj\[0]; // now we are inside the success case, please add your update field (dml) apex code here } if(invoiceresponsejsonmap != null && invoiceresponsejsonmap containskey('errors') && invoiceresponsejsonmap get('errors')!=null){ // add any custom apex code } }