Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3607

RestAPI authentication with PowerShell

$
0
0

I am trying to access the API of OpenProvider using PowerShell and I can't seem to get past Authentication.

The documentation for the API is here : https://support.openprovider.eu/hc/en-us/articles/360025683173-Getting-started-with-Openprovider-API

And my code looks like this:

$EndPoint = "https://api.openprovider.eu/v1beta/auth/login"function Get-ConfHeaders {##Configure headers$Headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"$Headers.Add("ip","0.0.0.0") $Headers.Add("username","myusername") $Headers.Add("hash","APIpasswordhashgoeshere") return $Headers}$header = Get-ConfHeadersInvoke-RestMethod -Method Post -Uri $EndPoint -Headers $header 

The response get is :

Invoke-RestMethod : The remote server returned an error: (500) Internal Server Error.At line:36 char:1+ Invoke-RestMethod -Method Post -Uri $EndPoint -Headers $header+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

I am by no means an expert when it comes to API and any help would be appreciated.


Viewing all articles
Browse latest Browse all 3607

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>