Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
// Build an authenticated client object
// This pattern repeats from
AWSIot iotClient = AWSIotClientBuilder
.withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(CLIENT_TOKEN, CLIENT_SECRET)))
// Send the ListThingsRequest to AWS IoT synchronously
ListThingsResult result = iotClient.listThings(new ListThingsRequest());
List<ThingAttribute> things = result.getThings();
// Now you have access to the Thing's name, thing type, version, and a map of attributes/tags
// Get all things of a specific type
String typeName = "LightsideSensor";
ListThingsRequest listThingsRequest = new ListThingsRequest()
ListThingsResult result = AwsClientFactory.getIotClient().listThings(listThingsRequest);
List<ThingAttribute> things = result.getThings();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment