- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
logout API not working
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-11-2019 07:07 AM
Hi,
Just doing some testing here, I am by no means and expert when it comes to REST API programming.
I've managed to successfully authenticate and then use the cookie for subsequent calls, but when I call the /logout method I get an HTTP error 500 and the cookie is still valid. Here's the output from my test script that just gets the grid object:
C:\Users\robertsp\Documents>perl scripts\infoblox\ib_login_test.pl 192.168.0.33 paul
Password: *********
Session timeout = 3600
HTTP response = 200
$VAR1 = '{"_ref": "grid/b25lLmNsdXN0ZXIkMA:Infoblox"}';
Call logout API
HTTP response = 500
Get grid object after logout
HTTP response = 200
$VAR1 = '{"_ref": "grid/b25lLmNsdXN0ZXIkMA:Infoblox"}';
The bit in red is where it's going wrong.
This is my logout API call:
my $headers = {
Accept => 'application/json'
};
$client->POST('/logout',$headers);
If I log out ok then the final call should fail, but it still works because the cookie didn't get cleared. Am I doing something wrong?
PCN (UK) Ltd
All opinions expressed are my own and not representative of PCN Inc./PCN (UK) Ltd. E&OE
Solved! Go to Solution.
Re: logout API not working
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
06-12-2019 03:33 AM
Ok I think I figured this out. I was passing headers in my API call, if I don't explictly pass any then it works.
e.g. I changed this:
$client->POST('/logout',$headers);
to this:
$client->POST('/logout');
I am so used to passing headers I didn't think to *not* pass them. Doh!
PCN (UK) Ltd
All opinions expressed are my own and not representative of PCN Inc./PCN (UK) Ltd. E&OE