Distribution lists

Modifying distribution lists

A distribution list allows you to associate the following:

  • ContactIds (type: String): A comma separated list of contact IDs that you would like added to the list.
  • UserIds (type: String): Specifies the Whispir users that should also be notified when this list is used.
  • DistListIds (type: String): Specifies the nested lists that are contained within this distribution list.

Any or all three of these can be updated via the PUT method along with the DL properties (name, description, location and so on).

The usual steps are:

  1. Create a distribution list (DL).
  2. While creating the DL, you can put in the ContactIds, UserIds, distListIds (nested) so that the DL is created with those values already in place.
  3. After the DL is created, if you want to add/update the values, do a GET request to retrieve the specific DL.
    • GET https://api..whispir.com/workspaces/{id}/distributionlists/{id}?apikey=xxxx
      This will return the DL object
  1. Modify the DL properties (name, description, contactIds, UserIds, dlIds, location and so on) as needed.
  2. Do a PUT request to update the DL details:
    • PUT https://api..whispir.com/workspaces/{id}/distributionlists/{id}?apikey=xxxx
    • Successful update gives you a 204 No Content.
    • The contactIds, userIds and distListIds can be passed together in a single request.

Notes:

  • If an existing contactId is added again, it doesn’t throw an error or create two entries. The contactId is just neglected and only 1 record is maintained.
  • If the PUT request was successful, the expected response code is a 204 No Content.
  • To read more about modifying location information see Location tags for distribution lists.
  • JSON
  • XML

Getting the DL

Request

GET https://api.<region>.whispir.com/distributionlists/CF5AF1AE49ED07A6?apikey=[your_api_key]
Authorization: Basic asdf98nf89asdvasd2r398h8sdf
x-api-key: your_api_key


Response

{{codeStart}}

Accept: application/vnd.whispir.distributionlist-v1+json

{

"id": "CF5AF1AE49ED07A6",

"name" : "Rockstar Distribution List",

"description" : "All the rocks were once stars - astrophysicist inside me",

"access" : "Open",

"visibility" : "Public",

"contactIds" : "7CC205AE17FFDC8A,92XC05AE154FDC8A",

"userIds" : "",

"distListIds" : "",

...

}

{{codeEnd}}

 

Updating the DL

Lets do the following in a single request

  1. Remove a contactId
  2. Add two new UserId values

 

Request

{{codeStart}}

PUT https://api.<region>.whispir.com/distributionlists/CF5AF1AE49ED07A6?apikey=[your_api_key]

Authorization: Basic asdf98nf89asdvasd2r398h8sdf

x-api-key: your_api_key

Content-Type: application/vnd.whispir.distributionlist-v1+json

{

"id": "CF5AF1AE49ED07A6",

"name" : "Rockstar Distribution List",

"description" : "All the rocks were once stars - astrophysicist inside me",

"access" : "Open",

"visibility" : "Public",

"contactIds" : "7CC205AE17FFDC8A",

"userIds" : "F0547F6F2E4839F8,900972D1C916FE84",

"distListIds" : "",

...

}

{{codeEnd}}

 

Response

204 No Content