Nest API에서 내 장치/구조 데이터에 대한 JSON 응답을 가져 오려고합니다. "https://developer-api.nest.com/"Nest API 401 RestSharp를 사용하는 응답 오류 C#
나는 콘텐츠 유형 및 승인 헤더 만 지정하면서 동일한 URL을 사용하여 우편 배달부를 사용하여 데이터를 검색 할 수있었습니다. 필자는 기본적으로 Postman의 코드를 내 프로그램에 복사했지만 실행시 401 오류가 발생합니다.
{"error":"unauthorized","type":"https://developer.nest.com/documentation/cloud/error-messages#auth-error","message":"unauthorized","instance":"e0a35869-6726-4192-85d5-d31482b28269"}
내가 어떤 방법으로 access_token은 인코딩해야합니까 :
var client = new RestClient("https://developer-api.nest.com/");
var request = new RestRequest(Method.GET);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("authorization", "Bearer " + access_token);
request.AddHeader("content-type", "application/json");
IRestResponse response = client.Execute(request);
여기에 응답 내용입니까?
답장을 보내 주셔서 감사합니다.
{
"devices": {
"thermostats": {
"fbk1Kr983gWp-eN-V9pxnOcTsTatUX5X": {
"humidity": 15,
"locale": "en-US",
"temperature_scale": "F",
...
API 호출의 출력 결과가 있습니까? – urman