- Community Home
- >
- Storage
- >
- Data Protection and Retention
- >
- HPE StoreOnce Backup Storage
- >
- Storeonce API authentication
Categories
Company
Local Language
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.This widget could not be displayed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2021 06:02 AM
03-02-2021 06:02 AM
I am trying to script some reports using powershell with the Storeonce api and I am struggling on even getting connected. I'm using the invoke-restmethod cmdlet and my code looks like this:
$username = 'myusername'
$password = 'mypassword'
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
$resp = Invoke-RestMethod -Method Post -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -ContentType 'application/json' -Uri 'https://mystoreonce.domain/pml/login/authenticatewithobject/'
The error I'm getting is:
Invoke-RestMethod : No content to map due to end-of-input
I've googled that error with no luck. Any ideas what I'm missing or doing wrong?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2021 05:55 AM
03-04-2021 05:55 AM
SolutionFigured it out:
$username = 'myusername'
$password = 'mypassword'
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $username,$password)))
Invoke-RestMethod -Method Get -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -ContentType 'application/json' -Uri 'https://mystoreoncefqdn/api/v1/data-services/cat/stores'
Basically, I dont need to authenticate to the uri given in the curl i just go right to the api endpoint I need and include auth info in the header.