ClearBlade / clearblade-iot-core-migration

Go tool that migrates devices from Google IoT Core registries to ClearBlade device table
MIT License
4 stars 4 forks source link

[Create Registry] Not working as intended #8

Closed charbull closed 2 years ago

charbull commented 2 years ago

Hi,

The create registry is not working as documented in this link.

Followed the steps and downloaded the service account credentials, the documentation outlines the following curl example:

curl 'https://iot.clearblade.com/api/v/4/webhook/execute/aae9b9b30c8aa4e49081c7eeb9bb07/cloudiot?parent=projects/iot-core-test-363819/locations/us-central1' -H 'ClearBlade-UserToken: {token}' -d '{ "id": "two", "name": "two", "eventNotificationConfigs": [], stateNotificationConfig": {}, "mqttConfig": {}, "httpConfig": {}, "logLevel": "NONE", "credentials": [] }'

To reproduce:

curl 'https://iot.clearblade.com/api/v/4/webhook/execute/$0/cloudiot?parent=projects/$1/locations/us-central1' -H "ClearBlade-UserToken: ${TOKEN}" -d '{ "id": "two", "name": "two", "eventNotificationConfigs": [], stateNotificationConfig": {}, "mqttConfig": {}, "httpConfig": {}, "logLevel": "NONE", "credentials": [] }'

returned response:

Missing body OR body is not an object

Cheers.

charbull commented 2 years ago

closing there was a missing "\"" in the example with stateNotificationConfig": {}. updating the documentation would be great

charbull commented 2 years ago

getting a new error message: "error":{"code":400,"message":"The field 'device_registry.name' must be empty.","status":"INVALID_ARGUMENT"}}

clarkbynum commented 2 years ago

Hi @charbull , that's expected behavior that was added in the latest release. The registry name will be derived from the project, location, and registry ID. Is this issue blocking you?

charbull commented 2 years ago

Hi @clarkbynum what would be the updated documentation? just drop the name and the id form the request?

clarkbynum commented 2 years ago

@charbull Just drop the name from the request. Thanks for pointing that out, I went ahead and removed it from the doc

charbull commented 2 years ago

Cool ! thank you ! this worked. Feel free to close the issue when the documentation is uptdated