I'm using Postman to test the endpoints of an API I'm building. Up until the point I'm at now, I've been using raw JSON to send my POST requests. I'm now trying to upload a document using Carrierwave. At first, I was uploading using Base64 encoding, and it was straightforward to do with raw JSON. However, my specifications have changed, and I need to allow our client to simply upload a file that hasn't been encoded. From my understanding, this needs to be done through multipart form data. Here's the JSON I was using:
{ "sub_order":
{ "userid": "00055294-EE7E-4596-A868-BDD5A90BB51F",
"deliveryaddressid": "89463",
"letter": "spec/test.txt",
"computergenerated": "true"
}
}
Now, when I try to use the parameters for the sub_order attributes, I get an error message:
ActionController::ParameterMissing (param is missing or the value is empty: sub_order)
Based on the Googling I've done, I have to use multipart form data to do this, I can't go with raw JSON, so my question is how do I create a nested form?
EDIT
@rudydydy is correct, using the format of sub_order[PROPERTY]
solved the puzzle.
do something like this in your postman for the params
sub_order[userid]
, sub_order[deliveryaddressid]
, and etc