I want to not put JSON data in the body AND use a parameter in the URI
I am able to get JSON data through by using something like this.
[WebInvoke(Method = "POST",
UriTemplate = "Checkin/SetPicture/{PatientProfileId}",
BodyStyle = WebMessageBodyStyle.Bare, // this is key for combining params with Stream
ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
Stream SetPicture(string PatientProfileId, PictureData data);
and PictureData - very simple:
[DataContract]
class PictureData {
[DataMember]
internal string Base64 { get; set; }
}
If I post something like this it works (from the REST console/client)
http://localhost:9001/Checkin/SetPicture/666
Content-Type: application/json
Body -
{ "Base64": "AAAAAA" }
If I want just the Base64 string in the body, and not JSON, how do I do it? Right now it gives a response back of "Server Error - check logs", but of course there is nothing in the log. It's a parsing issue from the contract since the class is never hit.
ie Body -
AAAAAA
Here is a related SO query but doesn't quite get me what I need.
Passing XML string in the body of WCF REST service using WebInvoke