Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3663

How do I upload a file with metadata using a REST web service?

$
0
0

I have a REST web service that currently exposes this URL:

http://server/data/media

where users can POST the following JSON:

{"Name": "Test","Latitude": 12.59817,"Longitude": 52.12873}

in order to create a new Media metadata.

Now I need the ability to upload a file at the same time as the media metadata. What's the best way of going about this? I could introduce a new property called file and base64 encode the file, but I was wondering if there was a better way.

There's also using multipart/form-data like what a HTML form would send over, but I'm using a REST web service and I want to stick to using JSON if at all possible.


Viewing all articles
Browse latest Browse all 3663

Trending Articles