Open bilodeauj opened 1 month ago
I did some testing and found that instead of using the url_token, you can use the html_url in the reply and it will add the /r
I tested the following code against https://pwpush.com with the KillSwitch and FirstView switches and they work like a charm. I'm not 100% sure if first_view and retrieval_step had the same purpose, since first_view is no longer in the api documentation, but it kind of sounds like they do. It adds an initial "Click Here to proceed" link so things like chat, email security, etc. don't register as a view.
Since a number of the other conditions no longer applied i cleaned up the code and simplified it a bit.
Hope it helps
# Push the password, retrieve the response. Building the body on-the-fly to keep unsecured password not stored in a variable
$Reply = Invoke-RestMethod -Method 'Post' -Uri "https://$Server/p.json" -ContentType "application/json" -Body ([pscustomobject]@{
password = [pscustomobject]@{
payload = ConvertFrom-SecurePassword $Password
expire_after_days = $Days
expire_after_views = $Views
deletable_by_viewer = $KillSwitch.IsPresent
retrieval_step = $FirstView.IsPresent
}
} | ConvertTo-Json)
if ($Reply.html_url) {
# Dispose of secure password object - note it's the original object, not a function-local copy
if ($Wipe) {$Password.Dispose()}
return $Reply.html_url
} else {
Write-Error "Unable to get URL from service"
}
Hi,
I just started using this module with the pwpush.com site and noticed an issue in the implementation of the -FirstView switch in the Publish-Password cmdlet.
According to the current API document https://pwpush.com/api/1.1/pushes/create.en.html there is no "first_view" paramater, it is instead called "retrieval_step"
If you simply update first_view to retrieval_step in the Publish-Password cmdlet, you'll notice that it won't give the expected result. What i noticed is that if the $Reply.retrieval_step = True, they you need to add /r to the url_token. for example "https://$Server/p/$($Reply.url_token)/r"
now when you use that url, you'll get the option to that says "Click here to continue"