Quantcast
Channel: Support Portal
Viewing all articles
Browse latest Browse all 2278

Re : Proposed new version of REST API

$
0
0
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.


  1. $workorderid = 123456
  2. $techkey = "xxxxx-xxxx-xxxx-xxxx-xxxxxxx"

  3. $uri = "https://yourURLhere/api/v3/tasks"
  4. $inputdata = @"
  5. {
  6.     "list_info": {
  7.         "row_count": "25",
  8.         "search_fields": {
  9.             "request": "123456"
  10.         }
  11.     },
  12.     "fields_required": [
  13.         "id",
  14.         "title",
  15.         "description"
  16.     ]
  17. }
  18. "@
  19. #credentials to access SDP
  20. $cred = Get-Credential

  21. $params = @{INPUT_DATA=$inputdata;TECHNICIAN_KEY=$techkey;format='json'}
  22. $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.

Viewing all articles
Browse latest Browse all 2278

Trending Articles