Conncet to API via powershell

Invoke-WebRequest -Uri -Method Post -Headers @{ 'x-api-key' = $apiKey ; "username" = "XXXXXXXXXX" ; "password"="XXXXXXXXXXXX" }


ITHe Apikey work fine but i get this erro no matter what 




i ty this way to

$apiKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
$Credential = Get-Credential
Invoke-WebRequest -Uri -Method Post -Headers @{ 'x-api-key' = $apiKey } -Credential $Credential





  • This info help alot thx 

  • i get the token fine now but this it's wierd i ty to get companies or any other GET





    $apiKey = 'XXXXXXXXXXXXXX'
    Write-Output (Invoke-WebRequest -Uri "" -Method Get -Headers @{ 'x-api-key' = $apiKey ; Authorization = "Bearer $Token" }




  • PetriKuikka
    PetriKuikka Posts: 228 F-Secure Employee

    Hmm, odd, your call looks really right to me as following curl command works fine:


    curl -X GET -H "X-Api-Key: $api-key" -H "Authorization: Bearer $token" ""


    Are you sure the 102, is the same partner ID, you login in?



  • PetriKuikka
    PetriKuikka Posts: 228 F-Secure Employee

    I quickly checked our logs and your calls are getting rejected either by following 2 reasons:


    "resource":"/mp/v1/partners/102/companies?page=1&perPage=2","message":"No authorization token was found","backendStatus":401


    So somehow the token is not in the message.


    "resource":"/mp/v1/partners/102/companies?page=1&perPage=2","message":"Format is Authorization: Bearer [token]","backendStatus":401


    Or somehow the format is not correct how you give the token to authorization.

This discussion has been closed.