Alright, I've managed to figure out the new api system. Here's an example of searching for all tasks belonging to a request. Note that I you will need to change the variable to match your environment.
Key difference is that you must pass credentials into Invoke-WebRestMethod using the -credential switch. These credentials need to have the ability to login to your service desk plus environment. You still need to pass your technician key as well.
- $workorderid = 123456
- $techkey = "xxxxx-xxxx-xxxx-xxxx-xxxxxxx"
- $uri = "https://yourURLhere/api/v3/tasks"
- $inputdata = @"
- {
- "list_info": {
- "row_count": "25",
- "search_fields": {
- "request": "123456"
- }
- },
- "fields_required": [
- "id",
- "title",
- "description"
- ]
- }
- "@
- #credentials to access SDP
- $cred = Get-Credential
- $params = @{INPUT_DATA=$inputdata;TECHNICIAN_KEY=$techkey;format='json'}
- $response = Invoke-RestMethod -Uri $uri -Method GET -Body $params -Credential $cred
All this so that we may take the hash table of tasks and then run a loop to update all tasks titles to include information from the request itself.