2

I'm currently writing an WebApi endpoint that is to accept image uploads with associated Descriptions and titles. I want to be able to send this information up in one post rather than sending the image and then the meta data in a subsequent call.

The client sending this is a mobile application written in Xamarin.

Searching the internet I struggled to fine any direction to doing this kind of thing although I'm sure it's possible.

Any help or pointers would be appreciated.

dreza
  • 3,605
  • 7
  • 44
  • 55
  • do you want to upload the image with embedded metadata? Or do you need to extract the metadata and pass it as explicit arguments to the service? It might help if you posted the signature of the service you're using – Jason Oct 18 '17 at 20:01
  • I haven't got the service signature yet as that's what I'm not sure how to do. It doesn't have to be metadata but I just want a way to be able to pass up other data when I post the image at the same kind. could be as query parameters or anything I guess. Metadata might be a red herring I guess it's just data associated with the image – dreza Oct 18 '17 at 21:02
  • just create an endpoint that accepts a byte[] for the image data, then additional parameters for whatever additional parms you want to send – Jason Oct 18 '17 at 21:04
  • Really, it's that simple? I assume then that that data is posted in the body of the request. Would it have to be serilized to a string i.e. json or using some other format? – dreza Oct 18 '17 at 21:10
  • I'm not a WebAPI expert, you should be able to do something like that. It would have to be a POST due to the size of the image. See https://stackoverflow.com/questions/32184360/post-byte-array-to-web-api-server-using-httpclient – Jason Oct 18 '17 at 21:13

1 Answers1

2

USE CLOUDINARY

upload image to cloud with easy api like

https://res.cloudinary.com/demo/image/upload/w_150,h_150,c_thumb,g_face,r_20,e_sepia/l_cloudinary_icon,,x_5,y_5,w_50,o_60,e_brightness:200/a_10/front_face.png

The DotNet SDK is here

and a tutorial to add metadata along

Rohit Kumar
  • 1,777
  • 2
  • 13
  • 26