1

I am trying to set up a site that will be storing a large amount of images. I am using Storage API module for that and It is working fine through web.

Now I need a REST Service to upload images. I am trying with the default file POST endpoint of the Services module:

--> POST http://example.com/api/file http/1.1
Content-Type: application/json
Content-Length: 343901
Cookie: ..............
X-Csrf-Token: .........
{"file":"iVBOR.......Jggg==","filename":"myimage.png","uri":"storage-field-images://myimage.png"}
--> END POST (343901-byte body)



<-- 200 OK http://example.com/api/file (888ms)
Content-Type: application/json
{"fid":"81","uri":"http://example.com/api/file/81"}
<-- END HTTP (74-byte body)

But http://example.com/api/file/81 is responding me:

{"fid":"81","filename":"myimage.png","uri":"public://myimage.png".........

(Not the same uri that I sent in the request)

Am I missing something in the resquest? Or do I have to develop a new endpoint to manage that?

1 Answer 1

0

replace uri with filepath

--> POST http://example.com/api/file http/1.1
Content-Type: application/json
Content-Length: 343901
Cookie: ..............
X-Csrf-Token: .........
{"file":"iVBOR.......Jggg==","filename":"myimage.png","filepath":"public://storage-field-images/myimage.png"}
--> END POST (343901-byte body)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.