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'

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

Reply
  • 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)

Children
No Data