Your code needs to set an Accept http header with a value
of application/json or application/xml to declare the format in which it
would like responses to be sent. I imagine that should be set where the
user agent is set:
array(‘User-Agent’ => ‘Fantrac’, ‘Accept’ => ‘application/json’)
GraemeOn 29 April 2013 13:12, james stevenson email@example.com wrote:
I have set up a sandbox account and enabled the api feed. This is my code,
I’ve just copied the data used in
I want to be able to create a contact but getting this error, I have
attached the full script
[result] => **
Format not recognised. Set accept http header to application/json or application/xml
[code] => 400 [content_type] => application/xml; charset=utf-8
//and make the request to the API $response = $client->fetch( $base_url . '/contact', //API path array('contact' => array(
‘first_name’ => “test”,
‘last_name’ => “me”,
‘contact_name_on_invoices’ => “true”,
‘country’ => ‘United Kingdom’,
‘locale’ => “en”,
‘account_balance’ => “-100.0”,
‘uses_contact_invoice_sequenc’ => “false”,
‘created_at’ => “2011-09-14T16:00:41Z”,
‘updated_at’ => “2011-09-16T09:34:41Z”
), //request parameters
OAuth2\Client::HTTP_METHOD_GET, //GET, PUT, POST, DELETE
array(‘User-Agent’ => ‘Fantrac’) //API requires UA header
You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To unsubscribe from this group and stop receiving emails from it, send an
email to firstname.lastname@example.org.
To post to this group, send email to email@example.com.
Visit this group at http://groups.google.com/group/freeagent_api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Senior Software Engineer
40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774