As traduções são geradas por tradução automática. Em caso de conflito entre o conteúdo da tradução e da versão original em inglês, a versão em inglês prevalecerá.
Os exemplos de código a seguir mostram como usar o ListThings
.
- AWS CLI
-
Exemplo 1: listar todas os itens do registro
O
list-things
exemplo a seguir lista as coisas (dispositivos) que estão definidas no registro de AWS IoT da sua AWS conta.aws iot list-things
Saída:
{ "things": [ { "thingName": "ThirdBulb", "thingTypeName": "LightBulb", "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/ThirdBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 2 }, { "thingName": "MyOtherLightBulb", "thingTypeName": "LightBulb", "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 3 }, { "thingName": "MyLightBulb", "thingTypeName": "LightBulb", "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 1 }, { "thingName": "SampleIoTThing", "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/SampleIoTThing", "attributes": {}, "version": 1 } ] }
Exemplo 2: como listar os itens definidos que possuem um atributo específico
O exemplo de
list-things
a seguir exibe uma lista dos itens que têm um atributo chamadowattage
.aws iot list-things \ --attribute-name
wattage
Saída:
{ "things": [ { "thingName": "MyLightBulb", "thingTypeName": "LightBulb", "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyLightBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 1 }, { "thingName": "MyOtherLightBulb", "thingTypeName": "LightBulb", "thingArn": "arn:aws:iot:us-west-2:123456789012:thing/MyOtherLightBulb", "attributes": { "model": "123", "wattage": "75" }, "version": 3 } ] }
Para acessar mais informações, consulte Como gerenciar objetos com o registro no Guia do desenvolvedor do AWS IoT.
-
Para API obter detalhes, consulte ListThings
na Referência de AWS CLI Comandos.
-
Para obter uma lista completa de guias do AWS SDK desenvolvedor e exemplos de código, consulteUsando AWS IoT com um AWS SDK. Este tópico também inclui informações sobre como começar e detalhes sobre SDK versões anteriores.