When you want to pass extra information along with your API request, like a ticket ID, customer email, or a specific status, query parameters come in handy. These small but powerful additions to your API URL help external systems understand exactly what you’re trying to fetch, filter, or send.
Let’s understand what they are, how to use them, and why they matter.
What are Query Parameters?
Query parameters are key-value pairs added at the end of an API URL. They help fine-tune your API request to get the specific data you want or send relevant details to the server.
You’ll recognize them by the way they appear in URLs, such as:
https://api.example.com/tickets?ticketId=12345
In this example:
- ticketId is the key
- 12345 is the value
You can also pass multiple parameters by separating them with an ampersand (&)
https://api.example.com/tickets?ticketId=12345&status=Open&priority=High
This way, you’re telling the system: “Give me ticket 12345 that is Open and marked as High priority.”
Why use Query Parameters?
Query parameters help you:
- Get only the data you need instead of fetching everything
- Filter results based on conditions like status, priority, or date
- Pass user or ticket-specific details dynamically during a bot conversation
- Avoid sending unnecessary information in the request body
Where do you use them?
In the Webhook block of your bot flow, you’ll see an option to add Query Parameters. This is where you can enter the key and value pairs you need.
Here’s what that might look like:
- Key: ticketId
- Value: @ticket.id
- This tells the bot to take the current ticket’s ID and pass it to the API dynamically.
You can add up to 20 query parameters in one Webhook request.
Examples
1. If you want to get the details of a specific ticket using an external system:
API URL: https://api.example.com/tickets
Query Param:
- Key: ticketId
- Value: {{ticket.id}}
Final request:
https://api.example.com/tickets?ticketId={{ticket.id}}
2. Let’s say you only want to fetch tickets that are currently “Open”:
API URL: https://api.example.com/tickets
Query Param:
- Key: status
- Value: Open
Final request:
https://api.example.com/tickets?status=Open
3. Fetch Multiple Associated Details
Some APIs (like Zoho Desk’s) allow you to include related modules like contacts or products along with the main request.
For example:
https://desk.zoho.com/api/v1/tickets/1892000000143237?include=contacts,products,assignee,departments,team
Here, the include parameter is used to ask Zoho Desk to return extra data related to the ticket, such as:
- Contact associated with the ticket
- Products linked
- Assigned agent
- Department and team involved
Benefits of using Query Parameters
- Keep your API requests clean and simple
- Avoid over-fetching data; get only what you need
- Make your bot more dynamic by passing real-time user inputs
- Stay aligned with best practices for most REST APIs
Tips
- Always refer to the API documentation to know what parameters are supported.
- Use variables (like {{ticket.id}} or {{user.email}}) to personalize requests.
- Query parameters are optional but very useful; don’t ignore them if you need filtering.