'Can anyone tell me why my token API is returning null?

I have an API that returns some information. That API requires an access token.

Problem is the JSON is always NULL. My var response and var content is always NULL.

Here is my code - can somebody find the problem and help me please?

private void GetWorkList(string Token)
{
        SetWorkListProps();

        var client = new RestClient("http://webserver:8182/api/Labratoary/SearchWorkList");

        var request = new RestRequest();
        request.Method = Method.Post;
        request.AddHeader("Token", Token);
        request.AddJsonBody(new JsonBodyForWorkList
        {
            Id_ReceptionDetail = IdReception,
            ServiceIds = "",
            LabSectionIds = "",
            DeviceIds = DeviceId,
            PatientIds = "",
            FromDateReception = FromDateStr,
            ToDateReception = ToDatestr,
            FromTimeReception = "",
            ToTimeReception = ""
        });

        var response = client.ExecuteAsync(request);
        var content = response.Result.Content;

        var json = JsonConvert.DeserializeObject(content);
        var serializer = new JavaScriptSerializer();
}


Solution 1:[1]

I Solve That, That Was Not The API Problem It Is About RestSharp And I Use Another Method To Get My Answer From API ...

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Omid Sn