<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Adding tags to document in Alfresco 6.0.2V in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115994#M32170</link>
    <description>&lt;P&gt;Which api are you using ,I'm using&lt;A href="https://api-explorer.alfresco.com/api-explorer/#!/tags/createTagForNode" target="_blank" rel="noopener nofollow noreferrer"&gt;&amp;nbsp;https://api-explorer.alfresco.com/api-explorer/#!/tags/createTagForNode&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;It works fine for me. And by the way my alfresco version is 6.2.0 &lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 09 Sep 2020 16:54:20 GMT</pubDate>
    <dc:creator>kaynezhang</dc:creator>
    <dc:date>2020-09-09T16:54:20Z</dc:date>
    <item>
      <title>Adding tags to document in Alfresco 6.0.2V</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115993#M32169</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greetings of the day!&lt;/P&gt;&lt;P&gt;Currently, I have facing one issue regarding&amp;nbsp;tagging.&lt;/P&gt;&lt;P&gt;while tagging the documnet with string as [0001213, 8574,01,ID0123] getting tags in alfresco as &lt;FONT color="#339966"&gt;1213&lt;/FONT&gt;&amp;nbsp; &lt;FONT color="#993300"&gt;8574&lt;/FONT&gt; &lt;FONT color="#003366"&gt;1 ID0123&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#003366"&gt;tags with leading 0's are discarded.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#003366"&gt;Here is part my code to add tags :&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#808000"&gt;HttpPost httpPost = new HttpPost(url);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#003366"&gt;&lt;FONT color="#808000"&gt;StringEntity stringEntity = new StringEntity("[0001213, 8574,01, ID0123]", ContentType.APPLICATION_JSON);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808000"&gt;httpPost.setEntity(stringEntity);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#808000"&gt;HttpResponse httpResponse = closeableHttpClient.execute(httpPost);&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Except leading 0's it's working fine, So someone please help on this issue, or Explain to me how tag store in alfresco.&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 12:49:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115993#M32169</guid>
      <dc:creator>Aswani_Juvva</dc:creator>
      <dc:date>2020-09-09T12:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Adding tags to document in Alfresco 6.0.2V</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115994#M32170</link>
      <description>&lt;P&gt;Which api are you using ,I'm using&lt;A href="https://api-explorer.alfresco.com/api-explorer/#!/tags/createTagForNode" target="_blank" rel="noopener nofollow noreferrer"&gt;&amp;nbsp;https://api-explorer.alfresco.com/api-explorer/#!/tags/createTagForNode&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;It works fine for me. And by the way my alfresco version is 6.2.0 &lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 16:54:20 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115994#M32170</guid>
      <dc:creator>kaynezhang</dc:creator>
      <dc:date>2020-09-09T16:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Adding tags to document in Alfresco 6.0.2V</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115995#M32171</link>
      <description>&lt;P&gt;The json array you are passing seems like integer array. Since the values are recognized as integer, the preceding 0s are getting stripped. Try passing the string representation of the json array with tag values and see if it works for you.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Sep 2020 19:16:44 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115995#M32171</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-09-09T19:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Adding tags to document in Alfresco 6.0.2V</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115996#M32172</link>
      <description>&lt;P&gt;Thanks for your quick responce Abhinav!&lt;/P&gt;</description>
      <pubDate>Sun, 13 Sep 2020 11:26:30 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115996#M32172</guid>
      <dc:creator>Aswani_Juvva</dc:creator>
      <dc:date>2020-09-13T11:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Adding tags to document in Alfresco 6.0.2V</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115997#M32173</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class=""&gt;kaynezhang,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;The api address which I'm using is working fine with 6.0.2V, but when I'm giving tags with leading 0's, in alfresco site those leading 0's are discarded for the tags(Eg: 009TG as 9TG) and functionality is working fine with tags which are not starting with 0's.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Here is my sample Json for tags in request :: {"tags" :["ID001","ID-Proof","00112"]}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Here is my sample code&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;ArrayList&amp;lt;String&amp;gt; tagsList= objModel.getTagsList();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;HttpPost httpPost = new HttpPost(url);&lt;BR /&gt;StringEntity stringEntity = new StringEntity(tagsList.toString(), ContentType.APPLICATION_JSON);&lt;BR /&gt;httpPost.setEntity(stringEntity);&lt;BR /&gt;HttpResponse httpResponse = closeableHttpClient.execute(httpPost);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;sample url is : http://localhost:8090/alfresco/service/api/node/{nodeRef}/tags&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;If possible, can you please suggest other alternative for tagging a document in alfresco.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Thanks in Advance!&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 Sep 2020 14:25:04 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115997#M32173</guid>
      <dc:creator>Aswani_Juvva</dc:creator>
      <dc:date>2020-09-13T14:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Adding tags to document in Alfresco 6.0.2V</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115998#M32174</link>
      <description>&lt;P&gt;It is strage. The API you are using is this one:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/tagging/node.tags.post.desc.xml" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/tagging/node.tags.post.desc.xml&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/tagging/node.tags.post.json.js" target="_blank" rel="noopener nofollow noreferrer"&gt;https://github.com/Alfresco/alfresco-remote-api/blob/master/src/main/resources/alfresco/templates/webscripts/org/alfresco/repository/tagging/node.tags.post.json.js&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;It is working as expected when i pass string representation of tags. See the sample code below:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;import java.io.IOException;
