11-05-2015 12:53 AM
Hi,
How to change the order of Restriction Patterns using the CUPI API? This feature is usefull on GUI but in the CUPI API, the "SequenceNumber" field is read-only (Cisco Unity Connection Provisioning Interface (CUPI) API -- Restriction Patterns - DocWiki).
Thanks,
Fabien
Solved! Go to Solution.
11-30-2015 02:58 PM
Fabien,
Try it without the outer object, should work. i.e.:
{
"RestrictionPattern": [
{ "ObjectId": "829b17e6-b68b-4a9b-9acd-97887f024a55" },
{ "ObjectId": "7996d899-1cdd-4703-81e3-6644cf476981" }
]
}
-David
11-06-2015 05:56 AM
you don't rearrange them one at a time in the API - you actually have to get all the restriction pattern GUIDs and then do a single put against the table to force the order - in other words you can't say add a pattern and stick it in between patterns 3 and 4 - you can create a pattern but to force the order into anything other than sticking it at the end automatically you need to get them all.
so you'd do a PUT against a restriction table like this:
PUT https://CxN Server/vmrest/restrictiontables/(restriction talbe GUID)/restrictionpatterns
with a body like this:
<RestrictionPatterns>
<RestrictionPattern>
<ObjectId>pattern GUID 1</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>pattern GUID 2</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>pattern GUID 3</ObjectId>
</RestrictionPattern>
</RestrictionPatterns>
11-09-2015 02:16 AM
Hi,
Thank you for the answer.
But when I ask for the restriction pattern :
The answer is :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RestrictionPatterns total="3">
<RestrictionPattern>
<URI>/vmrest/restrictiontables/58aa7d73-8b89-411b-ab56-ef613685d0d0/restrictionpatterns/d4a503c7-04b7-4129-b144-00a3f3a30f2d</URI>
<Blocked>false</Blocked>
<NumberPattern>*</NumberPattern>
<RestrictionTableObjectId>58aa7d73-8b89-411b-ab56-ef613685d0d0</RestrictionTableObjectId>
<SequenceNumber>2</SequenceNumber>
<ObjectId>d4a503c7-04b7-4129-b144-00a3f3a30f2d</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<URI>/vmrest/restrictiontables/58aa7d73-8b89-411b-ab56-ef613685d0d0/restrictionpatterns/1ccd9317-e1b2-4a17-b770-d1c33eb28968</URI>
<Blocked>false</Blocked>
<NumberPattern>4571</NumberPattern>
<RestrictionTableObjectId>58aa7d73-8b89-411b-ab56-ef613685d0d0</RestrictionTableObjectId>
<SequenceNumber>1</SequenceNumber>
<ObjectId>1ccd9317-e1b2-4a17-b770-d1c33eb28968</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<URI>/vmrest/restrictiontables/58aa7d73-8b89-411b-ab56-ef613685d0d0/restrictionpatterns/79472bc3-926a-43f4-99cd-5f36bb283f8e</URI>
<Blocked>false</Blocked>
<NumberPattern>1234</NumberPattern>
<RestrictionTableObjectId>58aa7d73-8b89-411b-ab56-ef613685d0d0</RestrictionTableObjectId>
<SequenceNumber>0</SequenceNumber>
<ObjectId>79472bc3-926a-43f4-99cd-5f36bb283f8e</ObjectId>
</RestrictionPattern>
</RestrictionPatterns>
Then, I clean the result to use it in the PUT request :
<RestrictionPatterns>
<RestrictionPattern>
<ObjectId>d4a503c7-04b7-4129-b144-00a3f3a30f2d</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>1ccd9317-e1b2-4a17-b770-d1c33eb28968</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>79472bc3-926a-43f4-99cd-5f36bb283f8e</ObjectId>
</RestrictionPattern>
</RestrictionPatterns>
The answer is :
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ErrorDetails>
<errors>
<code>INVALID_PARAMETER</code>
<message>Restriction Pattern ObjectIds are invalid.</message>
</errors>
</ErrorDetails>
What is wrong with my request ?
Thanks,
Fabien
11-12-2015 11:13 AM
Hi Fabien,
I tried it on my UC box in the lab using curl and it seems to work for me (I put the xml body in body.txt). Also, when submitting the new list to PUT, you must omit the pattern that corresponds with the 'default' pattern - i.e. '*', in your case it's the one correspond to <ObjectId>d4a503c7-04b7-4129-b144-00a3f3a30f2d</ObjectId>
curl -kvv -X PUT https://10.194.104.61/vmrest/restrictiontables/f34a545f-781c-4aeb-a14a-8a6b25f68083/restrictionpatterns/ -H "Content-Type: application/xml" -d @body.txt -u Administrator:cisco\!123
* Trying 10.194.104.61...
* Connected to 10.194.104.61 (10.194.104.61) port 443 (#0)
* TLS 1.2 connection using TLS_DHE_RSA_WITH_AES_128_CBC_SHA
* Server certificate: DS-CUC105.cisco.com
* Server auth using Basic with user 'Administrator'
> PUT /vmrest/restrictiontables/f34a545f-781c-4aeb-a14a-8a6b25f68083/restrictionpatterns/ HTTP/1.1
> Host: 10.194.104.61
> Authorization: Basic QWRtaW5pc3RyYXRvcjpjaXNjbyExMjM=
> User-Agent: curl/7.43.0
> Accept: */*
> Content-Type: application/xml
> Content-Length: 744
>
* upload completely sent off: 744 out of 744 bytes
< HTTP/1.1 204 No Content
< Cache-Control: private
< Expires: Wed, 31 Dec 1969 16:00:00 PST
< Set-Cookie: JSESSIONIDSSO=3CF795D11BAF14457C460CBC2CD19E02; Path=/; Secure; HttpOnly
< Set-Cookie: JSESSIONID=D45894B9B316B102F8E98DC874210664; Path=/vmrest/; Secure; HttpOnly
< Set-Cookie: REQUEST_TOKEN_KEY=-1036253136233818261; Path=/; Secure; HttpOnly
< X-Frame-Options: SAMEORIGIN
< Content-Type: application/xml
< Date: Thu, 12 Nov 2015 18:56:18 GMT
< Server:
<
* Connection #0 to host 10.194.104.61 left intact
Hope that helps.
David
11-12-2015 11:14 AM
Here is the body.txt content from my system:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<RestrictionPatterns>
<RestrictionPattern>
<ObjectId>7e3869b0-c388-4993-a7cc-83515d1a2962</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>9b9e4d9d-a0c9-4719-a30c-9bf4776f91cf</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>15a37da5-a373-48c1-bef6-50671649e672</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>a0d69eaf-1beb-4a96-a1b7-874878143f21</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>aebd138c-7b6c-427c-be9c-d7a76e1a8287</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>f444d581-f0d8-4411-a3f5-b843da740f3c</ObjectId>
</RestrictionPattern>
11-13-2015 02:19 AM
You are right, omitting the pattern that corresponds with the 'default' pattern, it works.
But this is in contradiction with the documentation http://docwiki.cisco.com/wiki/Cisco_Unity_Connection_Provisioning_Interface_%28CUPI%29_API_--_Restriction_Patterns#Updating_a_Restriction_Pattern :
"To change the sequence of restriction patterns through API, you must provide all the restriction pattern object Id present in that restriction table"...
Thanks,
Fabien
11-13-2015 08:42 AM
Fabien,
From the doc:
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.
I think these notes are misleading/incorrect. Jeff, can you confirm?
David
11-16-2015 08:43 AM
I have another question. When I use an xml request, it is OK :
<RestrictionPatterns>
<RestrictionPattern>
<ObjectId>834aac66-f25d-48ce-b682-b01ef7b44adb</ObjectId>
</RestrictionPattern>
<RestrictionPattern>
<ObjectId>87721c56-fa55-462a-b457-107096189a9b</ObjectId>
</RestrictionPattern>
</RestrictionPatterns>
But when I convert in json, I get the error "Restriction Pattern ObjectIds are invalid":
{"RestrictionPatterns":[{"RestrictionPattern":{"ObjectId":"834aac66-f25d-48ce-b682-b01ef7b44adb"}},{"RestrictionPattern":{"ObjectId":"87721c56-fa55-462a-b457-107096189a9b"}}]}
What is wrong with the content in json?
Thanks,
Fabien
11-16-2015 11:52 PM
The correct JSON corresponds to your XML doc is:
{
"RestrictionPatterns": {
"RestrictionPattern": [
{ "ObjectId": "834aac66-f25d-48ce-b682-b01ef7b44adb" },
{ "ObjectId": "87721c56-fa55-462a-b457-107096189a9b" }
]
}
}
Also, make sure that you set correct Content-Type in the HTTP header.
11-17-2015 01:44 AM
I still have the same problem.
The GET request :
GET https://10.20.2.189:8443/vmrest/restrictiontables/c4292293-a84f-4103-bcb3-dcff380d8067/restrictionpatterns HTTP/1.1
Content-Type: application/json
Host: 10.20.2.189:8443
Content-Length: 198
Authorization: Basic Y2NtYWRtaW5pc3RyYXRvcjpjaXNjb3Jlbm5lcw==
{
"RestrictionPatterns": {
"RestrictionPattern": [
{ "ObjectId": "829b17e6-b68b-4a9b-9acd-97887f024a55" },
{ "ObjectId": "7996d899-1cdd-4703-81e3-6644cf476981" }
]
}
}
HTTP/1.1 200 OK
Cache-Control: private
Expires: Thu, 01 Jan 1970 01:00:00 CET
Set-Cookie: JSESSIONIDSSO=5401C6DA602028DA798C22FEDA1870EA; Path=/; Secure; HttpOnly
Set-Cookie: JSESSIONID=A774E9012C8B604DB425F67B6794EA55; Path=/vmrest/; Secure; HttpOnly
Set-Cookie: REQUEST_TOKEN_KEY=-3290675655440089088; Path=/; Secure; HttpOnly
X-Frame-Options: SAMEORIGIN
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Tue, 17 Nov 2015 09:36:26 GMT
Server:
535
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><RestrictionPatterns total="3"><RestrictionPattern><URI>/vmrest/restrictiontables/c4292293-a84f-4103-bcb3-dcff380d8067/restrictionpatterns/76f40825-f4a7-4743-9e18-0d03e3dd5b0d</URI><Blocked>false</Blocked><NumberPattern>*</NumberPattern><RestrictionTableObjectId>c4292293-a84f-4103-bcb3-dcff380d8067</RestrictionTableObjectId><SequenceNumber>2</SequenceNumber><ObjectId>76f40825-f4a7-4743-9e18-0d03e3dd5b0d</ObjectId></RestrictionPattern><RestrictionPattern><URI>/vmrest/restrictiontables/c4292293-a84f-4103-bcb3-dcff380d8067/restrictionpatterns/829b17e6-b68b-4a9b-9acd-97887f024a55</URI><Blocked>false</Blocked><NumberPattern>234</NumberPattern><RestrictionTableObjectId>c4292293-a84f-4103-bcb3-dcff380d8067</RestrictionTableObjectId><SequenceNumber>1</SequenceNumber><ObjectId>829b17e6-b68b-4a9b-9acd-97887f024a55</ObjectId></RestrictionPattern><RestrictionPattern><URI>/vmrest/restrictiontables/c4292293-a84f-4103-bcb3-dcff380d8067/restrictionpatterns/7996d899-1cdd-4703-81e3-6644cf476981</URI><Blocked>false</Blocked><NumberPattern>142</NumberPattern><RestrictionTableObjectId>c4292293-a84f-4103-bcb3-dcff380d8067</RestrictionTableObjectId><SequenceNumber>0</SequenceNumber><ObjectId>7996d899-1cdd-4703-81e3-6644cf476981</ObjectId></RestrictionPattern></RestrictionPatterns>
0
The PUT request :
PUT https://10.20.2.189:8443/vmrest/restrictiontables/c4292293-a84f-4103-bcb3-dcff380d8067/restrictionpatterns HTTP/1.1
Content-Type: application/json
Host: 10.20.2.189:8443
Content-Length: 198
Authorization: Basic Y2NtYWRtaW5pc3RyYXRvcjpjaXNjb3Jlbm5lcw==
{
"RestrictionPatterns": {
"RestrictionPattern": [
{ "ObjectId": "829b17e6-b68b-4a9b-9acd-97887f024a55" },
{ "ObjectId": "7996d899-1cdd-4703-81e3-6644cf476981" }
]
}
}
HTTP/1.1 400 Bad Request
Cache-Control: private
Expires: Thu, 01 Jan 1970 01:00:00 CET
Set-Cookie: JSESSIONIDSSO=312BA742D215C4CD24F936BFC7DCB918; Path=/; Secure; HttpOnly
Set-Cookie: JSESSIONID=76E170CC69E706DCC45FBC6E01D0750C; Path=/vmrest/; Secure; HttpOnly
Set-Cookie: REQUEST_TOKEN_KEY=-6766434678480281612; Path=/; Secure; HttpOnly
X-Frame-Options: SAMEORIGIN
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Tue, 17 Nov 2015 09:34:31 GMT
Connection: close
Server:
c0
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ErrorDetails><errors><code>INVALID_PARAMETER</code><message>Restriction Pattern ObjectIds are invalid.</message></errors></ErrorDetails>
0
11-17-2015 06:03 PM
Fabien,
I am also getting the same error with JSON. Checking with our CUC experts to see if they can shed any light on this issue.
David
11-30-2015 02:58 PM
Fabien,
Try it without the outer object, should work. i.e.:
{
"RestrictionPattern": [
{ "ObjectId": "829b17e6-b68b-4a9b-9acd-97887f024a55" },
{ "ObjectId": "7996d899-1cdd-4703-81e3-6644cf476981" }
]
}
-David
12-01-2015 01:24 AM
It's OK with that request content.
Thanks,
Fabien
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide