API Update this morning

Hello,

As many of you will know, FreeAgent is a Rails app and we’ve upgraded to
fix a serious bug in Rails this morning. We don’t think this will affect
the API but if you see anything amiss please get in touch.

Kind regards,

Graeme

Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

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

Greame,

I have this error using the API:

Request failed for https://api.freeagent.com/v2/bills returned code 404.
Server response: {“errors”:{“error”:{“message”:“Resource not found”}}}
(line 265)

Am I doing something wrong? This is Google Apps Script. Can it be that my
payload is not correct?

var payload = { “bill”:
{
“contact”:“https://api.freeagent.com/v2/contacts/1348499”,
“category”:"",
“reference”:csvData[13],
“dated_on”:dated_on,
“due_on”:due_on,
“total_value”:amount,
“paid_value”:"",
“due_value”:"",
“sales_tax_value”:"",
“sales_tax_rate”:“21.0”,
“status”:“Open”,
“updated_at”:"",
“created_at”:"",
“attachment”:""

}
}

Kind regards!

Met vriendelijke groet,
Riël Notermans

http://www.zzapps.nl/

Zzapps
De Zaale 11
5612 AJ Eindhoven
+31 (0)40-7114194
+31 (0)6-46348704

riel@zzapps.nl
http://www.zzapps.nl2013/1/9 Graeme Boyd graeme.boyd@freeagent.com

Hello,

As many of you will know, FreeAgent is a Rails app and we’ve upgraded to
fix a serious bug in Rails this morning. We don’t think this will affect
the API but if you see anything amiss please get in touch.

Kind regards,

Graeme


Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

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


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.

Hmm,

I added category (in docs it says not required?) but now I get a server 500
error.

I am pretty sure the data passed is allright:

function freeAgentBill() {

var payload = { “bill” :{
“contact”:“https://api.freeagent.com/v2/contacts/1348499”,
“category”:“https://api.freeagent.com/v2/categories/003”,
“reference”:“test”,
“dated_on”:“2013-01-01”,
“due_on”:“2013-01-01”,
“total_value”:200,
“sales_tax_rate”:“21”,
“status”:“Open”}
};

freeagentPost(“bills”, payload);

}

function freeagentPost(type, payload) { // SCRIPT FOR POSTING ANYTHING
var options =
{
“method” : “post”,
“payload” : payload,
“contentType” : “application/json”,
“headers” : {“Authorization”: “Bearer TOKEN”, “Accept”:
“application/json”}
};

var response = UrlFetchApp.fetch(“https://api.freeagent.com/v2/bills”,
options);
return response;
}

Met vriendelijke groet,
Riël Notermans

http://www.zzapps.nl/

Zzapps
De Zaale 11
5612 AJ Eindhoven
+31 (0)40-7114194
+31 (0)6-46348704

riel@zzapps.nl
http://www.zzapps.nl2013/1/9 Graeme Boyd graeme.boyd@freeagent.com

Hi Riël

The following Curl command works for me:

curl -H “Authorization: Bearer TOKEN” -H “Accept: application/json” -H
“Content-Type: application/json” http://api.freeagent.com/v2/bills -X
POST -d ‘{
“bill”: {
“contact”: “https://api.freeagent.com/v2/contacts/1”,
“category”:“https://api.freeagent.com/v2/categories/285”,
“reference”: 13,
“dated_on”: “2013-01-01”,
“due_on”: “2013-01-01”,
“total_value”: 100,
“sales_tax_rate”: “21.0”,
“status”: “Draft”
}
}’

A category needs to be defined when creating a bill.

Kind regards,

Graeme

On 9 January 2013 14:37, Riël Notermans riel@zzapps.nl wrote:

Greame,

I have this error using the API:

Request failed for https://api.freeagent.com/v2/bills returned code 404.
Server response: {“errors”:{“error”:{“message”:“Resource not found”}}}
(line 265)

Am I doing something wrong? This is Google Apps Script. Can it be that my
payload is not correct?

var payload = { “bill”:
{
“contact”:“https://api.freeagent.com/v2/contacts/1348499”,
“category”:"",
“reference”:csvData[13],
“dated_on”:dated_on,
“due_on”:due_on,
“total_value”:amount,
“paid_value”:"",
“due_value”:"",
“sales_tax_value”:"",
“sales_tax_rate”:“21.0”,
“status”:“Open”,
“updated_at”:"",
“created_at”:"",
“attachment”:""

}
}

