Using Make.com to use API to mark invoice as scheduled

Hi
I am trying to mark an invoice as scheduled to send via Make.com. The invoice is generated, and I can grab the invoice ID, but I get a 400 error when the Make api module is as the image. I hope this is a very simple formatting or syntax issue.

I have tried with and without the https://api.freeagent.com in the URL

Hi Barry :wave:

Welcome to our API forum! Thank you for your post.

I can see that you’re trying to use the url api.freeagent.com/v2/invoices/<id>/transitions, and passing the transition into the body of the request, but if you take a look at our documentation around updating an invoice, you can see that you need to make a PUT request to a URL which contains the transition you want to action, e.g. api.freeagent.com/v2/invoices/<id>/transitions/mark_as_scheduled, rather than passing in the transition into the body of the request.

I hope this helps, and please let me know if you have any other questions around this.

Kind regards,
Katie

1 Like

Hi

Thank you. If I use the url v2/invoices/ (the api… bit is already built into Make.com) I get a result for all invoices and individual invoices when I put in their ID, so I know that Make is talking to the account. however, as soon as I use PUT, POST or DELETE (even a simple DELETE a specific invoice for which the GET method works) it get a runtime error:

RuntimeError

[400] Invalid JSON

Origin

FreeAgent.

Is it possible the problem is at Make’s end?

Thanks, Barry

Hi Barry,

Thank you for your reply. From a test using the OAuth Google Playground, I was able to make a successful PUT request to the /transitions/mark_as_sent endpoint for my test account, so it may well be an issue on Make’s end.

If you wanted to check whether these requests work for your account via the OAuth Google Playground too, we have a quick start guide that details how to set that up and test it out. This might help to confirm whether it’s definitely an issue on Make’s side. If you’re seeing the same errors on the OAuth Google Playground, then we can look into what might be causing that to happen in your account.

I hope this helps,
Katie

This is a late reply for anyone searching in the future.
The unique ID for the invoice is returned as a fully qualified URL with the ID as the final part of the URL. An additional step is needed to extract just the ID.
I achieved this by splitting the URL into array using the / as a delimiter and then returning the last part of the array.

You also need to delete the headers then save the step. If you edit the step Make will automatically put a header back in which you’ll need to remove again.