Information:

Environment

  • Dynatrace Recorder with the Firefox Agent.

 

Symptoms

Need to parse a session ID out of the response of an API (Web Service) call.

Solution

The following code will parse a GUID found between <SessionId> tags, and place it in a variable.

Type the following code in the Reply Handler of an HTTP Action in the Dynatrace Recorder:

sessionID = "";
if (response.status == '200') {
var body = response.content;
var sessionID = body.match(/SessionId[^>]+>([^<]+)/)[1];
}

alert(sessionID);

 

 

 

 

  • No labels