通过Soft Layer API为用户订阅通知

时间:2015-10-02 15:43:10

标签: api ibm-cloud-infrastructure

我有一组用户,我想订阅通过门户网站提供的相同通知。但是,由于我自动创建/管理这些用户,我还希望自动订阅这些通知。

我已经审核了API文档,搜索了任何示例/教程,而且我仍然没有找到如何实现这一目标的运气。

任何线索或例子都会很棒。

1 个答案:

答案 0 :(得分:0)

要添加权限,请执行以下请求:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_id]/addBulkPortalPermission

方法: POST

Json(有效负载):

{
  "parameters": [
    [
      {
        "keyName": "NTF_SUBSCRIBER_MANAGE"
      }
    ]
  ]
}

要获取用户权限,请执行:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[ User_Customer_ID]/getPermissions

<强>参考文献: http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer

修改

按照以下步骤向客户用户订阅通知:

示例:添加“PLANNED_MAINTENANCE”通知订阅。

1. 使用以下方法为用户创建通知订阅记录:SoftLayer_User_Customer :: addNotificationSubscriber

<强> URL:

https://[username:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_customer_id]/addNotificationSubscriber

方法: POST

Json(有效负载):

{
  "parameters": [
    " PLANNED_MAINTENANCE"
  ]
}

<强>参考:

http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/addNotificationSubscriber

2. :为用户订阅的通知创建传递方法(SoftLayer_User_Customer :: createSubscriberDeliveryMethods)。

<强> URL:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_User_Customer/[user_customer_id]/createSubscriberDeliveryMethods

方法: POST

Json(有效负载):

{
  "parameters": [
    "PLANNED_MAINTENANCE",
    [
       "EMAIL"

    ]
  ]
}

要获取有关“notificationKeyName”和“deliveryMethodKeyNames”的信息,请执行:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getActiveNotificationSubscribers?objectMask=mask[id, notification, active,deliveryMethods[notificationDeliveryMethod[active,keyName],notificationSubscriber]]

<强>参考:

http://sldn.softlayer.com/reference/services/SoftLayer_User_Customer/createSubscriberDeliveryMethods