Sample code for API v3.3.0

Hi -

I’d like to have a HTML webform in my website where customers type their customer_id and get their customer portal.

Does someone have some HTML sample code for this?

Regards,

You may be able to accomplish this with Zapier.

https://zapier.com/zapbook/invoice-ninja/

Dear Hillel -

Thanks for your quick response.

Unfortunately, I couldn’t get what I am lokking for with Zapier.

Basically, I’d like to have a simple HTML form that allow clients input their client_id and see their client portal.

I have the following html form:

<form method=“post” action=“https://mydomain.com/api/v1/clients”>
<input type=text name=“id_number”>
<input type=submit value=“GO”>
</form>

And it’s returning the following message:

{“error”:{“message”:“Invalid token”}}

I suppose that it is caused because of the TOKEN has to be sent by header…

Any ideas?

Regards,

You won’t be able to submit the form directly to the API, you’d need to create a back-end service (ie, a PHP script) to make the request to the API.

You can create an API token on /tokens/create, it’s very important you don’t include this token in the HTML form.

Dear Hillel -

Thank you again for your quick response.
Do you have a sample of how the scripts looks like? I am not a coder…

Regards,

Sorry, no.

You can submit a request here if you’d like to hire a developer:

https://www.thedevelopers.ro/customisation-request-invoiceninja/

I believe this should be possible using a Google Form with Zapier.