Creating a contact

Hi James,

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’)

Kind regards,

GraemeOn 29 April 2013 13:12, james stevenson 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' =>

‘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
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
To post to this group, send email to
Visit this group at
For more options, visit

Graeme Boyd
Senior Software Engineer

Web. Blog.
Twitter. @freeagent!/freeagent Facebook.

40 Torphichen Street, Edinburgh, EH3 8JB
FreeAgent Central Ltd. Registered in sunny Scotland SC316774