Authorization HTTP header in create invoice

Hi guys,

Can anyone help me in the Invoice generation,

The json array format is like this
{“invoice”:{“contact”:“https://api.freeagent.com/v2/contacts/2303251",“comments”:"Booking
Id =
1”,“dated_on”:“2014-01-10T09:20:52+00:00”,“payment_terms_in_days”:“365”,“currency”:“GBP”,“ec_status”:“EC
Services”,“status”:“Draft”,“invoice_items”:[{“position”:"",“item_type”:“Services”,“quantity”:“1”,“price”:“100”,“description”:“Agent
Id = 143,\r\n PropertyId = 1,\r\n Booking Id = 1,\r\n Inspection Date =
2013-12-18,\r\n Inspection Time = 7pm,\r\n Job reference number =
123”,“category”:“Property Booking”}]}}

and getting 422 error in response

[result] => Array
(
[errors] => Array
(
[0] => Array
(
[message] => contact can’t be blank
)

                [1] => Array
                    (
                        [message] => payment_terms_in_days is not a number
                    )

                [2] => Array
                    (
                        [message] => base Invoice Date is not valid
                    )

            )

    )

Please anyone tell me the true format of sending data.
thanks

Hello guys and girls,

I had some doubt about format so , i also try this format too,
{“invoice”:
{
“contact”: “https://api.freeagent.com/v2/contacts/2303251”,
“dated_on”: “2014-01-10T09:55:09+00:00”,
“due_on”: “2014-02-09T00:00:00+00:00”,
“currency”: “GBP”,
“status”: “Draft”,
“payment_terms_in_days”: 30,
“invoice_items”: [
{
“item_type”=>“Services”,
“price”: “100”,
“quantity”: 1,
“description”=>Agent Id = 143, PropertyId = 1,
Booking Id = 1, Inspection Date = 2013-12-18, Inspection Time = 7pm, Job
reference number = 123",
“category”=>“Property Booking”
}
]
} }

But nothing works, getting same error !!!

Help!!On Friday, 10 January 2014 14:53:54 UTC+5:30, vipul Kumar wrote:

Hi guys,

Can anyone help me in the Invoice generation,

The json array format is like this
{“invoice”:{“contact”:“https://api.freeagent.com/v2/contacts/2303251”,“comments”:“Booking
Id =
1”,“dated_on”:“2014-01-10T09:20:52+00:00”,“payment_terms_in_days”:“365”,“currency”:“GBP”,“ec_status”:“EC
Services”,“status”:“Draft”,“invoice_items”:[{“position”:“”,“item_type”:“Services”,“quantity”:“1”,“price”:“100”,“description”:“Agent
Id = 143,\r\n PropertyId = 1,\r\n Booking Id = 1,\r\n Inspection Date =
2013-12-18,\r\n Inspection Time = 7pm,\r\n Job reference number =
123”,“category”:“Property Booking”}]}}

and getting 422 error in response

[result] => Array
(
[errors] => Array
(
[0] => Array
(
[message] => contact can’t be blank
)

                [1] => Array
                    (
                        [message] => payment_terms_in_days is not a number
                    )

                [2] => Array
                    (
                        [message] => base Invoice Date is not valid
                    )

            )

    )

Please anyone tell me the true format of sending data.
thanks

Hi Vipul,

What content-type are you sending? It should be set to application/json.
Can you give me some more information about what exactly you’re sending?
For example can you try using Curl to send the request and post the
command you try?

Easiest way is to create a file with your JSON request and run the
following replacing TOKEN and filename (keep the @ symbol)

curl https://api.freeagent.com/v2/invoices
-H “Authorization: Bearer TOKEN”
-H “Accept: application/json”
-H “Content-Type: application/json”
-X POST \ -d @filename

Kind regards,

GraemeOn 10 January 2014 10:09, vipul Kumar dashing.vipul@gmail.com wrote:

Hello guys and girls,

I had some doubt about format so , i also try this format too,
{“invoice”:
{
“contact”: “https://api.freeagent.com/v2/contacts/2303251”,
“dated_on”: “2014-01-10T09:55:09+00:00”,
“due_on”: “2014-02-09T00:00:00+00:00”,
“currency”: “GBP”,
“status”: “Draft”,
“payment_terms_in_days”: 30,
“invoice_items”: [
{
“item_type”=>“Services”,
“price”: “100”,
“quantity”: 1,
“description”=>Agent Id = 143, PropertyId = 1,
Booking Id = 1, Inspection Date = 2013-12-18, Inspection Time = 7pm, Job
reference number = 123",
“category”=>“Property Booking”
}
]
} }

But nothing works, getting same error !!!

Help!!

On Friday, 10 January 2014 14:53:54 UTC+5:30, vipul Kumar wrote:

Hi guys,

Can anyone help me in the Invoice generation,

The json array format is like this
{“invoice”:{“contact”:“https://api.freeagent.com/v2/
contacts/2303251”,“comments”:“Booking Id = 1”,“dated_on”:“2014-01-10T09:
20:52+00:00”,“payment_terms_in_days”:“365”,“currency”:“GBP”,“ec_status”:“EC
Services”,“status”:“Draft”,“invoice_items”:[{“position”:“”
,“item_type”:“Services”,“quantity”:“1”,“price”:“100”,“description”:“Agent
Id = 143,\r\n PropertyId = 1,\r\n Booking Id = 1,\r\n Inspection Date =
2013-12-18,\r\n Inspection Time = 7pm,\r\n Job reference number =
123”,“category”:“Property Booking”}]}}

and getting 422 error in response

[result] => Array
(
[errors] => Array
(
[0] => Array
(
[message] => contact can’t be blank
)

                [1] => Array
                    (
                        [message] => payment_terms_in_days is not a number
                    )

                [2] => Array
                    (
                        [message] => base Invoice Date is not valid
                    )

            )

    )

Please anyone tell me the true format of sending data.
thanks


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.
For more options, visit https://groups.google.com/groups/opt_out.

Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. The FreeAgent Blog - FreeAgent
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
FreeAgent | Edinburgh

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