How to upload file using loopback api explorer?
Asked Answered
S

3

6

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.

Speciosity answered 8/9, 2015 at 5:26 Comment(2)
Have you looked into the Loopback Storage component? docs.strongloop.com/display/public/LB/Storage+componentSorgo
If your on Mac you can also git Paw a go paw.cloud see the documenation on file upload/multipart body paw.cloud/docs/getting-started/…Chippy
S
4

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.

Shockproof answered 18/8, 2016 at 17:20 Comment(0)
C
1

You can test it with something like POSTMAN.

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

Cordilleras answered 18/10, 2016 at 3:0 Comment(0)
G
1

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

Grounds answered 25/1, 2017 at 14:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.