Authentication for API call to create a new location is failing

Customer support for WHD referred me here:  You may contact directly our Dev team through THWACK using the link below:

https://thwack.solarwinds.com/

You will need to access the link, post your query about the scripting issue and they will reply.

 -------------------------------------------------------------

We are currently on version 12.8.3
I use a PowerShell script to setup new locations in Web Helpdesk. After the last security update the authentication for making the API call is failing.

URL Is: (actual URL is not posted) 
"">whd.somewebsiteurl.com/.../"

The API key was generated under my user settings in Web Helpdesk.

Below is the code for what is being attempted to create:

$NewLocation = @{
"address" = $StreetAddress
"city" = $City
"locationName" = $NewLocationName
"postalCode" = $ZipCode
"state" = $State
"country" = 'USA'
}

$objectcall = "Locations"
$FullURL = $baseurl + $objectcall + '?' + $apikey

Invoke-RestMethod -Method Post -Uri $FullURL -Body ($NewLocation | ConvertTo-Json) -ContentType 'application/json'

  • The API Documentation is not as straight forward with the authentication requirements and after a lot of trial and error I was able to get it going with the following combination:

    Basically, you need a username of a Tech and an Application API Key to successfully authenticate with WHD.

    • You can use an existing tech username (I use a generic account) Setup => Tech => Techs => (Chose your account)
    • You can create a new Application Key under Setup => General => Authentication



    The PS script would look something like this:

    $techUser = "admin"

    $apiKey = "abc1234"

    $baseUri = https://yourwhd.domain.com

    $NewLocation = @{
    "address" = $StreetAddress
    "city" = $City
    "locationName" = $NewLocationName
    "postalCode" = $ZipCode
    "state" = $State
    "country" = 'USA'
    }

    $uri = "$($baseUri)/helpdesk/WebObjects/Helpdesk.woa/ra/Locations?username=$($techUser)&apiKey=$($apiKey)"

    Invoke-RestMethod -Method Post -Uri $uri -Body ($NewLocation | ConvertTo-Json)

  • This was similar to what was being run but I like it better and it works.  I was recently advised that during this time frame we were renewing our domains and that a wild card was used for our webhelp desk site. I have been made aware that WHD does not work with wildcards and that we will have to correct our site certificate.  This was more than likely the cause of the problem and I was not made aware of the site renewal or changes.  Once our certificate is resolved I should be able to run this without issue and that the matter can be considered closed for now.