This object is in archive! 

API V3 example

Gabor shared this idea 4 years ago
Under Consideration

Hello,

I tried to connect to my V3 Zipabox through API with Python and Powershell scripts but despite I got back '200' answer when I try to GET anything I am getting back HTML site where clearly stated that I am not authenticated.

Can someone share a working example of how can I connect properly because I am cannot find any related entry on the API documentation.

FE with python:

# auth = {USERNAME,PASSWORD}
auth ={'username':'***', 'password':'***'}

r =requests.get('https://my3.zipato.com:443/zipato-web/v2/abilities',data = auth)
print(r.status_code)
print(r.text)
FE with Powershell:


$login="***"
$password="***"
Function Get-StringHash([String] $String,$HashName = "SHA1")
{
$StringBuilder = New-Object System.Text.StringBuilder
[System.Security.Cryptography.HashAlgorithm]::Create($HashName).ComputeHash([System.Text.Encoding]::UTF8.GetBytes($String))|%{
[Void]$StringBuilder.Append($_.ToString("x2"))
}
$StringBuilder.ToString()
}
$sessioninit=Invoke-RestMethod -uri https://my3.zipato.com:443/zipato-web/v2/user/init -SessionVariable sessionvar
$sha1=Get-StringHash $password
$nounce=$sessioninit.nonce
$token1=$nounce+$sha1
$token= (Get-StringHash $token1)
$url="https://my3.zipato.com:443/zipato-web/v2/user/login?username="+$login+"&token="+$token
$session= Invoke-RestMethod -Uri $url -WebSession $sessionvar

Invoke-RestMethod -uri https://my3.zipato.com:443/zipato-web/v2/abilities -WebSession $sessionvar

Thanks.

Replies (1)

photo
1

It sounds like you're encountering an authentication issue with your V3 Zipabox API. For detailed and professional assistance, you can essays order for expert guidance on technical writing and coding projects. Ensure that your authentication tokens or credentials are correctly included in your API requests

Leave a Comment
 
Attach a file