yoke88 / PSPHPIPAM

MIT License
21 stars 18 forks source link

Update for new API calls? #1

Closed matt-matt2 closed 6 years ago

matt-matt2 commented 6 years ago

Is anyone working on updates to support new API calls?

matt-matt2 commented 6 years ago

(this is the quietest github issues list I've ever seen..)

leoessabba commented 6 years ago

I was using it, but since we updated to 1.31 version, we have issues. Could someone update it , please? Thank you!

yoke88 commented 6 years ago

can you post your issues ? for example: the details of error message and the command you use

leoessabba commented 6 years ago

Thanks for your attention.

Actually, we could fix the problem changing a tiny detail. Instead of using: $PhpIpamApiUrl = 'https://phpipam.test/phpipam/api/'

I changed it to: $PhpIpamApiUrl = 'https://phpipam.test/phpipam/api/index.php'

Now it is ok. Sorry to bother you.

matt-matt2 commented 6 years ago

Hmm. I'm now seeing failures setting up a session. I would imagine that like the above user these failures came in at the upgrade to v1.3.1.

The above "URL fix" doesn't seem to work for me. The API key and paths are still valid in the web UI. I'll try some manual commands to look at this in more detail when I get a chance.

New-PhpIpamSession : Exception of type 'Microsoft.PowerShell.Commands.WriteErrorException' was thrown.
At D:\Scripts\IPAM\check_ipam.ps1:21 char:11
+ $result = New-PhpIpamSession -useAppKeyAuth -PhpIpamApiUrl "$ApiUrl" -AppID "$Ap ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-PhpIpamSession

Full command used: New-PhpIpamSession -useAppKeyAuth -PhpIpamApiUrl https://<redact>/phpipam/api/ -AppID deployment -AppKey <redact>

yoke88 commented 6 years ago

New-PhpIpamSession support debug switch ,you can turn it on to see what is going wrong

New-PhpIpamSession -useAppKeyAuth -PhpIpamApiUrl https://<redact>/phpipam/api/ -AppID deployment -AppKey <redact> -debug

matt-matt2 commented 6 years ago

The -debug flag does not help in this instance, but I stepped through the code with the debugger and got a trap in PhpIpamBaseFunctions line 381 during the call to:

            $r=Invoke-RestMethod -Method get -Uri $uri 

The error message that comes up actually refers to the call to "write-error" following the {catch} on line 393.

Up to this point I can't see any issues with the uri construction. There's no output from adding "-Debug" to this command. Any thoughts? I'll continue looking around..

matt-matt2 commented 6 years ago

Know what I figured it out .. turns out someone had put a redirect-to-https in the IPAM web server config and the self signed cert was not trusted. Drop it back to http:// and it's working fine again. Sorry for the noise ..

yoke88 commented 6 years ago

thanks for the feedback and the root cause you found,good work.

invoke-webrequest has no switch to ignore ssl trust now, so if you want use ssl , using cert signed by your enterprise ca or public ca.


From: matt-matt2 notifications@github.com Sent: Friday, June 1, 2018 10:36:07 PM To: yoke88/PSPHPIPAM Cc: yoke88; Comment Subject: Re: [yoke88/PSPHPIPAM] Update for new API calls? (#1)

Know what I figured it out .. turns out someone had put a redirect-to-https in the IPAM web server config and the self signed cert was not trusted. Drop it back to http:// and it's working fine again. Sorry for the noise ..

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/yoke88/PSPHPIPAM/issues/1#issuecomment-393900160, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADAB8ghl8HZq1cT-90ITDpAjcpPFy1LPks5t4VFXgaJpZM4Q_RPS.