Kind regards!

Met vriendelijke groet,
Riël Notermans

http://www.zzapps.nl/

Zzapps
De Zaale 11
5612 AJ Eindhoven
+31 (0)40-7114194
+31 (0)6-46348704

riel@zzapps.nl
http://www.zzapps.nl

2013/1/9 Graeme Boyd graeme.boyd@freeagent.com

Hello,

As many of you will know, FreeAgent is a Rails app and we’ve upgraded to
fix a serious bug in Rails this morning. We don’t think this will affect
the API but if you see anything amiss please get in touch.

Kind regards,

Graeme


Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog.
freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

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


You received this message because you are subscribed to the Google
Groups “FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.


Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

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


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.

Hmm, this is my POST when I use httpbin/post:

{
“url”: “http://httpbin.org/post”,
“args”: {},
“files”: {},
“headers”: {
“Authorization”: “Bearer TONKEN”,
“Accept”: “application/json”,
“Host”: “httpbin.org”,
“Accept-Encoding”: “gzip”,
“Content-Type”: “application/json”,
“User-Agent”: “Mozilla/5.0 (compatible; GoogleDocs; script; +
http://docs.google.com)”,
“Content-Length”: “246”,
“Connection”: “keep-alive”
},
“data”: “{“bill”:{“contact”:”
https://api.freeagent.com/v2/contacts/1348499",“category”:"
https://api.freeagent.com/v2/categories/003
“,“reference”:“test”,“dated_on”:“2013-01-01”,“due_on”:“2013-01-01”,“total_value”:200,“sales_tax_rate”:“21”,“status”:“Open”}}”,
“origin”: “10.189.122.229”,
“json”: {
“bill”: {
“due_on”: “2013-01-01”,
“category”: “https://api.freeagent.com/v2/categories/003”,
“reference”: “test”,
“sales_tax_rate”: “21”,
“status”: “Open”,
“dated_on”: “2013-01-01”,
“contact”: “https://api.freeagent.com/v2/contacts/1348499”,
“total_value”: 200
}
},
“form”: {}
}

Met vriendelijke groet,
Riël Notermans

http://www.zzapps.nl/

Zzapps
De Zaale 11
5612 AJ Eindhoven
+31 (0)40-7114194
+31 (0)6-46348704

riel@zzapps.nl
http://www.zzapps.nl2013/1/9 Riël Notermans riel@zzapps.nl

Hmm,

I added category (in docs it says not required?) but now I get a server
500 error.

I am pretty sure the data passed is allright:

function freeAgentBill() {

var payload = { “bill” :{
“contact”:“https://api.freeagent.com/v2/contacts/1348499”,
“category”:“https://api.freeagent.com/v2/categories/003”,
“reference”:“test”,
“dated_on”:“2013-01-01”,
“due_on”:“2013-01-01”,
“total_value”:200,
“sales_tax_rate”:“21”,
“status”:“Open”}
};

freeagentPost(“bills”, payload);

}

function freeagentPost(type, payload) { // SCRIPT FOR POSTING ANYTHING
var options =
{
“method” : “post”,
“payload” : payload,
“contentType” : “application/json”,
“headers” : {“Authorization”: “Bearer TOKEN”, “Accept”:
“application/json”}
};

var response = UrlFetchApp.fetch(“https://api.freeagent.com/v2/bills”,
options);
return response;
}

Met vriendelijke groet,
Riël Notermans

http://www.zzapps.nl/

Zzapps
De Zaale 11
5612 AJ Eindhoven
+31 (0)40-7114194
+31 (0)6-46348704

riel@zzapps.nl
http://www.zzapps.nl

2013/1/9 Graeme Boyd graeme.boyd@freeagent.com

Hi Riël

The following Curl command works for me:

curl -H “Authorization: Bearer TOKEN” -H “Accept: application/json” -H
“Content-Type: application/json” http://api.freeagent.com/v2/bills -X
POST -d ‘{
“bill”: {
“contact”: “https://api.freeagent.com/v2/contacts/1”,
“category”:“https://api.freeagent.com/v2/categories/285”,
“reference”: 13,
“dated_on”: “2013-01-01”,
“due_on”: “2013-01-01”,
“total_value”: 100,
“sales_tax_rate”: “21.0”,
“status”: “Draft”
}
}’

A category needs to be defined when creating a bill.

Kind regards,

Graeme

On 9 January 2013 14:37, Riël Notermans riel@zzapps.nl wrote:

Greame,

I have this error using the API:

Request failed for https://api.freeagent.com/v2/bills returned code
404. Server response: {“errors”:{“error”:{“message”:“Resource not
found”}}} (line 265)

Am I doing something wrong? This is Google Apps Script. Can it be that
my payload is not correct?

var payload = { “bill”:
{
“contact”:“https://api.freeagent.com/v2/contacts/1348499”,
“category”:"",
“reference”:csvData[13],
“dated_on”:dated_on,
“due_on”:due_on,
“total_value”:amount,
“paid_value”:"",
“due_value”:"",
“sales_tax_value”:"",
“sales_tax_rate”:“21.0”,
“status”:“Open”,
“updated_at”:"",
“created_at”:"",
“attachment”:""

}
}

Kind regards!

Met vriendelijke groet,
Riël Notermans

http://www.zzapps.nl/

Zzapps
De Zaale 11
5612 AJ Eindhoven
+31 (0)40-7114194
+31 (0)6-46348704

riel@zzapps.nl
http://www.zzapps.nl

2013/1/9 Graeme Boyd graeme.boyd@freeagent.com

Hello,

As many of you will know, FreeAgent is a Rails app and we’ve upgraded
to fix a serious bug in Rails this morning. We don’t think this will
affect the API but if you see anything amiss please get in touch.

Kind regards,

Graeme


Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog.
freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

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


You received this message because you are subscribed to the Google
Groups “FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.


You received this message because you are subscribed to the Google
Groups “FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.


Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

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


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.

Hi Riël

The following Curl command works for me:

curl -H “Authorization: Bearer TOKEN” -H “Accept: application/json” -H
“Content-Type: application/json” http://api.freeagent.com/v2/bills -X POST
-d ‘{
“bill”: {
“contact”: “https://api.freeagent.com/v2/contacts/1”,
“category”:“https://api.freeagent.com/v2/categories/285”,
“reference”: 13,
“dated_on”: “2013-01-01”,
“due_on”: “2013-01-01”,
“total_value”: 100,
“sales_tax_rate”: “21.0”,
“status”: “Draft”
}
}’

A category needs to be defined when creating a bill.

Kind regards,

GraemeOn 9 January 2013 14:37, Riël Notermans riel@zzapps.nl wrote:

Greame,

I have this error using the API:

Request failed for https://api.freeagent.com/v2/bills returned code 404.
Server response: {“errors”:{“error”:{“message”:“Resource not found”}}}
(line 265)

Am I doing something wrong? This is Google Apps Script. Can it be that my
payload is not correct?

var payload = { “bill”:
{
“contact”:“https://api.freeagent.com/v2/contacts/1348499”,
“category”:"",
“reference”:csvData[13],
“dated_on”:dated_on,
“due_on”:due_on,
“total_value”:amount,
“paid_value”:"",
“due_value”:"",
“sales_tax_value”:"",
“sales_tax_rate”:“21.0”,
“status”:“Open”,
“updated_at”:"",
“created_at”:"",
“attachment”:""

}
}

Kind regards!

Met vriendelijke groet,
Riël Notermans

http://www.zzapps.nl/

Zzapps
De Zaale 11
5612 AJ Eindhoven
+31 (0)40-7114194
+31 (0)6-46348704

riel@zzapps.nl
http://www.zzapps.nl

2013/1/9 Graeme Boyd graeme.boyd@freeagent.com

Hello,

As many of you will know, FreeAgent is a Rails app and we’ve upgraded to
fix a serious bug in Rails this morning. We don’t think this will affect
the API but if you see anything amiss please get in touch.

Kind regards,

Graeme


Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

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


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.


You received this message because you are subscribed to the Google Groups
“FreeAgent API” group.
To post to this group, send email to freeagent_api@googlegroups.com.
To unsubscribe from this group, send email to
freeagent_api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/freeagent_api?hl=en.

Graeme Boyd
Senior Software Engineer

Web. freeagent.com http://www.freeagent.com/ Blog. freeagent.com/blog
Twitter. @freeagent https://twitter.com/#!/freeagent Facebook.
facebook.com/freeagentapp

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