Create New Tags
Purpose
To create new tags.
Request URL
https://www.zohoapis.com/crm/v2/settings/tags?module={module_api_name}
mmodule_api_name - The API name of the module
Request Method
POST
Scope
scope=ZohoCRM.settings.all
(or)
scope=ZohoCRM.settings.tags.{operation_type}
| Possible operation types |
|---|
| ALL - Full data access WRITE - Edit tag data CREATE - Create tag data |
Parameters
| Parameter Name | Data Type | Description |
|---|---|---|
| module (mandatory) | String | Specify the API name of the module such as Leads, Contacts, Accounts, Deals, etc,. |
Sample Request
In the input, @createnewtag.json contains the sample input data.
curl "https://www.zohoapis.com/crm/v2/settings/tags?module=Contacts"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@createnewtag.json" Sample Input
{
"tags": [
{
"name": "Chems"
},
{
"name": "Agricultural"
}
]
} Sample Response
{
"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"
}
}
]
} Sample Request
ZCRMModule moduleIns = ZCRMModule.getInstance("Leads"); //module api name
List<ZCRMTag> tags = new ArrayList<ZCRMTag>();
ZCRMTag tag1 = ZCRMTag.getInstance();
tag1.setName("Name1");
ZCRMTag tag2 = ZCRMTag.getInstance();
tag2.setName("Name2");
tags.add(tag1);
tags.add(tag2);
BulkAPIResponse response = moduleIns.createTags(tags); //tags - list of ZCRMTag instances filled with required data for create.
List<ZCRMTag> insertedTags = (List<ZCRMTag>) response.getData(); //insertedTags - list of ZCRMTag instances
List<EntityResponse> entityResponses = response.getEntityResponses(); //entityResponses - list of EntityResponse instance Sample Input
{
"tags": [
{
"name": "Name1"
},
{
"name": "Name2"
}
]
} Sample Response
{
"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"
}
}
]
} Sample Request
def create_tags(self):
try:
record = ZCRMModule.get_instance("Leads")
tag1 = ZCRMTag.get_instance()
tag1.name = "Sample3"
tag2 = ZCRMTag.get_instance()
tag2.name = "Sample4"
tags = []
tags.append(tag1)
tags.append(tag2)
response = record.create_tags(tags)
print(response.status_code)
print(response.response_json)
except ZCRMModule as ex:
print(ex.status_code)
print(ex.error_message)
print(ex.error_code)
print(ex.error_details)
print(ex.error_content) Sample Input
{
"tags": [
{
"name": "Name1"
},
{
"name": "Name2"
}
]
} Sample Response
{
"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"
}
}
]
} Sample Request
/** Create New Tags */
$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 - array of ZCRMTag instances
$tagsArray=$bulkAPIResponse->getData(); //$tagsArray - array of ZCRMTag instances Sample Input
{
"tags": [
{
"name": "Chems"
},
{
"name": "Agricultural"
}
]
} Sample Response
{
"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"
}
}
]
} Sample Request
ZCRMModule moduleIns = ZCRMModule.GetInstance("Leads"); //module api name
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 - list of ZCRMTag instances filled with required data for create.
List<ZCRMTag> insertedTags = response.BulkData; //insertedTags - list of ZCRMTag instances
List<EntityResponse> entityResponses = response.BulkEntitiesResponse; //entityResponses - list of EntityResponse instance Sample Input
{
"tags": [
{
"name": "Chems"
},
{
"name": "Agricultural"
}
]
} Sample Response
{
"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"
}
}
]
}