This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

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 "helpdeskURL/.../Tickets %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 "helpdeskURL/.../" > 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

Command:

  Invoke-RestMethod "helpdeskURL/.../Locations >Locations-customersites.txt


To produce a list of status types

Command:

Invoke-RestMethod "helpdeskURL/.../StatusTypes >Statustypes.txt

To get a list of priority types

Command:

Invoke-RestMethod "helpdeskURL/.../PriorityTypes >prioritytypes.txt

To request a list of request types

Command:

Invoke-RestMethod "helpdeskURL/.../RequestTypes >requesttypes.txt

Get a list of Techs and their IDs

Command:

Invoke-RestMethod "helpdeskURL/.../Techs >techs.txt

Ben

Parents
  • 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

    Ben

  • Hi Ben,

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

Reply Children
No Data