Can't access certain resources

I’ve got myself up and running with the FreeAgent API and can successfully access several resources e.g. Projects, Customers and Invoices. However, I can’t access Tasks or Users - whenever I try to access those resources e.g., I just get back an error as a JSON document with the message “Resource not found”. What am I doing wrong?

Hi, Isaac.

Terribly sorry about the delay in responding.

The first thing you’ll want to do is verify that the user you’re using to make these calls has access to those two resources. Tasks has a minimum access level of Time (level 1) and Users of Tax and Limited Accounting (level 7).

Once you’ve done that, to verify you do indeed have access to the resources you’re attempting to, could you do two things for me? In an email to FreeAgent Support, please include your App’s oauth identifier (so I can find your app) and the resource type and associated ids that you’re attempting to access. Also, please let Support know to pass this info on to me (I’ve told them to expect it).

If you’d like to also include the code you’re using, you can do that as well but since it’s working for the other resources, I’ll assume for now that’s unnecessary.

Appreciate your patience,

Pat George, FreeAgent

Hi Pat. Thanks for getting back to me. How can I know what level of access the user I’m accessing with has? I basically created a Client ID a long time ago using the instructions on the FreeAgent docs site - I can’t even remember the exact steps I followed to make it. I personally definitely do have access - I’m the admin of my FreeAgent account - but not sure what “account” my code is impersonating as or what access level it has. How can I find this out?

Ok, then permissions is (almost definitely) not going to be the issue. When you create a new company the user that’s created is a level 8 account owner. Assuming that’s the user you authenticated the API against, you should be fine.

One thing to check is that your HTTP verb is correct. You will get the “resource not found” error if you, for example, do a PUT to an endpoint that’s expecting a GET (like /users or /tasks).

If you’d like to post your code here (with any oauth tokens redacted) we can check it out.


Sorry about the delay in replying. Here’s an oldish sample of the sort of code we’re using: From what I can see, the Tasks endpoint is a GET just like all the others, so I’m not sure what’s different there really.

If you need, I can create a smaller repro than the full code sample there.


Hi, Isaac.

While my F# isn’t great, it does look like you’re doing a GET. At this point I’d start from the simplest test case and write a cURL request to your resource with your token. Basically just plug your token in here and see if this works:

curl -H "Authorization: Bearer YOUR_TOKEN" -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET

1 Like

That worked. And now I’ve gone back through my code, I can see that I was incorrectly building up the URLs for Tasks and Users by pasting the “full” endpoint in twice so I was trying to access which is obviously nonsense. I’ve fixed that and it seems to now be working.

Thanks for the sanity check and your help!

Hey, that’s great! Thanks for the update, Isaac!