调用API方法SoftLayer_Virtual_Guest/setTags.json由于“无效的标签名称"而失败 [英] call API method SoftLayer_Virtual_Guest/setTags.json failed due to 'Invalid tag names'

查看:66
本文介绍了调用API方法SoftLayer_Virtual_Guest/setTags.json由于“无效的标签名称"而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我发布>://://api.softlayer.com/rest/v3 .1/SoftLayer_Virtual_Guest/ {vmid}/setTags.json

When I post https://api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/{vmid}/setTags.json

带参数: {"parameters":["id: 899a9411-a08b-4d31-8dc6-cb2712c608dc, index: 0, job: redis-master, name: redis-master/899a9411-a08b-4d31-8dc6-cb2712c608dc, cpi-tag: redis-deployment, created_at: 2017-11-09T07:19:43Z, deployment: my-redis-deployment, director: ed-demo-director"]}

API返回错误,带有'{"error":为'tags'提供的值无效.无效的标签名称:名称:redis-master/899a9411-a08b-4d31-8dc6-cb2712c608dc.",代码":"SoftLayer_Exception_InvalidValue }'.如错误所述,名称"不是有效的标签名称.我不知道为什么它无效.在哪里可以设置无效的标签名称列表.

API return error with '{"error":"Invalid value provided for 'tags'. Invalid tag names: name: redis-master/899a9411-a08b-4d31-8dc6-cb2712c608dc.","code":"SoftLayer_Exception_InvalidValue"}'. As the error said, 'name' is not valid tag name. I don't know why it is invalid. And where can we set the invalid tag name list.

进行了更多测试,我发现这是由于字符'/'引起的.

And did more test, I found it is due to the character '/'.

推荐答案

之所以无效,是因为SoftLayer_Virtual_Guest :: setTags方法不允许某些字符(如您找到的'/'),允许使用这些字符是AZ,0-9,空格,_(下划线),-(连字符)、. (句号)和:(冒号),因此,恐怕您将无法使用标签名称和允许的其他字符.

The reason why it is invalid is because some characters like you´ve found '/', are not allowed trough the SoftLayer_Virtual_Guest::setTags method, the characters permitted are A-Z, 0-9, whitespace, _ (underscore), - (hypen), . (period), and : (colon), therefor I am afraid you won't be able to use tag names with other characters than the permitted.

尝试以下REST请求以使该方法正常工作,因为'/'已被连字符'-'代替,因为它是允许的字符:

Try the following REST request to make the method work, the '/' has been replaced by a hyphen '-' as it is an allowed character:

https://[username]:[apiKey]@api.softlayer.com/rest/v3.1/SoftLayer_Virtual_Guest/35747489/setTags
method (POST)
Body (json):
{"parameters":["id: 899a9411-a08b-4d31-8dc6-cb2712c608dc,index: 0,job: redis-master,name: redis-master-899a9411-a08b-4d31-8dc6-cb2712c608dc,cpi-tag: redis-deployment,created_at: 2017-11-09T07:19:43Z,deployment: my-redis-deployment,director: ed-demo-director"]}

有关更多信息,您可能会在下面看到:

For more information you may see below:

https://sldn.softlayer.com/reference/services/SoftLayer_Tag/setTags

Softlayer:标记设备

这篇关于调用API方法SoftLayer_Virtual_Guest/setTags.json由于“无效的标签名称"而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