通过软层API向用户订阅通知[英] Subscribe users to notifications via Soft Layer API

本文是小编为大家收集整理的关于通过软层API向用户订阅通知的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我有一组用户,我想订阅通过门户提供的相同通知.但是,当我自动化这些用户的创建/管理时,我也想自动订阅这些通知.

我已经查看了API文档,搜索了任何示例/教程,但我仍然没有任何运气来弄清楚如何完成此操作.

任何线索或示例都很棒.

推荐答案

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

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

参考:

编辑:

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

示例:添加" planned_maintenance"通知订阅.

1.为用户创建通知订阅记录:softlayer_user_customer :: addnotificationucationubscriber

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

url:

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

方法: post

JSON(有效载荷):

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

    ]
  ]
}

要获取有关" Notification Keykename"和" 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

本文地址:https://www.itbaoku.cn/post/1937776.html

问题描述

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