Softlayer : tagging device

前端 未结 1 1732
梦谈多话
梦谈多话 2021-01-24 09:12

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: ht         


        
相关标签:
1条回答
  • 2021-01-24 09:58

    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)

    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:

    • Setting Tags in JSON Order Softlayer API Python

    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):

    • How to get SoftLayer virtual guest by tags, what's the mask for tags?

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

    0 讨论(0)
提交回复
热议问题