Creating Journal Entries with Accounting Code >599 - "resource not found"!?


#1

Any ideas as to why we can create Journal Entries with any Accounting Category up to 599, but after that, FreeAgent returns “resource not found”?

We’ve tried with & without Accounting Category sub-accounts.
We can pull all the accounting categories defined and everything looks hunky dory.

But, if an accounting category from 600 up is used when creating a Journal Entry, FreeAgent returns the error message. “Resource not found”.

Confusingly, the API documentation says the following nominal codes are supported

001 to 049: Income
100 to 199: Cost of Sales
200 to 399: Admin Expenses

But, we can successfully use 400 to 599 too, with the desired effect.

Is this an API bug, or pilot error?


#2

Hi captgiro,

Ewa here from the Engineering Team at FreeAgent — thanks for your message on our forum and I’ll do my best to help out.

So that I can locate your requests in our logs, and hopefully spot the problem, could I ask that you provide some additional information from the list below?

The name of your app (as registered in Dev Dashboard)
Timestamps of your requests (in UTC)
[Optionally] The IP(s) from which your requests are being sent
Which environment are you querying? (production or sandbox)?

Thanks,

Ewa


#3

Hello Ewa,

Thanks for following up. I just recreated the problem this morning, to ensure I have the data you requested…

App name in Dev Dashboard: “F3LAB” (I changed it this morning, so should be easy to find in your logs)
Timestamps: I don’t access to transaction log for micro-precision, but I just ran two tests today at 09:33 and 09:34 UTC (according to my PC browser’s time)
IPs: I can let you know privately. Not posting to public forum.
FreeAgent Environment: Production
FreeAgent login url: f3lab2005.freeagent.com

Test 1: Attempted to create Journal Entry for “Computer Equipment Purchase”, code 602-1
Test 2: Attempted to create Journal Entry for “Dividend”, code 908"


#4

Hi captgiro,

Thanks for providing this additional information – that should be plenty for me to go on. I’ll do a bit of digging and get back to you with my findings as soon as I can.

Best wishes,

Ewa


#5

Hi again @captgiro,

Thanks a lot for your patience while I was investigating the problems you encountered with creating journal entries in certain accounting categories :pray:

You should be able to successfully create journal entries in most categories with codes over 600 by including the base code in the category uri (e.g. the VAT category would be represented as "category":"https://api.freeagent.com/v2/categories/817" in your request body). When you need to post an entry to a category with a sub-account, rather than include the sub-code in the uri, our API expects you to specify the linked resource separately (see documentation for additional journal entry attributes here). For example, when posting to one of the user categories (900-910), your payload should include the following:

 "category":"https://api.freeagent.com/v2/categories/{base code}",
 "user":"https://api.freeagent.com/v2/users/{user id}",

FreeAgent will then infer the correct sub-account code for the user you specified in your request.

The exception to this would be capital asset categories which require a sub-code (601-607). As far as I can tell, and for reasons now deeply buried in our git history, support for passing in a sub-code for those has never been implemented. I’ve opened an issue report to document this problem, which is currently being triaged by our Engineers. Thank you very much for taking the time to highlight this issue and, as soon as I have an update, I’ll make sure to let you know on this thread.

All best,

Ewa


#6

Ok. Thanks for your speedy feedback Ewa. We’ll work on your suggestions. Creating VAT-related Journal Entries does indeed already work in our app (as neither sub-code nor user resource are required). We can solve the problems with Categories that do need a User resource (which explains the “Resource not found” message back from FreeAgent and can document for our users accordingly) and we’ll revert to not using subcodes to try the Capital Asset categories again.


#7

Hi Ewa, We’ve solved half the problem, by reverting to retrieving accounting categories WITHOUT sub-codes, and added a “User” attribute for journal items that need it. (We were mislead by the way FreeAgent API returns category descriptions with sub-codes ON).

So, we can now successfully create people-centric journal entries for Dividend, Director Loan Account, etc. Hoorah.

But, journal entries, that use sub-codes in the FreeAgent GUI (eg. Capital Assets), still return a “resource not found” error via the API, even though we’re not using sub-codes in the app. What is the resource that’s missing? Or, is it an incomplete API? You mentioned sub-codes had not been implemented in the API (even though we’re not using them).

We just ran a few tests, against live, you should find in your logs. App name: “F3LAB Pro”. Executed around 17:04 (BST). So, 16:04 in UTC.


#8

Hi @captgiro,

Great to here that you were able to resolve some of the problems with creating journal sets via our API. As for capital asset categories, you’re right in suspecting our API is at fault here – categories 601-607 must be used with a sub-code, but we don’t currently provide you with a way to pass an individual capital asset type as a resource just like a user or stock item. I’ve raised it with the team as an issue we’ll need to fix, as at the moment you won’t be able to create journal entires in those categories via the API. I’m hoping to be able to roll out a fix for this farily soon, so please watch this space!

Best wishes,

Ewa


#9

Could you please post an update here when the fix is deployed - then I’ll get a notification (and anyone else that cares will see a conclusion to this thread too). Thanks.


#10

Hi @captgiro,

I’m pleased to let you know I’ve just deployed a couple of changes to our API to allow creation of journal sets in capital asset categories requiring a sub-code (601-607). We’ve added a new endpoint for Capital Asset Types which will allow you to retrieve the URIs to the resources you’ll need to pass to the capital_asset_type attribute in journal sets (see updated documentation for journal entires here). You’ll notice that this follows the same pattern to the user and stock item categories to ensure consistency.

I hope this helps, but please let me know if you have any further questions.

Best wishes,

Ewa


#11

Thanks Ewa, We’ll give it a whirl and report back… //Greg