Example scenario,

API endpoint for a Product with Product information as JSON data and there can be 0 to n number of binary Images.

Currently we upload as Binary file, with both Image and JSON data through /v1/products POST method.

Is this right way? or what are other approaches I can try out, to make a more simple Restful endpoint.

so once a retrieve data using GET /v1/products/:productID

{ "id":"123", "name":"product name", imgUrls:["pathToImage1","pathToImage2"]}


  1. Single API Call


  1. Product actually need Image URL not binary files itself, POST and GET payload looks different, am I deviating REST principles?
  2. As Binary files are getting uploaded, it is not easy to do a POST from simple Rest tools like POSTMAN or similar tools

Alternate approach

Upload Images separately and get the Image URL and later on Product payload, refer the URL


  1. GET and POST API looks the same
  2. Simple to invoke POST API from POSTMAN and others


  1. Multiple API call.

1 Answer 1


Use the second approach, as image data is a completely different media type than JSON application data. The second API call doesn't matter at all in this context but you gain a lot of cleanliness and stability. In addition, if you separate the application RESTful service from the media service which only serves static data you may be able to scale much easier.

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.