I am having two issues w/ the REST api via curl.
1) API is ignoring json attribute. If I do not urlencode, I get a "Unable to decode supplied JSON" return msg. When I do encode, as shown below, I get past issue, but it seems to ignore any of the conditions set in json attrib. It just return all contacts, w/out restricting by external_identifier or applying return filters set in json object.
$curl_post_data = [
'debug' => 1,
'version' => 3,
'entity' => 'Contact',
'action' => 'get',
'json' => urlencode (json_encode ( ["sequential"=>1,"return"=>"id,do_not_mail","external_identifier"=>777] )),
'api_key' => '1234',
'key' => '1234',
];
If I take out conditions & filters out of json attrib, it works fine :
$curl_post_data = [
'debug' => 1,
'version' => 3,
'entity' => 'Contact',
'action' => 'get',
'json' => 1,
'api_key' => '1234',
'key' => '1234',
'external_identifier' => 777,
'return'=> 'id,do_not_mail'
];
However, everyone else seems to be using this json attrib. I would like to get that working.
2) Second issue is chaining.
$curl_post_data = [
'debug' => 1,
'version' => 3,
'entity' => 'Contact',
'action' => 'get',
'json' => 1,
'api_key' => '1234',
'key' => '1234',
'external_identifier' => 777,
'return'=> 'id,do_not_mail',
'api.Contact.create' => urlencode (json_encode(['do_not_mail'=>0]))
];
Using api.Contact.create / replace, etc will trigger an undefined field error : undefined_fields":["api_Contact_create"].
I am json_encoding the field value in this example, but get the same issue by just passing an array. It just doesn't seem to recognize the chaining directive at all.
Any help much appreciated.