pi_web_api_cs_helper.PIWebAPIClient.GetAsync C# (CSharp) Method

GetAsync() public method

Async GET request. This method makes a HTTP GET request to the uri provided and throws an exception if the response does not indicate a success.
public GetAsync ( string uri ) : Task
uri string Endpoint for the GET request.
return Task
        public async Task<dynamic> GetAsync(string uri)
        {
            HttpResponseMessage response = await _client.GetAsync(uri);
            
            dynamic content = await response.Content.ReadAsAsync<JToken>();
            if (!response.IsSuccessStatusCode)
            {
                var responseMessage = "Response status code does not indicate success: " + (int)response.StatusCode + " (" + response.StatusCode + " ). ";
                throw new HttpRequestException(responseMessage + Environment.NewLine + content);
            }
            return content;
        }