AnsweredAssumed Answered

Qualys API v2.0 C# - Unable to perform logout session

Question asked by Chris Hutchinson on Aug 5, 2014
Latest reply on Aug 7, 2014 by Eric Perraudeau

Hi All,


I'm writing a Windows based application in C# to interface with our QualysGuard account. I can perform a logon and other functions (asset search, asset group lookup, etc), however, I can't seem to get the logout API call to function!


Whenever I attempt to logout of a session, I am presented with the following:


Status Code = Forbidden


"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE SIMPLE_RETURN SYSTEM \"\">\n<SIMPLE_RETURN>\n  <REQUEST>\n    <DATETIME>2014-08-05T18:46:30Z</DATETIME>\n    <RESOURCE></RESOURCE>\n    <PARAM_LIST>\n      <PARAM>\n        <KEY>action</KEY>\n        <VALUE>logout</VALUE>\n      </PARAM>\n      <PARAM>\n        <KEY>echo_request</KEY>\n        <VALUE>1</VALUE>\n      </PARAM>\n    </PARAM_LIST>\n  </REQUEST>\n  <RESPONSE>\n    <DATETIME>2014-08-05T18:46:30Z</DATETIME>\n    <CODE>2010</CODE>\n    <TEXT>Bad Login/Password</TEXT>\n  </RESPONSE>\n</SIMPLE_RETURN>\n"


My RestRequest has the following parameters set:







My headers in the API call are as follows:


var request = new RestRequest("api/2.0/fo/session/", Method.POST);

request.AddHeader("X-Requested-With", "RestSharp");

request.AddParameter("action", "logout");

request.AddParameter("echo_request", "1");

request.AddHeader("Cookie", "QualysSession=" + Models.Login.SessionID);


Has anyone encountered this problem before and/or know how to resolve it? It's driving me crazy being able to do everything, but seemingly the easy API call of all!