Can you see/edit/create tags in AEM rest API? | Community
Skip to main content
December 9, 2017
Solved

Can you see/edit/create tags in AEM rest API?

  • December 9, 2017
  • 5 replies
  • 2873 views

Is there a way in the rest API for AEM 6.3 to view/edit/create tags? I am building an AEM integration with a customer where we can only interact with the rest API so I will not have access to the Java API.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

The best way to programmatically create a tag and use REST is to create a Sling Servlet:

http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/

In the Sling Servlet - use the Tag Manager API that creates the tag. Now you can invoke the Sling Servlet using Restful means.

See the TagManager API in the Javadocs here: "The CQ5 Quickstart and Web Application."

Using the Tag Manager is the best way.

5 replies

smacdonald2008
New Participant
December 11, 2017

You are correct - by donig so - you can take advantage of the strongly typed Tag Manager API and then invoke it using HTTP.

December 11, 2017

Creating a Sling Servlet looks like the best approach but will research some more. Thanks

December 11, 2017

Thanks for the response, do you know by chance if the cq_csrf_token can be generated programmatically from a separate server? We're trying to build a server-to-server integration so unless there's a way to also generate that token through a supported REST API endpoint I might have to keep looking.

edubey
New Participant
December 11, 2017

You can use OOTB servlet in AEM author at /bin/tagcommand with POST calls

com.day.cq.tagging.servlets.TagCommandServlet

It will create tags for you

sample post data

smacdonald2008
smacdonald2008Accepted solution
New Participant
December 11, 2017

The best way to programmatically create a tag and use REST is to create a Sling Servlet:

http://www.aemcq5tutorials.com/tutorials/sling-servlet-in-aem/

In the Sling Servlet - use the Tag Manager API that creates the tag. Now you can invoke the Sling Servlet using Restful means.

See the TagManager API in the Javadocs here: "The CQ5 Quickstart and Web Application."

Using the Tag Manager is the best way.