2015-10-02 75 views
0

我有一組用戶,我想通過門戶訂閱相同的通知。但是,由於我正在自動創建/管理這些用戶,我還希望自動訂閱這些通知。通過軟件API訂閱用戶通知

我已閱讀API文檔,搜索任何示例/教程,我仍然沒有任何運氣找出如何做到這一點。

任何線索或例子都會很棒。

回答

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」通知訂閱。

創建使用用戶的通知訂閱記錄:SoftLayer_User_Customer :: addNotificationSubscriber

網址:

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)的通知傳遞方法。

網址:

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 
+0

感謝,但現在看來,這將讓我有管理訂閱權限創建用戶。但是,我想實際上想要將一些新用戶訂閱到一種或多種類型的通知。 –

+0

@ Joe_1577790,我做了一些編輯以解決您的需求。 – mcruz