At the question:
I wanted to know how in one Single HTTP request POST/ I could upload a file and send a Json. My intention was to maintain my API restful.
After some research, I came across the following answer, that basically suggests to post the metadata firstly and then post the file as multi-part, like in two separate operation, associating the two:
How do I upload a file with metadata using a REST web service?
My question is, how can I do this as an Atomic Operation in My Restful API?
Since I am having 2 steps to finish up the operation, how do I ensure I don;t process the metadata without the file, in case the second post(upload) with the file is not performed by the client?
What are my architectural choices?
I am using Play Framework 2.5 with Scala (no views, completely restful)