Expand my Community achievements bar.

SOLVED

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

Avatar

Former Community Member

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.

1 Accepted Solution

Avatar

Correct answer by
Level 10

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.

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

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.

Avatar

Level 10

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

1370626_pastedImage_0.png

Avatar

Former Community Member

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.

Avatar

Former Community Member

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

Avatar

Level 10

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