gtb: pwd change, register

This commit is contained in:
Stoyan Zlatev
2024-02-20 12:17:07 +01:00
parent a90459f5d4
commit 3110e3a051
72 changed files with 1927 additions and 981 deletions
+34 -1
View File
@@ -321,7 +321,40 @@ namespace Xylem.Common.Logic.SoftwareAccessHelper
}
}
public static IRestResponse PutAsJson(this Object json, String url, Action<RestRequestHeaders> headersHandler = null, Int32? timeoutMs = null)
{
try
{
var client = new RestClient(url);
var request = new RestRequest(Method.PUT);
var headers = new RestRequestHeaders(request)
{
ContentType = "application/json",
Accept = "application/json"
};
headersHandler?.Invoke(headers);
if (json != null)
{
request.AddJsonBody(json);
}
ServicePointManager.Expect100Continue = false;
return client.Execute(request);
}
catch (Exception error)
{
return new RestResponse
{
StatusCode = HttpStatusCode.InternalServerError,
Content = error.ToString()
};
}
}
/// <summary>
/// Web request
/// </summary>