1

I couldn't find any option to Tag a device while creating the device in Customer portal, so I am Using SoftLayer_Tag::setTags Rest API to tag a device:

POST: https://Username:API_KEY@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags.json
BODY: 
resourceTableId : 29756959
keyName : march22

But getting error saying:

{ "error": "You do not have permissions to tag this object.",
"code": "SoftLayer_Exception_PermissionDenied" }

Nagesh
  • 37
  • 7

1 Answers1

1

There is a mistake in the way that you are sending the body(tags parameter is missing and there is a wrong value for keyName), try this:

Virtual Guests

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags

Method: Post

{  
   "parameters":[  
      "tag1,tag2",
      "GUEST",
      29756959
   ]
}

Hardware

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags

Method: Post

{  
   "parameters":[  
      "tag1,tag2",
      "HARDWARE",
      29756959
   ]
}

Updated

To set tags you need to check the following:

  1. Access to device
  2. Permission enabled for Device Type (Vsi/Hardware):

    • Hardware -> View Hardware Details
    • VSI -> View Virtual Server Details

There is no way to set tags at the moment to place the order, you can set them after submit the order

Devices >> Device List >> Search the device (e.g: rcvtagtest)

enter image description here

Another way would be to place the order through API, in which it's possible to set tags through it at the moment to create the server, here an example for VSI:


Updated2


The SoftLayer_Tag::getTagByTagName method provides information about the tag, not the devices which have being tagged with this.

It will provide information from the tag based on tag name, so it's not necessary to send an identifier, so the correct way for this is:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/getTagByTagName

Method: Post

{  
   "parameters":[  
      "test1,test2"
   ]
}

Replace: $user, $apiKey with you own information and test1 and test2 with the tag names that you would like to retrieve

In case that you would like to retrieve devices, take a look this forum(for Vsis, the same idea should be applied for BMS):

If this doesn't help you, please provide more information about your requirements, in order that I can help you

Community
  • 1
  • 1
  • Even after changing parameters as you mentioned above, I am getting same "error": "You do not have permissions to tag this object.". – Nagesh Mar 22 '17 at 18:56
  • Is there any option to tag a device while creating in customer portal. – Nagesh Mar 22 '17 at 18:57
  • See the **Updated** section in my answer please, let me know any doubt or comment – Ruber Cuellar Valenzuela Mar 22 '17 at 20:51
  • @ Ruber : Thanks for update. I tag the Device and trying to get tag details by calling API SoftLayer_Tag::getTagByTagName method, this is how URL is https://api.softlayer.com/rest/v3/SoftLayer_Tag/29866229/getTagByTagName.json but i am getting ERROR saying "error": "Unable to find object with id of '29866229'.", where 29866229 is resourceTableId. – Nagesh Mar 24 '17 at 05:03
  • Please review the **Updated2** in my answer, let me know any doubt or comment – Ruber Cuellar Valenzuela Mar 24 '17 at 14:40