private static void addProduct(IoTDAClient client) { CreateProductRequest req = new CreateProductRequest { Body = new AddProduct() { DataFormat = "binary", Description = "this is a thermometer produced by Huawei", DeviceType = "Thermometer", Name = "Thermometer_test", ProtocolType = "CoAP", ServiceCapabilities = new List <ServiceCapability>() { new ServiceCapability() { Commands = new List <ServiceCommand>() { new ServiceCommand() { CommandName = "reboot", Paras = new List <ServiceCommandPara>() { new ServiceCommandPara() { DataType = "int", Max = "100", MaxLength = 100, Min = "1", ParaName = "force", Step = 0.1, Unit = "km/h" } }, Responses = new List <ServiceCommandResponse>() { new ServiceCommandResponse() { Paras = new List <ServiceCommandPara>() { new ServiceCommandPara() { DataType = "int", Max = "100", MaxLength = 100, Min = "1", ParaName = "force", Step = 0.1, Unit = "km/h" } }, ResponseName = "ACK" } } } }, Description = "temperature", Events = new List <ServiceEvent>() { new ServiceEvent() { EventType = "reboot", Paras = new List <ServiceCommandPara>() { new ServiceCommandPara() { DataType = "int", Max = "100", MaxLength = 100, Min = "1", ParaName = "force", Step = 0.1, Unit = "km/h" } } } }, Option = "Mandatory", Properties = new List <ServiceProperty>() { new ServiceProperty() { DataType = "decimal", Method = "R", PropertyName = "temperature" } }, ServiceId = "temperature", ServiceType = "temperature" } } } }; try { var resp = client.CreateProduct(req); Console.WriteLine(resp.HttpStatusCode); Console.WriteLine(JsonConvert.SerializeObject(resp)); } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }