Sparsh Pipley
Sparsh Pipley

Reputation: 451

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.

Upvotes: 6

Views: 2464

Answers (3)

Marco Barcellos
Marco Barcellos

Reputation: 192

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

Upvotes: 1

MatCas
MatCas

Reputation: 843

You can test it with something like POSTMAN.

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

Upvotes: 1

richardpringle
richardpringle

Reputation: 791

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.

Upvotes: 4

Related Questions