Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upload file using loopback api explorer?

I'm using loopback Api Explorer I need to upload a file by explore how can I upload that because I don't find any option to upload file please refer the screenshot

enter image description here.

like image 588
Sparsh Pipley Avatar asked Sep 08 '15 05:09

Sparsh Pipley


3 Answers

Simply put, the answer is that you can't. Uploading a file requires multi-part form data. This isn't currently possible via the loopback-component-explorer. You should checkout the loobpack-component-storage instead. There is an example here; I recommend using the example-2.0.

like image 59
richardpringle Avatar answered Oct 19 '22 10:10

richardpringle


You can test it with something like POSTMAN.

But, the only that you need, is the path of the file, not the file.

like image 43
MatCas Avatar answered Oct 19 '22 10:10

MatCas


Simpler than using Postman would be using curl direct on the terminal :

Here is the command I use when need(I work with some services using loopback/explorer as well) :

curl -i -X POST -H "Content-Type: multipart/form-data" -F "blob=@/path/to/your/file.jpg" -v http://HOST:PORT/pathToYourEndpoint?access_token=xxxxxxxxxxx

like image 43
Marco Barcellos Avatar answered Oct 19 '22 09:10

Marco Barcellos