This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »



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

OperationDescription

createContactMethod

Creates a new contact method for a user.

listContactMethodsRetrieves 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.

createContactMethod
<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
  • userId: The unique identifier of the user.
  • type: The type of the contact method. One of the phone, SMS and e-mail.
  • address: The address of the contact depending on the type.
  • countryCode: The number code for the country. Not used for e-mail. Defaults to 1. 
  • label: The label for identifying the contact method.
  • isSendShortEmail: The boolean flag indicating whether to send an abbreviated e-mail message.
Sample request

Following is a sample REST/JSON request that can be handled by the createContactMethod operation.

Sample Request for createContactMethod
{
	"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 listContactMethods operation retrieves all contact methods for a user.

listContactMethods
<pagerduty.listContactMethods>
	<userId>{$ctx:userId}</userId>
</pagerduty.listContactMethods>
Properties
  • userId: The unique identifier of the user.
Sample request

Following is a sample REST/JSON request that can be handled by the listContactMethods operation.

Sample Request for 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 createContactMethod 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.

Sample Proxy
<?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>                                                                                                                  
  • No labels