Dima Grotser
Dima Grotser

Reputation: 13

How to extract session id from response in jmeter?

How can I extract the session id from response?

{"game_url":"https://nogs-gl-stage.nyxmalta.com/game/?nogsgameid=110004&nogsoperatorid=421&sessionid=2007_a87178f4-a398-46f9-b156-a05da5040a37&nogscurrency=EUR&nogslang=en_us&nogsmode=real&accountid=7116&clienttype=html5&lobbyurl=https%3A%2F%2F%2Flobby%2Ffeatured-games",
 "non_regulated_game":"NON_REGULATED_GAME_MESSAGE"}

Upvotes: 1

Views: 6201

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

Example configuration would be:

  1. Add Regular Expression Extractor as a child of the request which returns the above response
  2. Configure it as follows:

    • Reference Name: anything meaningful, u.e. sessionid
    • Regular Expression: sessionid=(.+?)&
    • Template: $1$
  3. Refer extracted value as ${sessionid} or ${__V(sessionid)} where required later on

You can also use "RegEx Tester" view of the View Results Tree listener to test your regular expressions without having to re-run the request:

JMeter View Results Tree Regex Tester

References:

Upvotes: 2

Related Questions