It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

PocketQuery Dynamic Parameters with REST

I've been looking around documentation for PocketQuery to find information on dynamic parameters using REST API queries but I can only seem to find examples for SQL queries. What I would like to do is enable dynamic parameters on my REST query so I can search through a list of names in a contact database without having to load up the entire database and just using a Table Filter macro. I see that in order to add in dynamic parameters you have to add in pq_ before the variable, but I am trying to filter on one of the columns that I am already pulling with my converter.

 

Can anyone help out?

1 answer

Hi @Ryan Davis

dynamic parameters are a macro option and don't have much to do with your query itself. By enabling dynamic parameters you're telling PocketQuery to look for parameters in the URL of your page to use in your query. So for example in this URL:

https://your-confluence.com/your-page?pq_year=2019

PocketQuery will pick up the year parameter and set it to 2019 if one of your queries in that page has a year parameter. Also see here for a further explanation.

I think what you are actually looking for are probably query parameters. You can define a query parameter in you query by using the colon syntax (e.g.: :myparam). This works both for SQL:

SELECT *
FROM customers
WHERE name = :name

and REST:

/customers/:name

By the way: You can also use so called wildcards. For example, if you want the name of the current page filled in automatically you could do:

/pages/:@page

You can find all available wildcards here. If you need specific help designing your query you can always raise a ticket at our HelpDesk for PocketQuery where we can help you with more details.

Hope that helps! :)

Best regards,
Sven

We're just testing your pocket query addon.

Is it possible to pass a parameter directly to a SQL statement without filling the parameter field in the Pocket Query macro.

So far I've only managed to do it this way
In the query


       Select * from Bla where user = :userFullName
       userFullName = String

and must then set the parameter


       userFullName = @userFullName

so that the logged in user can see his data.

In your example above


     /pages/:@page

seems as if you could pass the parameters directly through or only refers to the REST call because the SQL statement doesn't work like this

Select * from Bla where user = :@userFullName

 

Georg

 



Hi @Georg,

Yes, this is exactly what wildcards in Query statements are for! See them in the documentation: https://help.scandio.de/documentation/display/PQDOC/Queries#Queries-UsingParametersinQueries

:@userFullName may not work because wildcards might be case sensitive if I remember correctly. Have you also tried :@userfullname?

Cheers,
Sven

Hi Sven,

that's it!
:@userfullname then runs as expected

Thanks

Georg

Sweet! Should you encounter more questions don't hesitate to raise a ticket at our ServiceDesk. There you can also send us your concrete Queries, Templates and Converters privately. :)

Cheers,
Sven

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

327 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you