Emailing invoices via the Sandbox API

Dont you have to remove the [ brackets?

het volgende:

Hi Murray,

I gave it a try and it works perfectly, thanks for your help.

AndreyOn Thursday, 17 January 2013 15:08:15 UTC, Murray Summers wrote:

Andrey,

I’ve now fixed that mistake in the API documentation:

https://dev.freeagent.com/docs/invoices#mark-invoice-as-sent

Please let me know if you have any further problems.

Regards,
Murray

Software Engineer
FreeAgent

On Thursday, January 17, 2013 1:40:33 PM UTC, Murray Summers wrote:

Andrey,

Unfortunately, there is a mistake in the API documentation at the moment.
The format of the JSON should be:

{ “invoice”:
{
“email” : { “to”:"te...@example.com <javascript:>", “from”:"
te...@example.com <javascript:>", “subject”:“test invoice”, “body”: “pay
me now”}
}
}

Please feel free to contact me if this doesn’t work.

Regards,
Murray

On Monday, January 14, 2013 2:13:06 PM UTC, Andrey Pissantchev wrote:

According to the API Docs, “invoice” is an array:

https://dev.freeagent.com/docs/invoices#email-an-invoice

(I guess it makes sense if you’re sending multiple emails per invoice?)

Andrey

On Monday, 14 January 2013 14:02:04 UTC, Riël Notermans wrote:

Dont you have to remove the [ brackets?
Op 14 jan. 2013 14:55 schreef “Andrey Pissantchev” pissa...@gmail.com
het volgende:

Hello,

I’m working on an app that creates an invoice (creating a contact too
if necessary), emails it, and marks it as sent.

Everything worked fine except for the email sending functionality. I
was getting a 403 for it initially, but I’m using a third party API wrapper
so I thought it might be a problem with that.

Eventually I tried a cURL request:

curl -H “Authorization: Bearer TOKEN_HERE” -H “Accept:
application/json” -H “Content-Type: application/json”
https://api.sandbox.freeagent.com/v2/invoices/INVOICE_NUMBER/send_email-X POST -d '{

“invoice”:[

{

“to”:"MY_E...@gmail.com",

“from”:"te...@example.com",

“subject”:“test invoice”,

“body”: “pay me now”

}

]

}’

I am getting an error 500. Could it be that the Sandbox API doesn’t
send emails? Or (since I’m working from a sub-par terminal that doesn’t do
copy and pasting, so I’ve had to type everything by hand) is that a
response I’m likely to get if my JSON is malformed?

Thank you for your help,
Andrey


You received this message because you are subscribed to the Google
Groups “FreeAgent API” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/freeagent_api/-/T56_DXPHa1gJ.
To post to this group, send email to freeag...@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_ap...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.

Andrey,

I’ve now fixed that mistake in the API documentation:

https://dev.freeagent.com/docs/invoices#mark-invoice-as-sent

Please let me know if you have any further problems.

Regards,
Murray

Software Engineer
FreeAgentOn Thursday, January 17, 2013 1:40:33 PM UTC, Murray Summers wrote:

Andrey,

Unfortunately, there is a mistake in the API documentation at the moment.
The format of the JSON should be:

{ “invoice”:
{
“email” : { “to”:"test@example.com", “from”:"test@example.com",
“subject”:“test invoice”, “body”: “pay me now”}
}
}

Please feel free to contact me if this doesn’t work.

Regards,
Murray

On Monday, January 14, 2013 2:13:06 PM UTC, Andrey Pissantchev wrote:

According to the API Docs, “invoice” is an array:

https://dev.freeagent.com/docs/invoices#email-an-invoice

(I guess it makes sense if you’re sending multiple emails per invoice?)

Andrey

On Monday, 14 January 2013 14:02:04 UTC, Riël Notermans wrote:

Dont you have to remove the [ brackets?
Op 14 jan. 2013 14:55 schreef “Andrey Pissantchev” pissa...@gmail.com
het volgende:

Hello,

I’m working on an app that creates an invoice (creating a contact too
if necessary), emails it, and marks it as sent.

Everything worked fine except for the email sending functionality. I
was getting a 403 for it initially, but I’m using a third party API wrapper
so I thought it might be a problem with that.

Eventually I tried a cURL request:

curl -H “Authorization: Bearer TOKEN_HERE” -H “Accept:
application/json” -H “Content-Type: application/json”
https://api.sandbox.freeagent.com/v2/invoices/INVOICE_NUMBER/send_email-X POST -d '{

“invoice”:[

{

“to”:"MY_E...@gmail.com",

“from”:"te...@example.com",

“subject”:“test invoice”,

“body”: “pay me now”

}

]

}’

I am getting an error 500. Could it be that the Sandbox API doesn’t
send emails? Or (since I’m working from a sub-par terminal that doesn’t do
copy and pasting, so I’ve had to type everything by hand) is that a
response I’m likely to get if my JSON is malformed?

Thank you for your help,
Andrey


You received this message because you are subscribed to the Google
Groups “FreeAgent API” group.
To view this discussion on the web visit
https://groups.google.com/d/msg/freeagent_api/-/T56_DXPHa1gJ.
To post to this group, send email to freeag...@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_ap...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.