This example will process the password request for the logon token with Id = c87d4293-60f1-48ca-ba62-389ef059cffc, and new password "1234"
C# Java JavaScript
using System.Net;
using System.Net.Http;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Web.Script.Serialization;
...
using (HttpClient httpClient = new HttpClient())
{
string url = "http://localhost:8004/API/LogOn/ResetPassword/a7021185-dcf1-430b-92a2-2bb47c8c0132/";
// Define the request body
HttpContent requestBody = null;
requestBody =
new StringContent(@"
{
""password"": ""1234""
}
",Encoding.UTF8,"application/json");
using (var response = httpClient.PutAsync(url, requestBody).Result)
{
if(response.StatusCode == HttpStatusCode.OK)
{
Console.WriteLine("Success");
}
}
}
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.apache.http.entity.StringEntity;
import org.json.JSONObject;
...
HttpClient httpClient = HttpClientBuilder.create().build();
String url = "http://localhost:8004";
String requestUrl = "http://localhost:8004/API/LogOn/ResetPassword/a7021185-dcf1-430b-92a2-2bb47c8c0132/";
// Define the Request Method.
HttpPut requstMethod = new HttpPut(requestUrl);
// Define the Request Body.
StringEntity input =
new StringEntity(
"{"
+ " \"password\": \"1234\" "
+ "}"
);
input.setContentType("application/json");
requstMethod.setEntity(input);
HttpResponse response =
httpClient.execute(requstMethod);
if(response.getStatusLine().getStatusCode() == 200)
{
System.out.println("Success");
}
var dataObject =
{
"password": "1234"
};
$.ajax({
type: "PUT",
url: baseUrl + "/API/LogOn/ResetPassword/a7021185-dcf1-430b-92a2-2bb47c8c0132/",
data: dataObject,
success: function(data) {
// data = A status of 200 for success,
// otherwise the error code and the error
// details.
},
error: function(data) { alert('failed' + data); }
});