<?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: add tags to an existing user. in API / CLI Discussion</title>
    <link>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25936#M1535</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One option would be to use the management CLI. In my example I added tags to a host object which is called "Test123" - the syntax for users should be the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; set host name "Test123" tags.1 "Tag1" tags.2 "Tag2" tags.3 "Tag3"&lt;/P&gt;&lt;P&gt;This command alters the host "Test123" by adding multiple tags to the related object - you will end up with Tag1, Tag2 &amp;amp; Tag3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; set host name "Test123" tags.1 "Tag1"&lt;/P&gt;&lt;P&gt;This command sets only "Tag1" and deletes the other already set tags - so it overwrites existing ones. You end up with just Tag1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; set host name "Test123" tags.add "Tag2"&lt;/P&gt;&lt;P&gt;This command adds "Tag2" so that you have Tag1 &amp;amp; Tag2 in the end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to directly access the web API via POST requests you need to fit the above commands in the related format. The &lt;A href="https://sc1.checkpoint.com/documents/R80/APIs/index.html#web/set-host%20"&gt;management api reference guide&lt;/A&gt; shows you the correct syntax for this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: Nevermind, I think you won't be able to edit host objects via the API - at least with the current release. The syntax of your first example should be correct. If we can trust the error message the API is not able to handle the object type - maybe &lt;A href="https://community.checkpoint.com/migrated-users/47511"&gt;Robert Decker&lt;/A&gt;‌ can help &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.checkpoint.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit 2: Just realized that there are generic-object API calls available, that allow the creation/alteration of users. Seems like the "tag" attribute has a special "path" to set tags in this case. Will try to find out more.&lt;/P&gt;&lt;P&gt;So "set tag" is an official API command that can not work with generic API created objects such a users. But even when I try to create a new user via generic API calls like e.g. this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add generic-object create "com.checkpoint.objects.classes.dummy.CpmiUser" name "TestBot" email "myvpn@user.local" phoneNumber "01234 1337" tags "Tag1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... I still receive an error regarding the "tags" parameter. Without this one the mentioned command works fine. "tags.1" or "tags.add" results in the same error, while tags.set shows the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;message: "Unexpected JsonType 'STRING' found under set collection modifier. Expected type is an object with identifier of the changed owned object: 'uid' and fields which are going to be modified in the owned objects under the key: 'owned-object'. The modified object is stored in the collection: 'tags'"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Sep 2018 09:58:27 GMT</pubDate>
    <dc:creator>Maik</dc:creator>
    <dc:date>2018-09-11T09:58:27Z</dc:date>
    <item>
      <title>add tags to an existing user.</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25935#M1534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone, I'm trying to add tags to existing ( or new ) users via the web api and I'm facing the following errors.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1)&amp;nbsp;/web_api/v1.1/set-tag&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;request&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "uid" : "5fa2f623-8dd1-472b-b7b6-6d444f3dcd33",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "tags" : { &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "add" : "tag3"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;response&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "code": "generic_err_object_type_wrong",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "message": "The UID value '5fa2f623-8dd1-472b-b7b6-6d444f3dcd33' belongs to an object that is not compatible with this API"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2)&amp;nbsp;web_api/v1.1/set-generic-object&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;request&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "uid" :&lt;/SPAN&gt; "3a3cc4cd-7169-42a7-9037-3516933b5fbd",&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "tags": { "add": "tag3" }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;response&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt; "code": "generic_server_error",&lt;BR /&gt; "message": "Management server failed to execute command"&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3)&amp;nbsp;&amp;nbsp;web_api/v1.1/set-generic-object&lt;/STRONG&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;request&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "uid" : "3a3cc4cd-7169-42a7-9037-3516933b5fbd",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "tags": ["tag3"]&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Response&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;"code": "generic_server_error",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;"message": "Management server failed to execute command"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4)&amp;nbsp;web_api/v1.1/add-generic-object&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Request&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "create":"com.checkpoint.objects.classes.dummy.CpmiUser",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "name":"test-012",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "tags":["tag3"],&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "userc":{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "create":"com.checkpoint.objects.classes.dummy.CpmiSpecificUserc",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "owned-object":{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "useGlobalEncryptionValues":"true",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "ike":{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "create":"com.checkpoint.objects.classes.dummy.CpmiSpecificUsercIke"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Response&lt;/STRONG&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "code": "generic_server_error",&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt; "message": "Management server failed to execute command"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family: 'courier new', courier, monospace;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there any other option for create tags on users ?&lt;/P&gt;&lt;P&gt;any thoughts are welcome&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2018 21:37:15 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25935#M1534</guid>
      <dc:creator>gabriel_v</dc:creator>
      <dc:date>2018-09-10T21:37:15Z</dc:date>
    </item>
    <item>
      <title>Re: add tags to an existing user.</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25936#M1535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One option would be to use the management CLI. In my example I added tags to a host object which is called "Test123" - the syntax for users should be the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; set host name "Test123" tags.1 "Tag1" tags.2 "Tag2" tags.3 "Tag3"&lt;/P&gt;&lt;P&gt;This command alters the host "Test123" by adding multiple tags to the related object - you will end up with Tag1, Tag2 &amp;amp; Tag3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; set host name "Test123" tags.1 "Tag1"&lt;/P&gt;&lt;P&gt;This command sets only "Tag1" and deletes the other already set tags - so it overwrites existing ones. You end up with just Tag1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; set host name "Test123" tags.add "Tag2"&lt;/P&gt;&lt;P&gt;This command adds "Tag2" so that you have Tag1 &amp;amp; Tag2 in the end.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to directly access the web API via POST requests you need to fit the above commands in the related format. The &lt;A href="https://sc1.checkpoint.com/documents/R80/APIs/index.html#web/set-host%20"&gt;management api reference guide&lt;/A&gt; shows you the correct syntax for this case.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit: Nevermind, I think you won't be able to edit host objects via the API - at least with the current release. The syntax of your first example should be correct. If we can trust the error message the API is not able to handle the object type - maybe &lt;A href="https://community.checkpoint.com/migrated-users/47511"&gt;Robert Decker&lt;/A&gt;‌ can help &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://community.checkpoint.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit 2: Just realized that there are generic-object API calls available, that allow the creation/alteration of users. Seems like the "tag" attribute has a special "path" to set tags in this case. Will try to find out more.&lt;/P&gt;&lt;P&gt;So "set tag" is an official API command that can not work with generic API created objects such a users. But even when I try to create a new user via generic API calls like e.g. this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;add generic-object create "com.checkpoint.objects.classes.dummy.CpmiUser" name "TestBot" email "myvpn@user.local" phoneNumber "01234 1337" tags "Tag1"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... I still receive an error regarding the "tags" parameter. Without this one the mentioned command works fine. "tags.1" or "tags.add" results in the same error, while tags.set shows the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;message: "Unexpected JsonType 'STRING' found under set collection modifier. Expected type is an object with identifier of the changed owned object: 'uid' and fields which are going to be modified in the owned objects under the key: 'owned-object'. The modified object is stored in the collection: 'tags'"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Sep 2018 09:58:27 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25936#M1535</guid>
      <dc:creator>Maik</dc:creator>
      <dc:date>2018-09-11T09:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: add tags to an existing user.</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25937#M1536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Any legacy R77.X object that doesn't have Management API support, cannot be assigned tags via Generic Objects API.&lt;/P&gt;&lt;P&gt;This is because the Generic Objects API works with the old schema (same as dbedit API), and the tag objects are saved into R80.X databse.&lt;/P&gt;&lt;P&gt;Robert.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Sep 2018 11:11:32 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25937#M1536</guid>
      <dc:creator>Robert_Decker</dc:creator>
      <dc:date>2018-09-12T11:11:32Z</dc:date>
    </item>
    <item>
      <title>Re: add tags to an existing user.</title>
      <link>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25938#M1537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.checkpoint.com/migrated-users/47511"&gt;Robert Decker&lt;/A&gt;‌ &lt;A href="https://community.checkpoint.com/migrated-users/57462"&gt;Maik Dummer&lt;/A&gt;‌ Thanks so much for the clarification !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Sep 2018 13:36:24 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/API-CLI-Discussion/add-tags-to-an-existing-user/m-p/25938#M1537</guid>
      <dc:creator>gabriel_v</dc:creator>
      <dc:date>2018-09-13T13:36:24Z</dc:date>
    </item>
  </channel>
</rss>

