创建标签
目的
用来创建新的标签。
请求URL
https://www.zohoapis.com.cn/crm/v2/settings/tags?module={module_api_name}
mmodule_api_name - 模块的API名称
请求方法
POST
范围
scope=ZohoCRM.settings.all
(或)
scope=ZohoCRM.settings.tags.{operation_type}
可能的操作类型 |
---|
ALL - 完全数据访问 WRITE - 编辑标签数据 CREATE - 创建标签数据 |
参数
参数名称 | 数据类型 | 描述 |
---|---|---|
module (必填) | 字符串 | 指定模块的API名称,例如Leads, Contacts, Accounts, Deals等等。 |
示例请求
在这个输入中,@createnewtag.json 包含了示例输入数据。
curl "https://www.zohoapis.com.cn/crm/v2/settings/tags?module=Contacts"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@createnewtag.json"
示例输入
{
"tags": [
{
"name": "Chems"
},
{
"name": "Agricultural"
}
]
}
示例响应
{
"tags": [
{
"code": "SUCCESS",
"message": "tags created successfully",
"status": "success",
"details": {
"created_by": {
"id": "2000000030444",
"name": "Chems"
},
"created_time": "2017-03-24T11:08:23+05:30",
"id": "2000000088041",
"modified_by": {
"id": "2000000030444",
"name": "Pharmaceutical"
},
"modified_time": "2017-03-24T11:08:23+05:30"
}
},
{
"code": "SUCCESS",
"message": "tags created successfully",
"status": "success",
"details": {
"created_by": {
"id": "2000000030564",
"name": "Agricultural"
},
"created_time": "2017-03-24T11:08:23+06:30",
"id": "2000000088041",
"modified_by": {
"id": "2000000030564",
"name": "Leather"
},
"modified_time": "2017-03-24T11:08:23+06:30"
}
}
]
}
示例请求
/** 创建标签 */
$zcrmModuleIns=ZCRMModule::getInstance("Leads");
$tags= array();
$tag = ZCRMTag::getInstance();
$tag->setName("Name11");
array_push($tags, $tag);
$tag = ZCRMTag::getInstance();
$tag->setName("Name21");
array_push($tags, $tag);
$bulkAPIResponse = $zcrmModuleIns->createTags($tags); //$tags - ZCRMTag实例数组
$tagsArray=$bulkAPIResponse->getData(); //$tagsArray - ZCRMTag实例数组
示例输入
{
"tags": [
{
"name": "Chems"
},
{
"name": "Agricultural"
}
]
}
示例响应
{
"tags": [
{
"code": "SUCCESS",
"message": "tags created successfully",
"status": "success",
"details": {
"created_by": {
"id": "2000000030444",
"name": "Chems"
},
"created_time": "2017-03-24T11:08:23+05:30",
"id": "2000000088041",
"modified_by": {
"id": "2000000030444",
"name": "Pharmaceutical"
},
"modified_time": "2017-03-24T11:08:23+05:30"
}
},
{
"code": "SUCCESS",
"message": "tags created successfully",
"status": "success",
"details": {
"created_by": {
"id": "2000000030564",
"name": "Agricultural"
},
"created_time": "2017-03-24T11:08:23+06:30",
"id": "2000000088041",
"modified_by": {
"id": "2000000030564",
"name": "Leather"
},
"modified_time": "2017-03-24T11:08:23+06:30"
}
}
]
}
示例请求
ZCRMModule moduleIns = ZCRMModule.GetInstance("Leads"); //模块API名称
List<ZCRMTag> tags = new List<ZCRMTag>();
ZCRMTag tag1 = ZCRMTag.GetInstance();
tag1.Name = "Name1";
ZCRMTag tag2 = ZCRMTag.GetInstance();
tag2.Name = "Name2";
tags.Add(tag1);
tags.Add(tag2);
BulkAPIResponse<ZCRMTag> response = moduleIns.CreateTags(tags); //tags - 包含创建所需数据的ZCRMTag实例列表
List<ZCRMTag> insertedTags = response.BulkData; //insertedTags - ZCRMTag实例列表
List<EntityResponse> entityResponses = response.BulkEntitiesResponse; //entityResponses - EntityResponse实例的列表
示例输入
{
"tags": [
{
"name": "Chems"
},
{
"name": "Agricultural"
}
]
}
示例响应
{
"tags": [
{
"code": "SUCCESS",
"message": "tags created successfully",
"status": "success",
"details": {
"created_by": {
"id": "2000000030444",
"name": "Chems"
},
"created_time": "2017-03-24T11:08:23+05:30",
"id": "2000000088041",
"modified_by": {
"id": "2000000030444",
"name": "Pharmaceutical"
},
"modified_time": "2017-03-24T11:08:23+05:30"
}
},
{
"code": "SUCCESS",
"message": "tags created successfully",
"status": "success",
"details": {
"created_by": {
"id": "2000000030564",
"name": "Agricultural"
},
"created_time": "2017-03-24T11:08:23+06:30",
"id": "2000000088041",
"modified_by": {
"id": "2000000030564",
"name": "Leather"
},
"modified_time": "2017-03-24T11:08:23+06:30"
}
}
]
}