Hello!
I'm having some issues designing a process that would invovle reading all of the tasks assigned to a technician via the API.
When i attempt to use the api query designer in the documentation, i get the results that i would like -- All tasks owned by a particular technician, but when i copy either the code example or the JSON information and run from powershell, i receive what appears to be ALL tasks, and not the ones i'm searching for.
When i view the returned object i also note that none of the information i've placed in the JSON for the search, shows up under the list_info section of the return data:
- #Powershell version - 5.1
$url = "https://XXXX/api/v3/tasks"
$technician_key = @{ 'authtoken' = 'XXX'}
$input_data = @'
{
"list_info": {
"row_count": "12",
"start_index": "2",
"get_total_count": "true",
"sort_fields": [
{
"field": "title",
"order": "asc"
},
{
"field": "created_time",
"order": "desc"
}
],
"filter_by": {
"id": "1"
},
"search_criteria": {
"field": "priority",
"condition": "is not",
"values": [
{
"id": "1"
}
],
"children": [
{
"field": "additional_cost",
"condition": "lte",
"values": [
100
],
"logical_operator": "AND"
},
{
"field": "marked_owner.name",
"condition": "like",
"values": [
"Howard Stern"
],
"logical_operator": "OR"
}
]
},
"fields_required": [
"id",
"status",
"additional_cost",
"created_time"
]
}
}
'@
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method get -Body $data -Headers $technician_Key -ContentType "application/x-www-form-urlencoded"
$response
The above example is taken directly from the directions page, with the addition of 'get_total_rows' When run from the API Directions page, i get total count of 244, when run from powershell or python i get the total count of all tasks in the system (over 10k).
I can also see that in th returned information the list_info does not contain any of the filter, or search information as it does on the documentation page:
- has_more_rows : True
start_index : 1
end_index : 100
get_total_count : False
row_count : 100
Is there an error in my code above or something i'm missing? Does anyone have any suggestions on how i can move foward with retreiving all Tasks assigned to a technician?
Thank you!