David Adams
Members-
Posts
4 -
Joined
-
Last visited
Reputation
0 Neutral-
MalformedRequestBody Minor bug in API code can anyone help?
David Adams replied to David Adams's topic in General
PROBLEM SOLVED! -- Thank you everyone who spent any time reviewing turns out I was (ugh) missing a closing bracket on an array element, and also missing TWO required fields as part of each address: "address_type_id": "ACCOUNTS", "name": "Main Address", Ok, live and learn... closing this topic... thanks again. -
MalformedRequestBody Minor bug in API code can anyone help?
David Adams replied to David Adams's topic in General
any advice from anyone? the syntax seems great and the variables are all properly filled with correct data and data types. it has to be a required field or some other technicality i think... anyone? -
MalformedRequestBody Minor bug in API code can anyone help?
David Adams replied to David Adams's topic in General
i added country_group_id with a value of "US" to the two address blocks.. not sure if this was required or correct.. but still no luck (example below) "main_address": { "contact_id": "' . $custObj->contact_id . '", "address_line_1": "' . $street1 . '", "address_line_2": "' . $street2 . '", "city": "' . $city . '", "postal_code": "' . $zip . '", "region": "' . $state . '", "country_group_id": "' . 'US' . '", "is_main_address": true }, -
Thank you in advance for your help with this! Hi we have just started using the Sage API and were able to create a customer. However, when we attempt to populate the address and contact info we get a "MalformedRequestBody" error. I think the syntax is correct and all of the PHP variables contain the appropriate data, so I'm thinking there must be a required field that is missing such as "type ID" or some other required field. here is the block of code that is causing the error: CURLOPT_POSTFIELDS => '{ "contact": { "name": "' . $company . '", "contact_type_ids": [ "Customer" ], "main_address": { "address_line_1": "' . $street1 . '", "address_line_2": "' . $street2 . '", "city": "' . $city . '", "postal_code": "' . $zip . '", "region": "' . $state . '", "is_main_address": true }, "delivery_address": { "address_line_1": "' . $street1 . '", "address_line_2": "' . $street2 . '", "city": "' . $city . '", "postal_code": "' . $zip . '", "region": "' . $state . '", "is_main_address": false }, "main_contact_person": { "name": "' . $firstname . ' ' . $lastname . '", "job_title": "' . $title . '", "telephone": "' . $phone . '", "mobile": "' . $mobile . '", "email": "' . $email . '", "is_preferred_contact": true } }',