We have queue subscription topics that contain special characters like (/, asterick, !, >). We to want use SEMP V2 to delete particular subscriptions for a queue. I found the below SEMP v2 call to delete.
/msgVpns/{msgVpnName}/queues/{queueName}/subscriptions/{subscriptionTopic}
But, since my subcriptionTopic contains special characters I was unable to make a Http DELETE SEMP V2 API call.
Is there solution for this?
Example subscriptionTopics: 1. ABC///1/2//xyz/> 2. !ABC////ma*/2//xyz/>
EX URL: http://{Ip}/SEMP/v2/config/msgVpns/{msgVpnName}/queues/{queueName}/subscriptions/ABC///1/2//xyz/> -->Giving Invalid response
Response:
{
“meta”: {
“error”: {
“code”: 535,
“description”: “No paths found for /msgVpns/XXXXX/queues/XXXXXX/subscriptions/ABC///1/2/*/xyz/>”,
“status”: “INVALID_PATH”
},
“request”: {
“method”: “DELETE”,
“uri”: “http://IP/SEMP/v2/config/msgVpns/MSG-VPN/queues/queueName/subscriptions/ABC/*/*/1/2/*/xyz/>”
},
“responseCode”: 400
}
}
@Aaron @nram @tandras
Hello @Manikanta , You will need to escape them in your path. If you are using Python, take a look at urllib.parse.quote (urllib.parse — Parse URLs into components — Python 3.13.2 documentation).
e.g: urllib.parse.quote(“my/queue/name”, safe=“”)
I am facing similar issue in shell script while adding topic subscription to queue using SEMP V2. I am calling using CURL to post and get the objects.
QueueName: TEST/Q/DT
curl http://localhost:8080/SEMP/v2/config/msgVpns/Test/queues/TEST/Q/DT/subscriptions
-X POST
-u test:test
-H “Content-type:application/json”
-d ‘{
“msgVpnName”: “Test”,
“queueName”: “TEST/Q/DT”,
“subscriptionTopic”: “TEST/T/DT”
}’
Please someone advise how we can resolve this issue.
@Muniraja , You will need to escape the ‘/’ in queue-name with % encoding (%2F). See below:
curl http://localhost:8080/SEMP/v2/config/msgVpns/test-vpn/queues/test%2Fqueue/subscriptions \
-X POST \
-u admin:******* \
-H "Content-type:application/json" \
-d '{
"msgVpnName": "test-vpn",
"queueName": "test/queue",
"subscriptionTopic": "my/test/topic"
}'
{
"data":{
"msgVpnName":"test-vpn",
"queueName":"test/queue",
"subscriptionTopic":"my/test/topic"
},
"links":{
"uri":"http://localhost:8080/SEMP/v2/config/msgVpns/test-vpn/queues/test%2Fqueue/subscriptions/my%2Ftest%2Ftopic"
},
"meta":{
"request":{
"method":"POST",
"uri":"http://localhost:8080/SEMP/v2/config/msgVpns/test-vpn/queues/test%2Fqueue/subscriptions"
},
"responseCode":200
}
}%
Thank you so much Ramesh! As I am creating them using loop I have put the code something like below and it worked perfectly.
FS_REPLACE=“%2f”
var2=${var1//‘/’/$FS_REPLACE}
echo $file2
curl http://localhost:8080/SEMP/v2/config/msgVpns/test-vpn/queues/$var2/subscriptions
-X POST
-u admin:******
-H “Content-type:application/json”
-d ‘{
“msgVpnName”: “test-vpn”,
“queueName”: "’“var1”‘",
“subscriptionTopic”: "’“$var3”'"
}
Glad it worked @Muniraja . If you want to make it cryptic by one char, you could do
var2=${var1//\//$FS_REPLACE}