简体   繁体   中英

Update a thing in aws iot

I am working on connecting to aws-iot using java. I created a thing[supermario] in aws-iot with two attributes ["state": "false", "model":"name"]

The thing is created successfully with the name supermario and the attributes that I gave and I was able to view that in the aws console. I did this by initializing the AWSIotClient and using the class CreateThingRequest. Now I want to update this thing through java. Can I update the thing by thingname or should I have to delete the thing and create it? I saw in some code that the existing thing was deleted and then created. How can I update an attribute of this thing using Java?

This is how I created the thing.

AWSIotClient awsIotClient = this.initClient();
        CreateThingRequest createRequest = new CreateThingRequest();
        createRequest.setThingName(device.getDeviceId());
        AttributePayload attributePayload = new AttributePayload();
        attributePayload.addAttributesEntry("model", device.getModel());
        attributePayload.addAttributesEntry("state","false");
        createRequest.setAttributePayload(attributePayload);

UpdateThing API将更新事物的属性。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM