Send list of files through POST request
See original GitHub issueHi again,
I have a use case that does not seem totally covered by the current API, but I’m pretty sure it could do it:
Given a json describing a list of files (for each an URL and path) and a main
.tex
file, compiles the PDF
Why not use laton
?
Well, this is fine to use on a terminal for compiling docs, but this is not so great when interfacing direcly in other programs. In this case, an HTTP interface is always better:
- doesn’t require to install the script;
- doesn’t require to call an external command;
- Rest APIs are the dominant integration way of nowadays and are predominents.
Ok, then, why not use the tar
interface?
Having our program that creates a tar
for each compilation is not very convenient and makes the process heavy. Again this is well when done under the wood by the laton
script while workin on the terminal.
From an app that gather many files to be included (and manages itself to host them on public URLs), it is more straightforward to just construct the json payload describing these files and POST
it to the service endpoint. For text files, we could even pass them directly in the payload.
POST API
Actually I found the clsi-sharelatex API well done on this part.
Using a POST
method with a json payload allow us to easily pass a list of files (would be a bit clumsy to do with GET
query string parameters) and may not be that hard to interpret server-side:
POST /compile
{
"command": "xelatex",
"target": "main.tex",
"resources": [
{
"path": "main.tex",
"content": "\\documentclass{article}\n\\begin{document}\nHello World\n\\end{document}"
},
{
"path": "image.png",
"url": "www.example.com/image.png"
}
]
}
It could then return a taskId
as it does with any GET
call.
I think this is what the /data
method do, but taking a tar instead of a json giving instructions on how to get the files.
The main question is: do you intend the service to be mainly used by humans? Or are integration on other apps are also an use case you want to support?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
@yegor256 if you’d like to try an API with multiple documents, you can look at Latex-On-HTTP
There is an open alpha of the API you can use https://latex.ytotech.com. I use it myself as an alternative of latex-online when I need something more Rest API oriented than CLI-oriented (latex-online works really great for that!).
Note the API may change and there may not be as much packages as you need.
Also may be an alternative for #51 #42.
@yegor256 unfortunately no ETA for this