Resource not Found when requesting an Access Token


#1

Hi!,

I’m a new customer at your service. We are really interested in using your
API access to “sync” our generated invoices to our customers in our
FreeAgent account.

When trying to request an AccessToken as described here:
https://dev.freeagent.com/docs/oauth

With this call (taken from httpbin.org):

{

“args”: {},

“data”: “”,

“files”: {},

“form”: {

"client_id": "5A0G2SuaZXdvTacOPhGJnQ", 

"client_secret": "**************", 

"code": "1L1pH3qn9P55ECKDSDcAEecL3P2b-mziPFRaC4-zs", 

"grant_type": "authorization_code"

},

“headers”: {

"Accept": "application/json", 

"Accept-Encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", 

"Authorization": "Basic *************************", 

"Content-Length": "209", 

"Content-Type": "application/x-www-form-urlencoded", 

"Host": "freeagent.com", 

"User-Agent": "Faraday v0.9.2"

},

“json”: null,

“origin”: “79.108.249.95”,

“url”: “https://api.freeagent.com/v2/token_end_point

}

At the “Authorization” header I’m using this Ruby
method: Base64.strict_encode64("#{ENV[‘FREE_AGENT_OAUTH_ID’]}:#{ENV[‘FREE_AGENT_OAUTH_SECRET’]}")

Trying to access my data at the account
https://timppro.freeagent.com/company/users/433746/edit admin@timp.pro
with the Dev account for the App https://dev.freeagent.com/apps/2197

What am I doing wrong? I’m really sorry to take your time with this, but
I’m really stuck with the docs!

Thanks so much in advance.

Best regards.


#2

Hi Santiago,

It looks like you’re nearly there but you’ve got a typo in the URL you’re
hitting. The correct URL to use to exchange an authorization code for an
access and refresh token is https://api.freeagent.com/v2/token_endpoint,
(not token_end_point). The API responds to messages using the standard HTTP
status codes https://en.wikipedia.org/wiki/List_of_HTTP_status_codes.,
thus a 404/Resource Not Found response means that the API couldn’t find a
valid entity at this location. If you see it again we’d recommend checking
the URI, and then checking any of the IDs you’re sending. Hopefully with
this small change it should all be working. Let us know if you have any
more problems.

Kind regards,
Harry

Regards,
Harry MillsOn Tue, May 17, 2016 at 7:35 AM, Santiago Ruiz santi@timp.pro wrote:

Hi!,

I’m a new customer at your service. We are really interested in using your
API access to “sync” our generated invoices to our customers in our
FreeAgent account.

When trying to request an AccessToken as described here:
https://dev.freeagent.com/docs/oauth

With this call (taken from httpbin.org):

{

“args”: {},

“data”: “”,

“files”: {},

“form”: {

"client_id": "5A0G2SuaZXdvTacOPhGJnQ",

"client_secret": "**************",

"code": "1L1pH3qn9P55ECKDSDcAEecL3P2b-mziPFRaC4-zs",

"grant_type": "authorization_code"

},

“headers”: {

"Accept": "application/json",

"Accept-Encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3",

"Authorization": "Basic *************************",

"Content-Length": "209",

"Content-Type": "application/x-www-form-urlencoded",

"Host": "freeagent.com",

"User-Agent": "Faraday v0.9.2"

},

“json”: null,

“origin”: “79.108.249.95”,

“url”: “https://api.freeagent.com/v2/token_end_point

}

At the “Authorization” header I’m using this Ruby
method: Base64.strict_encode64("#{ENV[‘FREE_AGENT_OAUTH_ID’]}:#{ENV[‘FREE_AGENT_OAUTH_SECRET’]}")

Trying to access my data at the account
https://timppro.freeagent.com/company/users/433746/edit admin@timp.pro
with the Dev account for the App https://dev.freeagent.com/apps/2197

What am I doing wrong? I’m really sorry to take your time with this, but
I’m really stuck with the docs!

Thanks so much in advance.

Best regards.


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


#3

Hi again Harry.

Thanks so much… I was hours trying to discover the problem… was so hard
to detect!

Best regards and all the best!El martes, 17 de mayo de 2016, 14:25:06 (UTC+2), Santiago Ruiz escribió:

Hi!,

I’m a new customer at your service. We are really interested in using your
API access to “sync” our generated invoices to our customers in our
FreeAgent account.

When trying to request an AccessToken as described here:
https://dev.freeagent.com/docs/oauth

With this call (taken from httpbin.org):

{

“args”: {},

“data”: “”,

“files”: {},

“form”: {

"client_id": "5A0G2SuaZXdvTacOPhGJnQ", 

"client_secret": "**************", 

"code": "1L1pH3qn9P55ECKDSDcAEecL3P2b-mziPFRaC4-zs", 

"grant_type": "authorization_code"

},

“headers”: {

"Accept": "application/json", 

"Accept-Encoding": "gzip;q=1.0,deflate;q=0.6,identity;q=0.3", 

"Authorization": "Basic *************************", 

"Content-Length": "209", 

"Content-Type": "application/x-www-form-urlencoded", 

"Host": "freeagent.com", 

"User-Agent": "Faraday v0.9.2"

},

“json”: null,

“origin”: “79.108.249.95”,

“url”: “https://api.freeagent.com/v2/token_end_point

}

At the “Authorization” header I’m using this Ruby
method: Base64.strict_encode64("#{ENV[‘FREE_AGENT_OAUTH_ID’]}:#{ENV[‘FREE_AGENT_OAUTH_SECRET’]}")

Trying to access my data at the account
https://timppro.freeagent.com/company/users/433746/edit admin@timp.pro
with the Dev account for the App https://dev.freeagent.com/apps/2197

What am I doing wrong? I’m really sorry to take your time with this, but
I’m really stuck with the docs!

Thanks so much in advance.

Best regards.