API integration with WHD

Hi All,

We've been working through integrating the Solar Winds Web Helpdesk with our in-house Job management/Accounting software and I thought I'd share some results.

We are using the powershell invoke-restmethod commandlet to query the API interface, but as a big disclaimer I am no expert and have a fair bit of help from the solarwinds team!

The main reason for posting is that I was very surprised at how little information on integration with this product there was on the web. So for what it's worth here it is.

For those looking, you will need the API manual: http://www.solarwinds.com/documentation/webhelpdesk/docs/whd_api_12.1.0/web%20help%20desk%20api.html

We needed to search for tickets that had a blank custom field so we new which tickets had not yet been synced with our JM/A system.

Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets?&qualifier=(customFields.stringValue %3D null)&apiKey=keygeneratedundertechaccount" > D:\tickets\NewJobs.txt

Then strip the ticket number out so we could get then query the ticket details. (sorry this became a table when I copied the line into this window...)

It also strips the leading spaces and outputs each tickets details into a file which is called the ticket number

select-string -pattern 'id            :' newjobs.txt | foreach {$_.tostring().Split(':')[4].trimstart()} | foreach {Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/$_/?&apiKey=keygeneratedundertechaccount" > details\$_}

We also wanted to be able to update the ticket custom field with the new job number from our system (you can see the ticket number I was experimenting with was 115 and the json file containing the new field value is called test.json)

Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/115?&apiKey=keygeneratedundertechaccount" -InFile test.json -Method Put

Contents of the test.json file looks like this (custom field ID is 13, Job number to be inserted E12345)

{"customFields": [ {"definitionId": 13, "restValue": "E12345"}]}

It's still a work in progress, as I mentioned I'm no expert. The next thing I have to do is work out how to query to show tickets that have been updated since last time I queried the Helpdesk system... so if anyone wants to chime in please do!

Other information I found useful along the way:

To produce a list of customers locations


  Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/Locations?&apiKey=keygeneratedundertechaccount" >Locations-customersites.txt

To produce a list of status types


Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/StatusTypes?&apiKey=keygeneratedundertechaccount" >Statustypes.txt

To get a list of priority types


Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/PriorityTypes?&apiKey=keygeneratedundertechaccount" >prioritytypes.txt

To request a list of request types


Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/RequestTypes?&apiKey=keygeneratedundertechaccount" >requesttypes.txt

Get a list of Techs and their IDs


Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/Techs?&apiKey=keygeneratedundertechaccount" >techs.txt


  • Hi Ben,

    Thanks for this info! Very helpful! Did you perhaps come across a way to access FAQ entries through this (or a third-party) API? I'm looking for such a functionallity, but it doesn't seem to be easy to find.



  • This is not currently possible Peter as I replied in this separate thread FAQ REST API?We track this now as a feature request.

  • Hi Ben,

    I'm just getting started with the API's, and wanted to know if you were able to create tickets?

  • Hi rford,

    Sorry for the delay responding - I haven't been back to this thread for a while. Do you know if I can subscribe to this thread so I know if someone has asked a question?

    Yes I most certainly have created tickets through the API. You have to use a JSON file and POST it.

    Example command:

    Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets?&apiKey=xdgsgshjfgjfgfgjfgjfgjfjfgjfgjfgjfgjfgjfgjfgjfgjfgjfgjfjfgjfgjfgjfgjfj8fRwM87" -InFile newticket.json -Method Post

    Example contents of JSON file:

    { "reportDateUtc": "2015-1-14T15:45:16Z", "room": "", "emailClient": false, "emailTech": true, "emailTechGroupLevel": false, "emailGroupManager": false, "emailCc": false, "ccAddressesForTech": "", "emailBcc": false, "bccAddresses": "", "subject": "Phone Support", "detail": "WANTED TO SPEAK TO YOU SORRY DIDNT GET WHAT ABOUT -TOMORROW MORNING IS FINE", "assignToCreatingTech": false, "problemtype": { "type": "ProblemType", "id": 7 }, "sendEmail": false, "location": { "type": "Location", "id": 51 }, "clientTech": { "type": "Tech", "id": 2 }, "customField_13": "E123545", "statustype": { "type": "StatusType", "id": 1 }, "prioritytype": { "type": "PriorityType", "id": 2 }, "assets": "" }

    Hope this helps


  • Hi Ben,

    Thanks for the reply. I was able to resolve. We had some custom fields that were mandatory.

  • Hi Ben,

    I could not create the ticket. My GET request are working fine but by post requests are not working and the error is "The remote server returned an error (404) not found." Pls help me. can u share some template code if you can.

  • Hi Kevin,

    The template we use is as posted above (it's a copy paste out of our powershell script)

    The only advice I would have for a 404 is watch your upper and lower case letters in the URL as the system is case sensitive!

    Also use something like Notepad++ with the JSON plugin to build and check your file.

    Sorry I can't really offer a direct answer.

    Perhaps you could paste your current API call? Obviously change any sensitive information in it and I can test it out here.



  • Hi,

    I have issue with creating ticket as well, but with different error. "Invoke-RestMethod : When no qualifier is provided, must specify a list type (list=mine|group|flagged|recent)." Do you have a idea what I have wrong?


  • Excellent post Ben!

    A couple other things I learned working with the REST API in powershell, c# and php.

    Sometimes the WHD returns JSON with square brackets, in c# you may need to trim those.  Additionally on your PUT's you may need to add them.  For those new to JSON (like me) square brackets denote a list or an array of objects.

    string strWHDAssetInNoBrackets = strWHDAssetIn.TrimStart(new char[] { '[' }).TrimEnd(new char[] { ']' });

    i.e. when updating the client on an asset,

    Invoke-RestMethod -Infile AssetClient.json -Method PUT "https://helpdesk.mydomain.com/helpdesk/WebObjects/Helpdesk.woa/ra/Assets/12676?apiKey=myAPIKey"

    Contents of AssetClient.json

    {"clients": [{"id": 1681,"type": "Client"}]}

    Pay attention to the POST vs PUT.  the documentation spells this out clearly.  If I'd read and digested the documentation first I'd have saved some time.

    While learning the syntax I found it helpful to work in powershell to get the syntax down, then move that knowledge to c# or php.

    We have https enabled on our server.  While http GET requests work, POST and PUT won't work.

  • Thanks for the post. I realize this is 3+ years old now.

    Has anyone been able to create a ticket with child types for the problemtype/requestType?

    What I mean is I can create a ticket and populate the Request Type field fine but I don't  have any documentation to populate the child drop downs for request type.

    I.E. Request type = "Employee Maintenance", Request Type "child" = "New Employee", Request Type "child to New Employee" = "Administration"

    Has anyone found any other api documentation using xml instead of json?  The api to create a ticket is inconsistent on each element and poorly documented outside the basic create.

    I am using Java to create the ticket

    Thanks for any insight.