Create Invoice Issue - 302 Found Response

I wonder if someone can help me with an issue?

When I call POST /v2/contacts I get a 201 response with the created contact, but when I follow the API docs for creating an invoice at POST /v2/invoices, I get a 302 response (full body below).

The GET /v2/invoices call works, and I’m passing the same headers and the correct json body.

The body of the response is
<html><body>You are being <a href="https://api.sandbox.freeagent.com/sessions/new">redirected</a>.</body></html>

Thanks in advance!

David.

For anyone else experiencing this issue…

After much trial and error, and some 404 responses, I eventually got the API call to work.

I can’t understand 100% what the issue and fix was, but it would seem that the POST /invoices call has poor error handling / responses.

David.

Hi, I am also experiencing the same 302 You are being redirected. error when trying to create an expense.
This was working fine probably a month ago.
This is also working on one of our test machines.
Is this related to TLS 1.0 retirement or something similar?

Hi @Prasanth25, this issue has now been resolved via the support request you raised, and I just wanted to mention it here for visibility to other users of the API.

We found that you were passing an invalid category in the parameters of the request when attempting to create an expense. Substituting this category for a valid one fixed the problem.

To get a list of all the categories that are available (valid) for a company in FreeAgent, you can query the categories endpoint, as outlined in the docs here:
https://dev.freeagent.com/docs/categories#list-all-categories

The root of the problem here, is that the response (302 found) for this invalid request, is neither correct nor helpful. This issue has been formally reported within FreeAgent and is currently being triaged by our engineers.