import java.nio.charset.StandardCharsets;

import org.apache.commons.io.IOUtils;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;


public class CreateTags {
	
	public static void main(String[] args) throws ClientProtocolException, IOException {
                final String tagURL = "http://127.0.0.1:8080/&lt;STRONG&gt;alfresco/service/api/node/workspace/SpacesStore/da36bb7e-5202-4dd4-a19b-3caf96d6fdb7/tags&lt;/STRONG&gt;?alf_ticket=TICKET_ddd66235f30c68fcf1ec10ee2dbfd82ce18e0ef2";&lt;BR /&gt;		try (final CloseableHttpResponse httpResp = httpPost(tagURL, &lt;FONT color="#FF0000"&gt;&lt;EM&gt;&lt;STRONG&gt;"[\"ID001\",\"ID-Proof\",\"00112\",\"0ID001\",\"00ID-Proof\",\"0001120\"]"&lt;/STRONG&gt;&lt;/EM&gt;&lt;/FONT&gt;)) {
			final StatusLine status = httpResp.getStatusLine();
			final int statusCode = status.getStatusCode();
			if (statusCode == 200) {
				final String resonseStr = IOUtils.toString(httpResp.getEntity().getContent(),
						StandardCharsets.UTF_8);
				System.out.println(resonseStr);
			}
		}
	}
	
	public static CloseableHttpResponse httpPost(final String url,
			final String jsonReqData) throws ClientProtocolException,
			IOException {
		final CloseableHttpClient httpclient = HttpClientBuilder.create().build();
		final HttpPost httpPost = new HttpPost(url);
		final StringEntity httpEntity = new StringEntity(jsonReqData);
		httpEntity.setContentType("application/json");
		httpPost.setEntity(httpEntity);		
		return httpclient.execute(httpPost);
	}
}
&lt;/PRE&gt;
&lt;P&gt;&lt;U&gt;Response from API:&lt;/U&gt;&lt;/P&gt;
&lt;PRE&gt;[
  "id001",
  "id-proof",
  "00112",
  "0id001",
  "00id-proof",
  "0001120"
]&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="createtags.PNG" style="width: 999px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/841i27C9434D9578E17D/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;V1 Api works fine as well:&amp;nbsp;&lt;A href="https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-add-remove-tags-on-node.html" target="_self" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/6.2/concepts/dev-api-by-language-alf-rest-add-remove-tags-on-node.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;POST&lt;/STRONG&gt;:&amp;nbsp;&lt;SPAN&gt;http://localhost:8080/&lt;STRONG&gt;alfresco/api/-default-/public/alfresco/versions/1/nodes/2245c97b-1da4-41c9-8275-f1d87140585f/tags&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;EM&gt;[
    {
     "tag": "ID001"
    },
    {
     "tag": "ID-Proof"
    },
    {
     "tag": "00112"
    },
    {
     "tag": "00ID-Proof"
    }
]&lt;/EM&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;U&gt;Response&lt;/U&gt;:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;STRONG&gt;{
    "list": {
        "pagination": {
            "count": 4,
            "hasMoreItems": false,
            "totalItems": 4,
            "skipCount": 0,
            "maxItems": 100
        },
        "entries": [
            {
                "entry": {
                    "tag": "ID001",
                    "id": "4682305c-71c2-4db8-bc04-0e6baffdbc75"
                }
            },
            {
                "entry": {
                    "tag": "ID-Proof",
                    "id": "fb2ff153-3420-4ff3-a206-425142958314"
                }
            },
            {
                "entry": {
                    "tag": "00112",
                    "id": "18e43c99-bdd6-4551-8448-8f6b1d1460f0"
                }
            },
            {
                "entry": {
                    "tag": "00ID-Proof",
                    "id": "d2c09f86-6c5a-46db-8946-959d47a21a32"
                }
            }
        ]
    }
}&lt;/STRONG&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 13 Sep 2020 20:40:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/adding-tags-to-document-in-alfresco-6-0-2v/m-p/115998#M32174</guid>
      <dc:creator>abhinavmishra14</dc:creator>
      <dc:date>2020-09-13T20:40:49Z</dc:date>
    </item>
  </channel>
</rss>

