NEST API:使用Rest服务:在DNS缓存中找不到主机名

时间:2015-02-05 06:22:21

标签: curl dns nest-api

我们正在关注“https://developer.nest.com/documentation/cloud/how-to-auth”链接,以访问Google嵌套中的恒温器详细信息。

我们能够执行第2步以获取授权凭据(PIN),并执行步骤3交换访问令牌的授权码。 下面给出了步骤3的日志,我们从谷歌服务器获取访问令牌

    ====================Requesting Nest server for Access Token==============
    root@buildsys:~# curl --data    'client_id=46694fbc-a66c-4e30-91bd-ce8f4a58258d&code=JKL2369W&client_secret=ULVfZ3xYZvxOWHgtLLe5gUqAe&grant_type=authorization_code'  https://api.home.nest.com/oauth2/access_token
 /*Curl output for access token*/   

    {"access_token":"c.G8YcMzNFKk3STuQSx8qVSk9etBmUD5T6S2Wbq9eiDdxtyiMH34Ci6QBR8l3s1Xx1bC8u8B0lrsz55zvuYzR2vBEIdfRZCCPMc9qOAK6RDuo2EZ9uFsY9EVCVd5K24MMrFkkjyCV71SZiVuNv","expires_in":315360000}
root@buildsys:~#
    ===========================================================================

我们使用curl版本7.40,如下所示

 ====================Curl Version ======================================
    root@buildsys:~# curl --version
    curl 7.40.0 (i686-pc-linux-gnu) libcurl/7.36.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28
    Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
    Features: AsynchDNS IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP
    ======================================================================

此外,我们正在使用REST服务,我们正在使用其余示例来调用Nest API,但是在证书验证之后我们没有成功,当重定向到firebase URL时它会给出     “在DNS缓存中找不到主机名”。下面给出了相同的日志。

====================Calls to Nest API ==================================
root@buildsys:~# curl -v -L https://developer-api.nest.com/devices.json?auth="c.G8YcMzNFKk3STuQSx8qVSk9etBmUD5T6S2Wbq9eiDdxtyiMH34Ci6QBR8l3s1Xx1bC8u8B0lrsz55zvuYzR2vBEIdfRZCCPMc9qOAK6RDuo2EZ9uFsY9EVCVd5K24MMrFkkjyCV71SZiVuNv"
* Hostname was NOT found in DNS cache
*   Trying 54.243.68.228...
* Connected to developer-api.nest.com (54.243.68.228) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256
* Server certificate:
*        subject: OU=Domain Control Validated; CN=developer-api.nest.com
*        start date: 2014-04-10 21:26:03 GMT
*        expire date: 2015-04-10 21:26:03 GMT
*        subjectAltName: developer-api.nest.com matched
*        issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certs.godaddy.com/repository/; CN=Go Daddy Secure Certificate Authority - G2
*        SSL certificate verify ok.
> GET /devices.json?auth=c.G8YcMzNFKk3STuQSx8qVSk9etBmUD5T6S2Wbq9eiDdxtyiMH34Ci6QBR8l3s1Xx1bC8u8B0lrsz55zvuYzR2vBEIdfRZCCPMc9qOAK6RDuo2EZ9uFsY9EVCVd5K24MMrFkkjyCV71SZiVuNv HTTP/1.1
> User-Agent: curl/7.40.0
> Host: developer-api.nest.com
> Accept: */*
>
< HTTP/1.1 307 Temporary Redirect
< Content-Type: application/json; charset=UTF-8
< Access-Control-Allow-Origin: *
< Cache-Control: private, no-cache, max-age=0
< Location: https://firebase-apiserver02-tah01-iad01.dapi.production.nest.com:9553/devices.json?auth=c.G8YcMzNFKk3STuQSx8qVSk9etBmUD5T6S2Wbq9eiDdxtyiMH34Ci6QBR8l3s1Xx1bC8u8B0lrsz55zvuYzR2vBEIdfRZCCPMc9qOAK6RDuo2EZ9uFsY9EVCVd5K24MMrFkkjyCV71SZiVuNv
< Connection: close
< Content-Length: 0
<
* Closing connection 0
* SSLv3, TLS alert, Client hello (1):
* Issue another request to this URL: 'https://firebase-apiserver02-tah01-iad01.dapi.production.nest.com:9553/devices.json?auth=c.G8YcMzNFKk3STuQSx8qVSk9etBmUD5T6S2Wbq9eiDdxtyiMH34Ci6QBR8l3s1Xx1bC8u8B0lrsz55zvuYzR2vBEIdfRZCCPMc9qOAK6RDuo2EZ9uFsY9EVCVd5K24MMrFkkjyCV71SZiVuNv'
* Hostname was NOT found in DNS cache
*   Trying 54.87.176.38...
* connect to 54.87.176.38 port 9553 failed: Connection refused
* Failed to connect to firebase-apiserver02-tah01-iad01.dapi.production.nest.com port 9553: Connection refused
* Closing connection 1
curl: (7) Failed to connect to firebase-apiserver02-tah01-iad01.dapi.production.nest.com port 9553: Connection refused
root@buildsys:~#
============================================================

但我们可以更改恒温器的温度值并设置为离开模式,所有操作都可以在Web浏览器中执行,但在其余服务中则无法正常工作。

请帮助我解决问题。

此致 沙市。

0 个答案:

没有答案