Overview
The following operations allow you to work with contact methods. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to work with contact methods, see Sample configuration.
Operation | Description |
---|---|
Creates a new contact method for a user. | |
listContactMethods | Retrieves all contact methods for a user. |
Operation details
This section provides further details on the operations related to contact methods.
Creating a new contact method
The createContactMethod
operation creates a new contact method for a user.
<pagerduty.createContactMethod> <userId>{$ctx:userId}</userId> <type>{$ctx:type}</type> <address>{$ctx:address}</address> <countryCode>{$ctx:countryCode}</countryCode> <label>{$ctx:label}</label> <isSendShortEmail>{$ctx:isSendShortEmail}</isSendShortEmail> </pagerduty.createContactMethod>
Properties
The unique identifier of the user.userId:
The type of the contact method. One of the phone, SMS and e-mail.type:
The address of the contact depending on the type.address:
The number code for the country. Not used for e-mail. Defaults to 1.countryCode:
The label for identifying the contact method.label:
The boolean flag indicating whether to send an abbreviated e-mail message.isSendShortEmail:
Sample request
Following is a sample REST/JSON request that can be handled by the createContactMethod
operation.
{ "apiUrl" : "https://virasoft.pagerduty.com", "apiToken" : "uAB6yAsCkWxPqdCbuJqd", "userId" : "PAR9SSS", "type" : "phone", "address" : "785145654", "countryCode" : "94", "label" : "My Mobile", "isSendShortEmail" : "false" }
Related PagerDuty documentation
https://developer.pagerduty.com/documentation/rest/users/contact_methods/create
Retrieving all contact methods
The
operation retrieves all contact methods for a user.listContactMethods
<pagerduty.listContactMethods> <userId>{$ctx:userId}</userId> </pagerduty.listContactMethods>
Properties
The unique identifier of the user.userId:
Sample request
Following is a sample REST/JSON request that can be handled by the
operation.listContactMethods
{ "apiUrl" : "https://virasoft.pagerduty.com", "apiToken" : "uAB6yAsCkWxPqdCbuJqd", "userId" : "PGT0HSD" }
Related PagerDuty documentation
https://developer.pagerduty.com/documentation/rest/users/contact_methods/list
Sample configuration
Following is a sample proxy service that illustrates how to connect to PagerDuty with the init
operation and use the
operation. The sample request for this proxy can be found in the createContactMethod sample request. You can use this sample as a template for using other operations in this category.createContactMethod
<?xml version="1.0" encoding="UTF-8"?> <proxy xmlns="http://ws.apache.org/ns/synapse" name="pagerduty_createContactMethod" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target> <inSequence onError="faultHandlerSeq"> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="apiToken" expression="json-eval($.apiToken)"/> <property name="userId" expression="json-eval($.userId)"/> <property name="type" expression="json-eval($.type)"/> <property name="address" expression="json-eval($.address)"/> <property name="countryCode" expression="json-eval($.countryCode)"/> <property name="label" expression="json-eval($.label)"/> <property name="isSendShortEmail" expression="json-eval($.isSendShortEmail)"/> <pagerduty.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <apiToken>{$ctx:apiToken}</apiToken> </pagerduty.init> <pagerduty.createContactMethod> <userId>{$ctx:userId}</userId> <type>{$ctx:type}</type> <address>{$ctx:address}</address> <countryCode>{$ctx:countryCode}</countryCode> <label>{$ctx:label}</label> <isSendShortEmail>{$ctx:isSendShortEmail}</isSendShortEmail> </pagerduty.createContactMethod> <respond/> </inSequence> <outSequence> <send/> </outSequence> </target> <description/> </proxy>