Manage Notification Mediums
    • PDF

    Manage Notification Mediums

    • PDF

    Article summary

    1. Create a Notification Medium Instance

    This POST method creates a notification medium instance. The email is the default notification medium and you can choose to use Slack or Teams for sending notifications.

    Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.create.

    POST
    {{url}}/api/v1/notification-service/notificationmediums

    Request Example 

    curl -X POST '{{url}}/api/v1/notification-service/notificationmediums'
    -H 'Authorization: Bearer <token>' -H 'content-type: application/json'
    -d
    '{
        "name": "corporate_slack_0612_9",
        "description": "slack description",
        "type": "slack",
        "connectionParameters": {
           "URL": "https://test.slack.com/api/",
           "token": "xoxb-xxxxxxx-xxxxxxx"
         }
    }'

    Response Example 

    {
        "id": "ff421f53-76fc-4fc1-805c-916e3f0e0b66",
        "name": "corporate_slack_0612_9",
        "description": "slack description",
        "type": "slack",
        "connectionParameters": {
            "URL": "https://test.slack.com/api/",
            "token": "xoxb-xxxxxxx-xxxxxxx"
        },
        "referenceCount": 0
    }

    Status: 201 Created

    2. Get all Notification Mediums

    This GET method returns a list of all notification mediums.

    Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.list.

    GET
    {{url}}/api/v1/notification-service/notificationmediums

    Request Parameters

    The request parameters used in this method are shown in the following table:

    ParameterDescriptionData TypeRequired
    filterFilter the list of notification mediums based on the name of a notification medium, The supported operators are 'eq' and 'co'. 
    For example: status eq Corporate_slack
    StringOptional

    Request Example 

    curl -X GET '{{url}}/api/v1/notification-service/notificationmediums' -H 'Authorization: Bearer <token>'

    Response Example 

    Status: 200 Ok
    {
        "result": [
            {
                "id": "2dbb5583-fd5b-43f3-93c8-c025fe1cb7ab",
                "name": "Teams Notification",
                "description": "Updated description",
                "type": "teams",
                "connectionParameters": {
                    "Webhook URL": "https://britive.webhook.office.com/webhookb2/c13fde5a-baa6-47d5-b7f5-2f1ef3db5cdf@71399888-cb9e-4efd-9983-188eb47e96e4/IncomingWebhook/e8baf2c9d07c40919bd75a8f6e5fc319/bec8c7b9-5840-4f09-803a-c72c12cf676e"
                },
                "referenceCount": 11
            },
            {
                "id": "619e0455-37e1-425d-8f4b-7d8bbd8a2e29",
                "name": "corporate_slack_0612_8",
                "description": "slack description",
                "type": "slack",
                "connectionParameters": {
                    "URL": "https://gslab1711.slack.com/api/",
                    "token": "xoxb-2721824988759-2736764502019-N3y4qoZvWR6ElvKynZSntHFw"
                },
                "referenceCount": 0
            },
            {
                "id": "a9851bb6-1bef-40be-bd88-534c86939ca6",
                "name": "Email",
                "description": "Default Email Notification Medium",
                "type": "email",
                "connectionParameters": null,
                "referenceCount": 0
            },
        ]
    }

    3. Get a Notification Medium by ID

    This GET method returns the details of a notification medium specified by an <notification_id >.

    Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.read.

    GET
    {{url}}/api/v1/notification-service/notificationmediums/<notification_id>

    Request Example

    curl -X GET '{{url}}/api/v1/notification-service/notificationmediums/<notification_id>' -H 'Authorization: Bearer <token>'

    Response Example 

    Status: 200 Ok
    {
        "id": "2dbb5583-fd5b-43f3-93c8-c025fe1cb7ab",
        "name": "Teams Notification",
        "description": null,
        "type": "teams",
        "connectionParameters": {
            "Webhook URL": "https://britive.webhook.office.com/webhookb2/c13fde5a-baa6-47d5-b7f5-2f1ef3db5cdf@71399888-cb9e-4efd-9983-188eb47e96e4/IncomingWebhook/e8baf2c9d07c40919bd75a8f6e5fc319/bec8c7b9-5840-4f09-803a-c72c12cf676e"
        },
        "referenceCount": 10
    }

    4. Update a Notification Medium Instance

    This PATCH method updates the notification medium details of a specified <notification_id>.

    Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.update.

    PATCH{{url}}/api/v1/notification-service/notificationmediums/<id>

    Request Example 

    curl -X PATCH ‘{{url}}/api/v1/notification-service/notificationmediums/<id>'
    -H 'Authorization: Bearer <token>' -H 'content-type: application/json'
    -d
    '{
        "description": "Updated description",
        "name": "Teams Notification",
        "connectionParameters": {
            "Webhook URL": "https://britive.webhook.office.com/webhookb2/c13fde5a-baa6-47d5-b7f5-2f1ef3db5cdf@71399888-cb9e-4efd-9983-188eb47e96e4/IncomingWebhook/e8baf2c9d07c40919bd75a8f6e5fc319/bec8c7b9-5840-4f09-803a-c72c12cf676e"
        },
        "referenceCount": 1
    }
        }
    }'

     Response Example 

    Status: 204 No Content

    5. Delete a Notification Medium Instance

    This DELETE method deletes a specified notification medium instance specified by <notification_id>.

    Note: To execute this API, the user should have permission assigned (through policy) with action as nm.notification.delete.

    DELETE
    {{url}}/api/v1/notification-service/notificationmediums/<notification_id >

    Request Example 

    curl -X DELETE '{{url}}/api/v1/notification-service/notificationmediums/<notification_id>' -H 'Authorization: Bearer <token>'

    Response Example 

    Status: 204 No Content

    6. Get All Channels for Notification Medium

    This GET method returns a list of all channels for a Slack notification medium.

    Note: To execute this API, the user should have permission assigned (through policy) with action as nm.channels.list.

    GET
    {{url}}/api/v1/notification-service/notificationmediums/{id}/channels

    Request Example 

    curl -X GET '{{url}}/api/v1/notification-service/notificationmediums/{id}/channels' -H 'Authorization: Bearer <token>'

    Response Example 

    Status: 200 Ok
    {
        "result": [
            {
                "channelId": "C02MKF72621",
                "channelName": "general"
            },
            {
                "channelId": "C02MNF5167M",
                "channelName": "policy-admin"
            },
            {
                "channelId": "C02NC5AAY0Y",
                "channelName": "random"
            }
        ],
        "pagination": {
            "next": "",
            "prev": ""
        }
    }



    Was this article helpful?