Cisco Unity Connection Provisioning Interface (CUPI) API -- Restriction Patterns

From DocWiki

Revision as of 12:41, 17 September 2013 by Subabhat (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Links to Other API pages: Cisco_Unity_Connection_APIs

CUPI Guide Contents
API Overview
Index of All CUPI Documentation


Contents


Restriction Patterns

Administrator can use this API to create/update/delete/fetch the restriction pattern. Various attributes of restriction pattern can also be updated using this API.


Listing the Restriction Pattern for a Particular Restriction Table

The following is an example of the GET request that lists all the restriction tables:

  GET https://<connection-server>/vmrest/restrictiontables
  /<restrictiontableobjectid>/restrictionpatterns

The following is the response from the above *GET* request:

<RestrictionPatterns total="2">
  <RestrictionPattern>
     <URI>/vmrest/restrictiontables/38de2a1f-ca74-4be3-bb7cd315df4c0fc5/
   restrictionpatterns/6564adb9-9090-42e0-81e6-04e132c4382c</URI>
     <Blocked>true</Blocked>
     <NumberPattern>*</NumberPattern>
     <RestrictionTableObjectId>38de2a1f-ca74-4be3-bb7cd315df4c0fc5</
   RestrictionTableObjectId>
    <SequenceNumber>1</SequenceNumber>
    <ObjectId>6564adb9-9090-42e0-81e6-04e132c4382c</ObjectId>
  </RestrictionPattern>
  <RestrictionPattern>
     <URI>/vmrest/restrictiontables/38de2a1f-ca74-4be3-bb7cd315df4c0fc5/
   restrictionpatterns/15a68e67-16b9-4847-8230-29be9baa88cf</URI>
     <Blocked>true</Blocked>
     <NumberPattern>*</NumberPattern>
     <RestrictionTableObjectId>38de2a1f-ca74-4be3-bb7cd315df4c0fc5</
   RestrictionTableObjectId>
     <SequenceNumber>0</SequenceNumber>
     <ObjectId>15a68e67-16b9-4847-8230-29be9baa88cf</ObjectId>
  </RestrictionPattern>
</RestrictionPatterns>
Response Code: 200

JSON Example

To list all restriction patterns of a particular restriction table, do the following:

Request URI:
GET https://<connection-server>/vmrest/restrictiontables/<restrictiontableobjectid>/restrictionpatterns
Accept: application/json
Connection: keep-alive

The following is the response from the above *GET* request and the actual response will depend upon the information given by you:

{
  "@total": "1",
  "RestrictionPattern": [
  {
     "URI": "/vmrest/restrictiontables/4f01e5b1-b649-4f94-b55e-
     0c53d0e29c38/restrictionpatterns/84eb77f2-7b12-402b-967b-827efd81e485",
     "Blocked": "true",
     "NumberPattern": "+*",
     "RestrictionTableObjectId": "4f01e5b1-b649-4f94-b55e-0c53d0e29c38",
     "SequenceNumber": "0",
     "ObjectId": "84eb77f2-7b12-402b-967b-827efd81e485"
  },
  {
     "URI": "/vmrest/restrictiontables/4f01e5b1-b649-4f94-b55e-
     0c53d0e29c38/restrictionpatterns/c2ee84be-546e-493e-8e94-6f20bbdcc515",
     "Blocked": "true",
     "NumberPattern": "9+*",
     "RestrictionTableObjectId": "4f01e5b1-b649-4f94-b55e-0c53d0e29c38",
     "SequenceNumber": "1",
     "ObjectId": "c2ee84be-546e-493e-8e94-6f20bbdcc515"
  },
  ]
}
Response Code: 200


Viewing the Specific Restriction Pattern for a Particular Restriction Table

The following is an example of the GET request that lists the details of specific restriction pattern represented by the provided value of object ID:

  GET https://<connection-server>/vmrest/restrictiontables/
  <restrictiontableobjectid>/restrictionpatterns/<restrictiontableobjectid>
The following is the response from the above *GET* request:
<RestrictionPattern>
     <URI>/vmrest/restrictiontables/2c2c9504-8fb4-44e3-983c-
   93eb4e20325c/restrictionpatterns/2c2c9504-8fb4-44e3-983c-93eb4e20325c</URI>
     <Blocked>false</Blocked>
     <NumberPattern>*</NumberPattern>
     <RestrictionTableObjectId>255bfdd2-5686-47f2-b40a-
   320c194521ba</RestrictionTableObjectId>
     <RestrictionTableURI>/vmrest/restrictiontables/255bfdd2-5686-47f2-b40a-
   320c194521ba</RestrictionTableURI>
     <SequenceNumber>1</SequenceNumber>
     <ObjectId>2c2c9504-8fb4-44e3-983c-93eb4e20325c</ObjectId>
</RestrictionPattern>
Response Code: 200


Creating a Restriction Pattern

The following is an example of the POST request that creates a restriction pattern:

POST https://<connectionserver>/
vmrest/restrictiontables/<restrictiontableobjectid>/restrictionpatterns

Example 1: The following is the example of the create request from the above *POST* request.

Request Body:
<RestrictionPattern>
     <NumberPattern>*#</NumberPattern>
</RestrictionPattern>
Response Code: 201

JSON Example

To create new restriction pattern, do the following:

Request URI:
POST https://<connectionserver>/
vmrest/restrictiontables/<restrictiontableobjectid>/restrictionpatterns
Accept: application/json
Content-Type: application/json
Connection: keep-alive
Request Body:
{
     "NumberPattern": "*#"
}

The following is the response from the above *POST* request and the actual response will depend upon the information given by you:

Response Code: 201

Example 2: The following is the example of the create request with specific restriction table Object ID

Request Body:
<RestrictionPattern>
     <NumberPattern>*#??</NumberPattern>
     <RestrictionTableObjectId>38de2a1f-ca74-4be3-bb7c-d315df4c0fc5</RestrictionTableObjectId>
</RestrictionPattern>
Response Code: 201


Updating a Restriction Pattern

The following is an example of the PUT request that allows you to update the restriction pattern:

Example 1: Change number pattern of restriction pattern

  PUT https://<connection-
  server>/vmrest/restrictiontables/<restrictiontableobjectid>/restrictionpatterns/<restrictionpatterno
  bjectid>
Request Body:
<RestrictionPattern>
     <NumberPattern>??999#</NumberPattern>
</RestrictionPattern>
Response Code: 204

JSON Example

To change number pattern of restriction pattern, do the following:

Request URI:
  PUT https://<connection-
  server>/vmrest/restrictiontables/<restrictiontableobjectid>/restrictionpatterns/<restrictionpatternobject
  id>
Accept: application/json
Content-Type: application/json
Connection: keep-alive
{
     "NumberPattern": "99??"
}

The following is the response from the above *PUT* request and the actual response will depend upon the information given by you:

Request URI: 204

Example 2: Change sequence of restriction pattern

NOTE:

*To change the sequence of restriction patterns GET the object id of restriction patterns and arrange them in the required sequence.
*To change the sequence of restriction patterns through API, you must provide all the restriction pattern object Id present in that restriction table
PUT https://<connectionserver>/
vmrest/restrictiontables/<restrictiontableobjectid>/restrictionpatterns
Request Body:
<RestrictionPatterns>
  <RestrictionPattern>
     <ObjectId>6564adb9-9090-42e0-81e6-04e132c4382c</ObjectId>
  </RestrictionPattern>
  <RestrictionPattern>
     <ObjectId>d9cd1525-462b-4eef-8629-0be9d0db2d18</ObjectId>
  </RestrictionPattern>
  <RestrictionPattern>
     <ObjectId>db0aed70-316b-47cb-8335-52fe34d3ca94</ObjectId>
  </RestrictionPattern>
  <RestrictionPattern>
     <ObjectId>46485dc6-bf31-4b31-be58-9eacbe718d02</ObjectId>
  </RestrictionPattern>
  <RestrictionPattern>
     <ObjectId>b7d51bb8-0059-4b56-aadd-6f9e2eaea624</ObjectId>
  </RestrictionPattern>
</RestrictionPatterns>
Response Code: 204

NOTE: Default restriction pattern can neither be edited nor be deleted.

NOTE: The entire restriction pattern Object Id is given including default restriction pattern. But sequence of default restriction pattern cannot be changed because default restriction pattern cannot be edited nor be deleted.

Deleting a Restriction Pattern

Example 1: Delete particular restriction pattern The following is an example of the DELETE request that deletes a specific restriction table where you need to mention the restriction pattern object ID:

DELETE https://<connection-
server>/vmrest/restrictiontables/<restrictiontableobjectid>/restrictionpatterns/<restrictionpatterno
bjectid>
Response Code: 204

JSON Example

To delete particular restriction pattern, do the following:

DELETE https://<connectionserver>/
vmrest/restrictiontables/<restrictiontableobjectid>/restrictionpatterns/<restrictionpatternobject
id>
Accept: application/json
Connection: keep-alive
Response Code: 204

NOTE:

  • Default restriction pattern cannot be edited or deleted.
  • When restriction pattern is blocked than then calls matching to dial string will not be allowed.


Explanation of Data Fields

The following chart lists all of the data fields:

Device Name Data Type Operation Comments
NumberPattern Varchar Read/Write The specific numbers or patterns of numbers (including external and long-distance access codes) that can be permitted or restricted. It uses digits 0 through 9 plus the following special characters:
  • *Match zero or more digits
  • ? Match exactly one digit. Each ‘?’ serves as a placeholder for one digit.
  • # Corresponds to the # key on the phone
  • + to call from one country to other country

For example, to screen out all phone numbers that start with 206 but are longer than 7 digits, enter 9206?????* for the pattern (and set "Blocked" == true). Maximum length can be 40.

Blocked Boolean Read/Write A flag indicating whether Cisco Unity Connection permits the use of dial strings matching the pattern.

Values:

  • false: Permit use of dial strings matching the pattern
  • true: Do not permit use of dial strings matching the pattern

Default Value - true

ObjectId String(36) Read only Specifies the object ID of restriction patterns.
RestrictionTableObjectId String(36) Read only Specifies the restriction table object id to which restriction pattern belongs.
SequenceNumber Integer(2) Read only A sequential index for this restriction pattern within the parent restriction table, which specifies the order in which Cisco Unity Connection will apply each call pattern.

Rating: 0.0/5 (0 votes cast)

Personal tools