There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DeleteThing with an AWS SDK or CLI
The following code examples show how to use DeleteThing.
- C++
- 
            - SDK for C++
- 
NoteThere's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository . //! Delete an AWS IoT thing. /*! \param thingName: The name for the thing. \param clientConfiguration: AWS client configuration. \return bool: Function succeeded. */ bool AwsDoc::IoT::deleteThing(const Aws::String &thingName, const Aws::Client::ClientConfiguration &clientConfiguration) { Aws::IoT::IoTClient iotClient(clientConfiguration); Aws::IoT::Model::DeleteThingRequest request; request.SetThingName(thingName); const auto outcome = iotClient.DeleteThing(request); if (outcome.IsSuccess()) { std::cout << "Successfully deleted thing " << thingName << std::endl; } else { std::cerr << "Error deleting thing " << thingName << ": " << outcome.GetError().GetMessage() << std::endl; } return outcome.IsSuccess(); }- 
                    For API details, see DeleteThing in AWS SDK for C++ API Reference. 
 
- 
                    
 
- CLI
- 
            - AWS CLI
- 
             
                    To display detailed information about a thing The following delete-thingexample deletes a thing from the AWS IoT registry for your AWS account.aws iot delete-thing --thing-name "FourthBulb" This command produces no output. For more information, see How to Manage Things with the Registry in the AWS IoT Developers Guide. - 
                    For API details, see DeleteThing in AWS CLI Command Reference. 
 
- 
                    
 
- Java
- 
            - SDK for Java 2.x
- 
NoteThere's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository . /** * Deletes an IoT Thing asynchronously. * * @param thingName The name of the IoT Thing to delete. * * This method initiates an asynchronous request to delete an IoT Thing. * If the deletion is successful, it prints a confirmation message. * If an exception occurs, it prints the error message. */ public void deleteIoTThing(String thingName) { DeleteThingRequest deleteThingRequest = DeleteThingRequest.builder() .thingName(thingName) .build(); CompletableFuture<DeleteThingResponse> future = getAsyncClient().deleteThing(deleteThingRequest); future.whenComplete((voidResult, ex) -> { if (ex == null) { System.out.println("Deleted Thing " + thingName); } else { Throwable cause = ex.getCause(); if (cause instanceof IotException) { System.err.println(((IotException) cause).awsErrorDetails().errorMessage()); } else { System.err.println("Unexpected error: " + ex.getMessage()); } } }); future.join(); }- 
                    For API details, see DeleteThing in AWS SDK for Java 2.x API Reference. 
 
- 
                    
 
- Kotlin
- 
            - SDK for Kotlin
- 
NoteThere's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository . suspend fun deleteIoTThing(thingNameVal: String) { val deleteThingRequest = DeleteThingRequest { thingName = thingNameVal } IotClient.fromEnvironment { region = "us-east-1" }.use { iotClient -> iotClient.deleteThing(deleteThingRequest) println("Deleted $thingNameVal") } }- 
                    For API details, see DeleteThing in AWS SDK for Kotlin API reference. 
 
-