Skip to main content

 

  When using the following endpoint, pagination works

> Invoke-RestMethod -Method GET -Headers $headers -Uri ($uri + "/tickets?$fsUpdatedSince&per_page=100&include=stats,tags") -ResponseHeadersVariable 'ticketsResponseHeader'


> $ticketsResponseHeader

Key                             Value
---                             -----
Date                            {Tue, 08 Jul 2025 05:43:06 GMT}
Transfer-Encoding               {chunked}
Connection                      {keep-alive}
status                          {200 OK}
x-freshservice-api-version      {latest=v2; requested=v2}
Link                            {<https://xxxxxxxx.freshservice.com/api/v2/tickets?updated_since=2025-06-01T10:40:21Z&per_page=100&include=stats,tags&page=2>; rel="next"}

 

However when using the /tickets/filter endpoint, the responseheader does not include the link attribute, so the built in functionality of Powershell 7 Invoke-RestMethod, FollowRelLink does not work. It would seem to be a bug?

 

$invokeParams = @{
method = "GET"
headers = $headers
uri = ($uri + '/tickets/filter?per_page=100&query="status:2%20OR%20status:3%20OR%20status:6%20OR%20status:7%20OR%20status:8%20OR%20status:9%20OR%20status:10"')
verbose = $true
MaximumRetryCount = 5
RetryIntervalSec = 10
}

> $result = Invoke-RestMethod @invokeParams -ResponseHeadersVariable 'myresponseHeader' -FollowRelLink

> $myresponseHeader

Key Value
--- -----
Date {Tue, 08 Jul 2025 05:45:20 GMT}
Transfer-Encoding {chunked}
Connection {keep-alive}
status {200 OK}
Cache-Control {no-store}
Strict-Transport-Security {max-age=31536000; includeSubDomains; preload}
x-freshservice-api-version {latest=v2; requested=v2}
Pragma {no-cache}
X-Request-ID {2d8d2c07-3c81-9371-bf16-xxxxxxxxxxxxxx}
x-envoy-upstream-service-time {368}
x-fw-ratelimiting-managed {true}
x-ratelimit-total {140}
x-ratelimit-remaining {139}
x-ratelimit-used-currentrequest {1}
x-trace-id {00-599ea5194f6104ffb0ce9be756f351ef-xxxxxxxxxxxxx-01}
nel {{ "report_to": "nel-endpoint-freshservice", "max_age": 2592000, "include_subdomains": true}}
report-to {{ "group": "nel-endpoint-freshservice", "max_age": 2592000, "include_subdomains": true, "endpoints": u{"url": "https://edge-admin.eu-central-1.freshedge.net/nelreports/freshservice"}]}}
Vary {accept-encoding}
cf-cache-status {DYNAMIC}
Set-Cookie {_
Server {cloudflare}
CF-RAY {xxxxxxxxx-CPH}
Content-Type {application/json; charset=utf-8}
Expires {Wed, 13 Oct 2010 00:00:00 GMT}

 

Join the Community or User Group to Participate in this Discussion

Reply