Skip to content

Commit

Permalink
Applied 2048 character Limit based on PSA Docs
Browse files Browse the repository at this point in the history
- GET query strings have a limit of 2048 characters. URL elements count against the total character limit.
- POST is appropriate for more complex queries and does not have the same query string length limits of a GET.
- See [PSA Documentation - REST Basic Queries](https://www.autotask.net/help/DeveloperHelp/Content/APIs/REST/API_Calls/REST_Basic_Query_Calls.htm#Before)
  • Loading branch information
TheMonzel committed Apr 11, 2024
1 parent 278157c commit ec81a03
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Public/Get-AutotaskAPIResource.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function Get-AutotaskAPIResource {
$body = $SearchQuery
}
Default {
if (($Script:AutotaskBaseURI.Length + $ResourceURL.name.Length + $SearchQuery.Length + 15 + 50) -ge 2100){
if (($Script:AutotaskBaseURI.Length + $ResourceURL.name.Length + $SearchQuery.Length + 15 + 50) -ge 2048){
#15 characters for "//query?search="
#TODO: Calculation does not include Overwritten ParentID and is currently a better estimation. Therefore a "safe factor" of +50 chars is used
Write-Information "Using POST-Request as Request exceeded limit of 2100 characters. You can use -Method GET/POST to set a fixed Method."
Expand Down

0 comments on commit ec81a03

Please sign in to comment.