Escaping Question Marks in parameter names | Community
Skip to main content
Level 3
February 19, 2024
Question

Escaping Question Marks in parameter names

  • February 19, 2024
  • 2 replies
  • 1821 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Level 4
February 20, 2024

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.

RobertDyAuthor
Level 3
February 20, 2024

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

ChrisStephens
Community Advisor
Community Advisor
February 21, 2024

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.

RobertDyAuthor
Level 3
February 21, 2024

@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. 

RobertDyAuthor
Level 3
February 21, 2024

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


@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.