//此接口采用覆盖更新的策略,无则创建,有则覆盖,即用来创建、更新、删除设备分组标签 public void TestSetDeviceGroupTags() { DefaultAcsClient acsClient = Demo.IotClient.GetClient(); String groupId = "Qii3UILf2EvmeVrBMgQi010200"; SetDeviceGroupTagsRequest request = new SetDeviceGroupTagsRequest(); request.GroupId = groupId; List <Object> tags = new List <Object>(); var tag1 = new { tagKey = "h1", tagValue = "hour1" }; tags.Add(tag1); var tag2 = new { tagKey = "h2", tagValue = "hour2" }; tags.Add(tag2); string tagJson = JsonConvert.SerializeObject(tags); request.TagString = tagJson; SetDeviceGroupTagsResponse response = acsClient.GetAcsResponse(request); Console.WriteLine("Set Device Group Tags: " + response.Success); if (!(bool)response.Success) { Console.WriteLine(response.Code + ", " + response.ErrorMessage); Console.ReadKey(); return; } }
public static SetDeviceGroupTagsResponse Unmarshall(UnmarshallerContext context) { SetDeviceGroupTagsResponse setDeviceGroupTagsResponse = new SetDeviceGroupTagsResponse(); setDeviceGroupTagsResponse.HttpResponse = context.HttpResponse; setDeviceGroupTagsResponse.RequestId = context.StringValue("SetDeviceGroupTags.RequestId"); setDeviceGroupTagsResponse.Success = context.BooleanValue("SetDeviceGroupTags.Success"); setDeviceGroupTagsResponse.Code = context.StringValue("SetDeviceGroupTags.Code"); setDeviceGroupTagsResponse.ErrorMessage = context.StringValue("SetDeviceGroupTags.ErrorMessage"); return(setDeviceGroupTagsResponse); }