Tags - Editing and Applying Tags

Groundhogg provides the functionality to update existing tags. You can do this by using PUT/PATCH HTTP request of tags API. To update tag details tag_id of a tag is required so you need to pass tag_id in the tags section of your JSON PUT/PATCH request. The following examples update the tag we created in the add tag section.

You can also perform this operation by setting “ id_or_email” to the user id of a user and passing by_user_id = true.

URL: http://yoursite.com/wp-json/gh/v3/tags
Body:
{
	"tag_id" : "5",
	"tag_name" : "test",
	"tag_description":"Test Tag"	
}

In the above update, operation returns the following response. 

{
    "code": "success",
    "message": "Tag updated successfully."
}

Applying/Removing tags

You can apply tags by making a PUT or PATCH HTTP request to the apply or remove tag URL. It requires email id of contact or ID of contact. id_or_email and tags are the require arguments while making this request.

You can also perform this operation by setting “id_or_email” to the user id of a user and passing by_user_id = true.

URL to Apply Tags: http://yoursite.com/wp/wp-json/gh/v3/tags/apply
URL to Remove Tags: http://yoursite.com/wp/wp-json/gh/v3/tags/remove
Body:
{
    "id_or_email":"1",
    "tags" : [ 
        1, 
        2, 
        3, 
        "user", 
        "confirm" 
    ]
}

this request updates the contact and applies or removes a set of tags passed in tags array based on the requested URL. Body arguments for applying and removing tags remain the same only URL changes. the response from apply tag request looks like follows.

{
    "status": "success"
}<br>
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us