未找到Google IoT-core v1 API发现

时间:2018-04-15 10:58:12

标签: devops google-cloud-iot

我在尝试从远程服务器(托管在Digital Ocean上)访问google iot-core API时遇到了一些问题。同一段代码可以在我的本地机器上运行,我确保即使是服务密钥也是一样的,但是没有明确的信息指出我在一些方向上。

我不确定这是否是发现API的问题,因为我可以使用下面的curl命令在我的本地计算机上获得正确的响应但是当我尝试在我的远程服务器上执行此操作时,它返回了404错误。以前有人经历过这个吗?

word = [c.lower() for c in "No, it can assess an action." if c not in ',. !?']
print(word == word[::-1])  # True as well

1 个答案:

答案 0 :(得分:1)

Google Cloud IoT API endpoint is: https://cloudiot.googleapis.com/

The current version is v1 and it is available here: https://cloudiot.googleapis.com/v1

The discovery doc for this API and this version is: https://www.googleapis.com/discovery/v1/apis/cloudiot/v1/rest

You may find Google API Explorer a useful tool too: https://developers.google.com/apis-explorer/#p/

Here is the API Explorer result for Cloud IoT API v1: https://developers.google.com/apis-explorer/#search/cloudiot/cloudiot/v1/

Even with these endpoints, you will need to authenticate your curl requests before they succeed.

I strongly encourage you to consider using Google's SDKs (Libraries) for interaction with any Google service and for Cloud IoT for service management (munging registries, devices etc.).

Once your configuration is established, your devices should use either MQTT or HTTP.

Hope this helps!