Creating a new bill 404 issue

Hi,

I am trying to create a bill but it is coming back 404 not found. Not quite
sure what is going wrong (and I can’t really tell due to the FA
documentation).

I am currently posting the following -

Query destination: https://api.freeagent.com/v2/bills
Method: POST
Data: {“contact”:17901,“reference”:"#161807",“dated_on”:“2013-03-05”,“due_on”:“2013-04-04”,“category”:“https://api.freeagent.com/v2/categories/155",“comments”:"Comment data”,“sales_tax_rate”:“20.0”,“total_value”:“99.99”}

Could you explain to me why this is returning a 404?

Cheers,
Chris.

Found out the issue. When posting to bills you need to specify as a bill
and then add the bill data… e.g.

{
“bill”:
{
“contact”:“https://api.freeagent.com/v2/contacts/17901”,
“reference”:"#161807",
“dated_on”:“2013-03-05”,
“due_on”:“2013-04-04”,
“category”:“https://api.freeagent.com/v2/categories/155”,
“comments”:“Comment data”,
“sales_tax_rate”:“20.0”,
“total_value”:“99.99”
}
}

Of course, the API documentation just assumes we know what format it’s
expecting… a little trial and error found this out.

Hi Chris,

I’m glad you managed to solve your problem. As you have found, you need to
pass the contact as a resource URL and specify the type of object you are
creating in the JSON.

I also noticed that you are using a category with the nominal code 155.
This is a custom nominal code which I’m guessing you have set up as you
have managed to get it working. If you hadn’t set this up then this would
also cause problems.

Regards,
Harry MillsOn Mon, Mar 11, 2013 at 12:46 PM, Chris chris.page@hallwaystudios.comwrote:

Probably worth noting that I have also specified the exact contact URL
rather than just the contact ID (
https://api.freeagent.com/v2/contacts/17901)


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 freeagent_api+unsubscribe@googlegroups.com.
To post to this group, send email to freeagent_api@googlegroups.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.

Probably worth noting that I have also specified the exact contact URL
rather than just the contact ID
(https://api.freeagent.com/v2/contacts/17901)