# used in Request URI Template Param

Hello I have a URI of the format - -

/apis/v1.0/customers/{customer-id}/addresses/{address-key}

/apis/v1.0/customers/11111/addresses/Address##3 that corresponds to

address-key gets mapped to later a body-param for which i am using the extract and then assign message policy as follows.

**/addresses/{address-key} request editAddress

Assign Message:

{editAddress.address-key}

I am facing an issue while retreiving the {address-key} param if it contains #. E.g Value such as Address#3 are truncated and read as Address only.

I tried to pass

{address-key} value as Address%233 but it gets interpreted as below before hitting the target url (% gets decoded as %25)

addressId=Address%25233

But this doesn’t work for us so we need some way to pass original value of Address#3. We are using

application/x-www-form-urlencoded while passing the body but since of Address#3 is in URI template it is truncated. Any suggestion how to pass original value of Address#3.

thanks,

aakash

Hello @Aakash Sharma : You can try attaching a JS extension after Extract Variables:


Extract Variable

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

Extract Variables-1

**/addresses/{addressKey}

request false


JS Code

var addressId = unescape(context.getVariable(‘addressKey’)); context.setVariable(‘addressId’,addressId)


Request URI

Send the request as : /customers/11111/addresses/address%233


Attach is the screenshot for your reference

Thanks that seem to work. Except that it was creating a duplicate variable if i just used

context.setVariable(‘addressId’,addressId).

So i am using -

var addressId = unescape(context.getVariable(‘editAddress.address-key’));
context.removeVariable(‘editAddress.address-key’);
print("Address Id: ", addressId);
context.setVariable(‘editAddress.address-key’,addressId);

Hey @Aakash Sharma - Great to know it worked out for you. Would you please accept the answer by clicking the link and close it ? This way it would help others community member too.