Knowledge Base API

Raffael_JenzerRaffael_Jenzer Customer IT Monkey ✭
Hi

We're trying to get KB articles with API calls.

Here is our Powershell-Script:
---
param ($Data1,
    $Data2,
    $Data3,
    $Data4,
    $Data5,
    $Data6,
    $Data7)

#enter your portal URL here
$site = "https://portal.xxxxx.xx"

$credentials = @{
    UserName = 'DOMAIN\username'
    Password = 'password'
    LanguageCode = 'ENU'
}
$jsonCredentials = $credentials | ConvertTo-Json

#first retrieve your access token
$url = $site + "/api/V3/Authorization/GetToken"

$apiKey = try { Invoke-RestMethod $url -Method POST -Body $jsonCredentials -ContentType 'application/json' } catch { $_.Exception.Response }

$authVal = "Token " + $apiKey

$Data5 = 76

$url1 = $site + "/api/V3/KnowledgeBase/GetKnowledgeArticle?articleId={$Data5}"
#$url1 = $site + "/api/V3/User/GetUserList" --> diese Abfrage funktioniert.


$response1 = try { Invoke-RestMethod $url1 -Method GET -ContentType 'application/json' -Headers @{ "AUTHORIZATION" = $authVal } }
    catch { $_.Exception.Response }
---

We're not able to get a result with this script. Could someone help us?

Thanks,
Raffael
Sign In or Register to comment.