question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Send list of files through POST request

See original GitHub issue

Hi 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

Basically this is #12 and #6.

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:open
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
MonsieurVcommented, Apr 17, 2019

@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.

0reactions
aslushnikovcommented, Apr 8, 2019

@yegor256 unfortunately no ETA for this

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to send a list of files via post to a rest service? [duplicate]
I would like an example of how to implement a client that is able to send a list of files all in one...
Read more >
File Uploads - Django documentation
Note that request.FILES will only contain data if the request method was POST , at least one file field was actually posted, and...
Read more >
How to Upload Files with Python's requests Library
In this tutorial, we will take a look at how to upload files using Python's requests library. The article will start by covering...
Read more >
Postman Tutorial - Upload a file with POST Request - YouTube
In this video we will learn different ways to upload a file with a Post Request in PostmanFound this video interesting - Please...
Read more >
Part 9 - Rest Assured - File Upload - multipart/form-data Request
Part 9 - Rest Assured - POST Request - File Upload ... Learn API Testing using Postman https://www.youtube.com/playlist? list.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found