Hello community,
Im using REST API to get some info about customers, products and invoices. Everything goes ok but i dont see any information about how to generate a download link for invoices. Is it possible to do it?
I know there is a variable called _DIRECTDOWNLOAD_URL_INVOICE which need to be 1 (is it already set) but i dont know how call or generate it from API…
Thanks all!
@MatiasCostaN did you come right on this?
MatiasCostaN:
Im using REST API to get some info about customers, products and invoices. Everything goes ok but i dont see any information about how to generate a download link for invoices. Is it possible to do it?
I know there is a variable called _DIRECTDOWNLOAD_URL_INVOICE which need to be 1 (is it already set) but i dont know how call or generate it from API…
You might need to generate the document first if it is not already created. Look at /documents/builddoc in the API explorer.
Other than that I do this all the time, but I need to find my code first, and that will not be today :-/
MatiasCostaN:
Im using REST API to get some info about customers, products and invoices. Everything goes ok but i dont see any information about how to generate a download link for invoices. Is it possible to do it?
I know there is a variable called _DIRECTDOWNLOAD_URL_INVOICE which need to be 1 (is it already set) but i dont know how call or generate it from API…
Thanks all!
I have now found the time to lookup what I am doing.
I find the document share hash and append that to an url leading to my dolibarr installation.
I search using module_part = “order” and order_id
config.DOLIBARR_API_URL + “/documents?modulepart=” + modulepart + ‘&id=’ + str(order_id)
that gets me a json with 1 or more documents in it.
Then I generate the document to make sure it is there
and from the document.json I find the share and return that value.
To generate the document I call this url config.DOLIBARR_API_URL + “/documents/builddoc” in the API.