I have the following code in .NET:
// GET api/EmailValidationStaging/5
public EmailValidation GetEmailValidation(long id)
This is a GET method, I am able to call it like this:
$("#buttonFIND").click(function (e) {
e.preventDefault();
$.get("[removed for privacy]/webservice/api/emailvalidationstaging/" + $("#textRecordId").val() + "?key=key", function (json) {
$("#RecordId").val(json.RecordId);
$("#Email").val(json.Email);
$("#Validated").val(json.Validated);
$("#IsEmailCurrent").val(json.IsEmailCurrent);
$("#SentOut").val(json.SentOut);
$("#TableRecordId").addClass("showStuff");
//alert("success");
})
.fail(function () { });
});
Everything works perfectly!
Now I need to do the same thing but this time it is a POST method and I have no idea how to do that. Everything I tried fails, please can someone give me a decent answer. I need to call this method:
This is a POST method, I am calling:
// POST api/EmailValidationStaging
public HttpResponseMessage PostEmailValidation(EmailValidation emailvalidation)
Additional information:
I am using Fiddler Web Debugger (Fiddler2)
Under compose I have Parsed (Selected POST) and then url like this: [removed for privacy]/webservice/api/emailvalidationstaging/?key=key
I am using HTTP/1.1 With the following parameters:
User-Agent: Fiddler
Host:
Content-Length: 25
Content-Type: text/xml
RequestBody: {"MemberSSN":"999999999"}
The result I get is this:
HTTP/1.1 502 Fiddler - Gateway Connection Failed
Date: Thu, 21 Aug 2014 18:52:32 GMT
Content-Type: text/html; charset=UTF-8
Connection: close
Cache-Control: no-cache, must-revalidate
Timestamp: 11:52:32.933