webworm00
(Patrick Chia)
January 27, 2023, 7:36am
1
I’m trying to test Meta APIs on Postman mock servers. I tried to create a contextual response using the $queryParams template helpers to an example in my mocked collection as shown here .
It works when my query string key is simple text containing only alphabets. However, if my key has a dot (.) in it, it does not seem to work e.g. “hub.challenge”:
https://xxxx.mock.pstmn.io/hook?hub.challenge=123123123
According to the docs, it seems to be able to use the \ character to escape the dot(.):
However, when I try it out, the response is blank:
I’ve already tried using “hub\.challenge” and “hub.challenge” in the contextual response template but none works. If I change the key to something like “hubchallenge” instead of “hub.challenge”, then it works properly.
Does anyone have any idea or solution to this? Thanks.
w4dd325
(w4dd325)
January 27, 2023, 9:54am
2
Hi @webworm00
Try removing the double quotes.
{
{{$queryParams 'hub\.challenge'}}
}
The quotes pass the text as a string but if you see the examples on the page you linked they are without quotes.
webworm00
(Patrick Chia)
January 28, 2023, 1:22am
3
Hi, if I remove the double quotes, it simply returns blank:
w4dd325
(w4dd325)
January 28, 2023, 1:00pm
4
Try removing the back slash. A dot shouldn’t need to be escaped in URL encoding as far as I am aware.
If that doesn’t work I’ll set up a mock and have a play around with it
webworm00
(Patrick Chia)
January 28, 2023, 2:06pm
5
Tried
{{$queryParams ‘hub.challenge’}}
{{$queryParams ‘hub\.challenge’}}
{{$queryParams ‘hub\\.challenge’}}
All of them returns blank
I’ve been playing with this for the last hour to no avail.
The stub itself is working, as I added another element which returns.
Therefore the . in the parameter is being recognised.
I’ve tried all variations of escape characters including URL encoding ($2e, %2e, etc).
In the end, out of desperation, I created a collectionVariable called Param and used that in the Example.
{
"{{$queryParams {{param}}}}"
}
This does something really strange as it is finding the parameter but its wrapping it in an object, instead of just showing the value.
{
"{"hub.challenge":"1234567"}"
}
So close, but yet so far.
I guess all I can really say is that I can confirm that having the . is causing a problem.
I’m off to play the Xbox. Have a good weekend.
Amending the example to just include the following.
{{$queryParams {{param}}}}
Now produces a single json object in the response (removing the extraneous quotes)
Still not just the value as you would expect though.
{
"hub.challenge": "1234567"
}
If you change the value of hub.challenge, it is returning the updated value.
Not sure if that is acceptable.
Scrub that last bit, as I’ve just realised that this is basically ignoring the param.
It needs to be a valid variable, but is basically being ignored.
It’s basically like calling $queryParams without any arguments or with empty quotes.
You’ll get the same results. It returns all of the params in the mock as an object (which may be a work around).
The stub itself works, with the dots in.
It’s just the $queryParams in the mock doesn’t seem to be able to handle the dots when trying to return a specific parameter.
The common solution to using escape characters doesn’t seem to be supported.
Might be a bug that should be raised on the Postman Github.
w4dd325
(w4dd325)
January 28, 2023, 8:34pm
9
Have raised this as a bug on Postman GitHub:
opened 08:33PM - 28 Jan 23 UTC
### Is there an existing issue for this?
- [X] I have searched the tracker for … existing similar issues and I know that duplicates will be closed
### Describe the Issue
The instructions for [Generating contextual mock responses](https://learning.postman.com/docs/designing-and-developing-your-api/mocking-data/creating-dynamic-responses/) suggest that you can "Return the value of the property a.a which has a dot (.) in the key name" by using a backslash like this, "{{$body 'a\\.a'}}".
However, if there is a dot(.) present, for example, _"hub.challenge": 123123123_ then the back slash does not work to escape the character and no value is displayed.
Original discussion here:
https://community.postman.com/t/cannot-get-value-from-queryparams-key-if-key-name-contains-dot/43285
Example not working:
Mock server example:

No param displayed when called:

Exmaple working if dot(.) is removed:
Mock server example:

Param displayed when called:

### Steps To Reproduce
1. create a mock with query param with a dot(.) eg. "hub.chellenge"
2. try to get the param by using the example provided in Postman docs: "{{$queryParams 'hub.challenge'}}"
3. no value is passed
4. add a backslash \\ before the dot(.) as per instructions
5. still no value displayed
6. Remove the dot(.)
7. value is then passed
### Screenshots or Videos
_No response_
### Operating System
Windows
### Postman Version
10.8.7
### Postman Platform
Both
### User Account Type
Signed In User
### Additional Context?
_No response_
1 Like
I was just trying to do the exact same thing with Facebook webhook setup and ran into the same problem. After a couple hours of fighting with it, I stumbled on to this thread. Very frustrating to get stuck at step 1 of testing out some web hooks. Not sure if I’m more bothered by the fact that Facebook decided to include a ‘.’ in the query params, or that postman couldn’t handle it properly
I didn’t see a way to +1 the issue that was opened on Github, but would gladly do something there if it would get more attention on this one.
webworm00
(Patrick Chia)
February 15, 2023, 7:45am
11
Personally I moved to using pipedream to test the webhooks since I do not know when or if it will be resolved.