Get available HubSpot ticket filters
curl --request GET \
--url http://localhost:2000/hubspot/tickets/list/filters \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:2000/hubspot/tickets/list/filters"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:2000/hubspot/tickets/list/filters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "2000",
CURLOPT_URL => "http://localhost:2000/hubspot/tickets/list/filters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:2000/hubspot/tickets/list/filters"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:2000/hubspot/tickets/list/filters")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:2000/hubspot/tickets/list/filters")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "",
"data": {
"agents": [
{
"label": "Abdullah",
"value": "abdullah"
}
],
"categories": [
{
"label": "Late Driver",
"value": "Late Driver"
}
]
}
}Ticket Management
Get Ticket Filters
Retrieves possible filters and their values to be displayed in the frontend dropdowns. Currently supports two filter types: - Agents (all agents) - Categories (all feedback categories)
GET
/
hubspot
/
tickets
/
list
/
filters
Get available HubSpot ticket filters
curl --request GET \
--url http://localhost:2000/hubspot/tickets/list/filters \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:2000/hubspot/tickets/list/filters"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:2000/hubspot/tickets/list/filters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "2000",
CURLOPT_URL => "http://localhost:2000/hubspot/tickets/list/filters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:2000/hubspot/tickets/list/filters"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("http://localhost:2000/hubspot/tickets/list/filters")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:2000/hubspot/tickets/list/filters")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "",
"data": {
"agents": [
{
"label": "Abdullah",
"value": "abdullah"
}
],
"categories": [
{
"label": "Late Driver",
"value": "Late Driver"
}
]
}
}Retrieves possible filters and their values to be displayed in the frontend dropdowns. Currently supports two filter types: Agents (all agents) and Categories (all feedback categories).
Request
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token |
Response
200 OK - Successfully retrieved filter options
{
"message": "",
"data": {
"agents": [
{
"label": "Abdullah",
"value": "abdullah"
},
{
"label": "John Doe",
"value": "john-doe"
},
{
"label": "Jane Smith",
"value": "jane-smith"
}
],
"categories": [
{
"label": "Late Driver",
"value": "Late Driver"
},
{
"label": "Vehicle Issue",
"value": "Vehicle Issue"
},
{
"label": "Customer Complaint",
"value": "Customer Complaint"
},
{
"label": "Billing Issue",
"value": "Billing Issue"
}
]
}
}
401 Unauthorized
{
"error": {
"code": "UNAUTHORIZED",
"message": "Missing or invalid token"
}
}
500 Internal Server Error
{
"error": {
"code": "SERVER_ERROR",
"message": "Internal server error"
}
}
Example
curl -X GET 'http://localhost:2000/hubspot/tickets/list/filters' \
-H 'Authorization:Bearer your-jwt-token'
Data Fields Explained
Agents Array
| Field | Type | Description |
|---|---|---|
| label | string | Display name for the agent |
| value | string | Internal value used for filtering |
Categories Array
| Field | Type | Description |
|---|---|---|
| label | string | Display name for the feedback category |
| value | string | Internal value used for filtering |
Use Cases
- Dropdown Population: Populate filter dropdowns in frontend
- Dynamic Filtering: Enable users to filter by agent or category
- Form Validation: Validate filter values before API calls
- User Interface: Build filter controls with available options
Implementation Examples
React Component Example
import React, { useState, useEffect } from 'react';
function TicketFilters({ onFilterChange }) {
const [filters, setFilters] = useState({ agents: [], categories: [] });
useEffect(() => {
fetch('/hubspot/tickets/list/filters', {
headers: { 'Authorization': `Bearer ${token}` }
})
.then(response => response.json())
.then(data => setFilters(data.data));
}, []);
return (
<div className="ticket-filters">
<select onChange={(e) => onFilterChange('agent', e.target.value)}>
<option value="">All Agents</option>
{filters.agents.map(agent => (
<option key={agent.value} value={agent.value}>
{agent.label}
</option>
))}
</select>
<select onChange={(e) => onFilterChange('category', e.target.value)}>
<option value="">All Categories</option>
{filters.categories.map(category => (
<option key={category.value} value={category.value}>
{category.label}
</option>
))}
</select>
</div>
);
}
Vue.js Example
<template>
<div class="filters">
<select v-model="selectedAgent" @change="applyFilters">
<option value="">All Agents</option>
<option v-for="agent in filters.agents" :key="agent.value" :value="agent.value">
{{ agent.label }}
</option>
</select>
<select v-model="selectedCategory" @change="applyFilters">
<option value="">All Categories</option>
<option v-for="category in filters.categories" :key="category.value" :value="category.value">
{{ category.label }}
</option>
</select>
</div>
</template>
<script>
export default {
data() {
return {
filters: { agents: [], categories: [] },
selectedAgent: '',
selectedCategory: ''
};
},
async created() {
const response = await fetch('/hubspot/tickets/list/filters', {
headers: { 'Authorization': `Bearer ${this.token}` }
});
this.filters = (await response.json()).data;
}
};
</script>
Best Practices
- Caching: Cache filter data to avoid repeated API calls
- Error Handling: Handle cases where filters are unavailable
- Loading States: Show loading indicators while fetching filters
- Validation: Validate filter values before using in list API
- Accessibility: Ensure dropdowns are accessible and keyboard-navigable
Related Endpoints
- Use
/hubspot/tickets/listwith filter values from this endpoint - Use
/hubspot/tickets/list/exportwith same filter options - Use
/hubspot/ticket-details/{ticketId}for individual ticket details
Notes
- Agent list includes all active agents in the system
- Categories include all feedback categories from HubSpot integration
- Filter values are case-sensitive and must match exactly
- This endpoint should be called before rendering filter controls
- Data is updated in real-time as agents and categories change
Integration Guidelines
Before Using Filters
- Call this endpoint to get available options
- Store filter options in component state
- Use values (not labels) for API calls
- Validate filter values before submitting
Filter Value Mapping
- Use
valuefield for API parameters - Use
labelfield for display text - Maintain mapping between labels and values
- Handle cases where filter options change dynamically
Error Handling
- Handle 401 errors by redirecting to login
- Handle 500 errors with retry logic
- Provide fallback options when filters unavailable
- Show user-friendly error messages
Was this page helpful?