It's all about the answers!

Ask a question

ETM Rest API: how to get property equal to title with special character "#"

Sanj Ratnam (111) | asked Aug 11 '22, 3:57 p.m.
edited Aug 11 '22, 4:08 p.m.

 I want to get the properties which are equal to a title name. For example like this:

Unfortunately this does not work. I think the special characters like "_" and "#" are preventing to make this work.
The query does only work if the titlenames doesn't have special characters.

Can someone help me with this issue?


Ian Barnard commented Aug 12 '22, 3:15 a.m.

Did you try url encoding the whole query parameter value, i.e.  ?fields=feed%2Fentry%2Fcontent%2Fproperty%5Btitle%3D%22test123_tt%23433%22%5D

Sanj Ratnam commented Aug 12 '22, 7:08 a.m. | edited Aug 12 '22, 7:12 a.m.

Hi, thanks for the reply. I've tried it with your suggested url encoding, but then i got an 400 Error. Instead of [title="test123_tt#433"] ive tried it with [title="test123_tt##433"] and encoded the whole fields query again.This worked for me. This means double hashes(##) should be used, if we look for values, which contain only one "#".  Is this assumption correct? Couldn't find this information anywhere. 

Ralph Schoon commented Aug 16 '22, 2:55 a.m.

How does your example conform to the URL encoding standards? According to  # would be encoded using %23. Seeing any # in your answer above tells us that you did not encode it. The encoding would also potentially needed for other characters such as " etc. Carefully read the answer from Ian.

Sanj Ratnam commented Aug 16 '22, 4:21 a.m. | edited Aug 16 '22, 4:27 a.m.

I didn't send the query directly with [title="test123_tt#433"]. Of course i have encoded it.The encoded fields part looks like this:  fields=feed%2Fentry%2Fcontent%2Fproperty%5Btitle%3D%22ABC40_TT%23433%22%5D. (As Ian described it).

Somehow it works only, If i use for the title double hashes like this: [title="test123_tt##433"]. The encoded part looks like this: fields=feed%2Fentry%2Fcontent%2Fproperty%5Btitle%3D%22ABC40_TT%23%23433%22%5D. This one is getting me properties with the title "test123_tt#433". Why should we filter for double hash "##", if we are looking for a titlename with single hash "#"? I was expecting to filter for the exact titlename. But seems like the titlename should be adapted, if it has a special character?

Ralph Schoon commented Aug 16 '22, 4:42 a.m.

Maybe the double hash is because the documented: . I am not sure, I have not done a lot with this API.

Comparison operand. When comparing xs:string properties, case insensitive. When comparing xs:string properties, may contain one or more wildcard characters1, including % (matches zero or many characters)1, _ (matches exactly one character)1, or a user-defined wildcard character1. Note, wildcard characters may be escaped by a proceeding # character and non-escape # characters must be escaped by a proceeding # character. URLs MUST be URL encoded (separate from the fields parameter) since they contain URI-reserved characters (see RFC 2396).

Be the first one to answer this question!

Register or to post your answer.