Reply
Highlighted

logout API not working

Expert
Posts: 204
96     0

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?

Paul Roberts
PCN (UK) Ltd

All opinions expressed are my own and not representative of PCN Inc./PCN (UK) Ltd. E&OE

Re: logout API not working

Expert
Posts: 204
97     0

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!

Paul Roberts
PCN (UK) Ltd

All opinions expressed are my own and not representative of PCN Inc./PCN (UK) Ltd. E&OE
Showing results for 
Search instead for 
Do you mean 

Recommended for You