Hi,
When I removed an user from organization, restsharp throws me this error : response.ErrorException = {“Invalid JSON string”}, even when the user has been removed successfully
I think the problem is with the deserialization but I’m not sure. Can someone help me? this is kind of urgent
this is the method to remove the user:
string[] accountIds = users.Select(user => user.AccountId).ToArray();
RestRequest request = new RestRequest($"/rest/servicedeskapi/organization/{organizationId}/user", Method.DELETE);
request.AddJsonBody(new { accountIds = accountIds});
this.client.Execute<UsersOrganizationUpdateDTO>(request);
This is the method to execute the process:
public IRestResponse<T> Execute<T>(IRestRequest request)
where T : new()
{
request.RequestFormat = RestSharp.DataFormat.Json;
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Basic " + this.encodedApiToken);
IRestResponse<T> response = this.client.Execute<T>(request);
// Check for exceptions
if (response.ErrorException != null)
{
throw new ApplicationException("Error retrieving response.", response.ErrorException);
}
return response;
}
Errors from response:
|response|"StatusCode: NoContent, Content-Type: application/json; charset=UTF-8, Content-Length: -1)"|RestSharp.IRestResponse<FVREB.JiraServiceDeskApi.Models.UsersOrganizationUpdateDTO> {RestSharp.RestResponse<FVREB.JiraServiceDeskApi.Models.UsersOrganizationUpdateDTO>}|
|ErrorException|{"Invalid JSON string"}|System.Exception {System.Runtime.Serialization.SerializationException}|
||ErrorMessage|"Invalid JSON string"|string|
||ResponseStatus|Error|RestSharp.ResponseStatus|
||Server|"AtlassianProxy/1.15.8.1"|string|