示例#1
0
        private object CallAPI_WithParam(string url, NameValueCollection nvc, HttpMethod httpMethod)
        {
            var requestMessage = new HttpRequestMessage(httpMethod, new Uri(url + "?" + ToQueryString(nvc, true)));

            requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", JWT_WithParameter(nvc));
            var response = httpClient.SendAsync(requestMessage).Result;
            var contents = response.Content.ReadAsStringAsync().Result;

            return(JsonToDic.Convert(contents));
        }
示例#2
0
        private object CallAPI_NoParam(string url, HttpMethod httpMethod)
        {
            var requestMessage = new HttpRequestMessage(httpMethod, new Uri(url));

            requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", JWT_NoParameter());
            var response = httpClient.SendAsync(requestMessage).Result;
            var contents = response.Content.ReadAsStringAsync().Result;

            return(JsonToDic.Convert(contents));
        }