问题描述
我有一组用户,我想订阅通过门户提供的相同通知.但是,当我自动化这些用户的创建/管理时,我也想自动订阅这些通知.
我已经查看了API文档,搜索了任何示例/教程,但我仍然没有任何运气来弄清楚如何完成此操作.
任何线索或示例都很棒.
推荐答案
要添加权限,请执行以下请求:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_id]/addBulkPortalPermission
JSON(有效载荷):
{ "parameters": [ [ { "keyName": "NTF_SUBSCRIBER_MANAGE" } ] ] }
要获得用户权限,请执行:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[ User_Customer_ID]/getPermissions
问题描述
I have a set of users that I want to subscribe to the same notifications available via the Portal. However, as I'm automating the creation/management of these users, I also want to automate the subscription to these notifications.
I've reviewed the API documentation, searched for any examples/tutorials, and I'm still not having any luck figuring out how to accomplish this.
Any clues, or examples would be awesome.
推荐答案
To add the permission, execute the following request:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_id]/addBulkPortalPermission
Method: POST
Json (payload):
{ "parameters": [ [ { "keyName": "NTF_SUBSCRIBER_MANAGE" } ] ] }
To get the user permissions, execute:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[ User_Customer_ID]/getPermissions
References: http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer
EDIT:
Follow these steps to subscribe notifications to a customer user:
Example: Add “PLANNED_MAINTENANCE” notification subscription.
1. Create a notification subscription record for the user using: SoftLayer_User_Customer::addNotificationSubscriber
URL:
https://[username:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_customer_id]/addNotificationSubscriber
Method: POST
Json (payload):
{ "parameters": [ " PLANNED_MAINTENANCE" ] }
Reference:
http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/addNotificationSubscriber
2. Create delivery methods for a notification that the user is subscribed to (SoftLayer_User_Customer::createSubscriberDeliveryMethods).
URL:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_customer_id]/createSubscriberDeliveryMethods
Method: POST
Json (payload):
{ "parameters": [ "PLANNED_MAINTENANCE", [ "EMAIL" ] ] }
To get information about “notificationKeyName” and “deliveryMethodKeyNames”, execute:
https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getActiveNotificationSubscribers?objectMask=mask[id, notification, active,deliveryMethods[notificationDeliveryMethod[active,keyName],notificationSubscriber]]
Reference:
http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/createSubscriberDeliveryMethods