Special characters (/, *,>,!) in SEMPv2

Manikanta
Manikanta Member Posts: 17

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/%3E"
},
"responseCode": 400
}
}
@Aaron @nram @tandras

Tagged:

Comments

  • nram
    nram Member, Employee Posts: 80 Solace Employee
    edited March 2021 #2

    Hello @Manikanta , You will need to escape them in your path. If you are using Python, take a look at urllib.parse.quote (https://docs.python.org/3/library/urllib.parse.html#module-urllib.parse).
    e.g: urllib.parse.quote("my/queue/name", safe="")

  • Muniraja
    Muniraja Member Posts: 2
    edited July 2021 #3

    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.

  • nram
    nram Member, Employee Posts: 80 Solace Employee

    @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
        }
    }%
    
    
  • Muniraja
    Muniraja Member Posts: 2
    edited July 2021 #5

    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"'"
    }

  • nram
    nram Member, Employee Posts: 80 Solace Employee
    edited July 2021 #6

    Glad it worked @Muniraja . If you want to make it cryptic by one char, you could do

    var2=${var1//\//$FS_REPLACE}
    
    

    :-)