Expand my Community achievements bar.

Join us LIVE in San Francisco on November 14th for Experience Makers The Skill Exchange. Don't miss out on this free learning event!

Escaping Question Marks in parameter names

Avatar

Level 4

I'm making a Custom API Call in Fusion and I'm trying to update a parameter value that has a question mark in the name. 

Does anyone know how to make this work. I've tried a unicode value an encoded Url value a backslash??

Can anyone help?

 

Thank you.

8 Replies

Avatar

Level 4

Hi @RobertDy 

 

If you are using JAVA to make an API call, try to use the below code snippet that might help.

 

String value = docMetadata.has(MetadataConstants.JCR_TITLE)
? docMetadata.get(MetadataConstants.JCR_DESCRIPTION).getAsString().replace("?", "%3F")
: StringUtils.EMPTY;

 

In Place of title or description use the parameters that you are passing.

Avatar

Level 4

Thank you for your reply. I'm actually using Fusion (I updated my question). 

However, I think I tried replacing the question mark with %3F and it didn't seem to work.

Rob

Avatar

Community Advisor

To make sure I understand, you are trying to update one of a parameter's options? If so, how are you making your call? You shouldn't need to do any of this when making an update, because your update shouldn't be in the url.

Avatar

Level 4

@ChrisStephens 

The updates are in the JSON object in the body of the POST request. 

e.g. 

{

"name":"test",

"DE:Paramater Name":"123",

"DE:Paramater Name 2?":"456"

}

 

The name of the parameter here has a question mark. When I submit it, it then tells me it can't find the parameter with that name. 

Avatar

Community Advisor

If it's in the body then you shouldn't need to escape it, are you sure that's the name?

Avatar

Level 4

@ChrisStephens 

That was my initial thought, so I pulled the API name out via the API (POSTMan) then copied and pasted in to Fusion. So just assumed I needed to escape the character.

 

Avatar

Level 4

Oh No. I've found the solution, my category ID was actually incorrect.

Slightly embarrassing

Sorry for wasting your time.

Rob