0

Below is the response I am getting from my API and each time I use it, it'll generate a fresh token.

Return Response:-

{"status":true,"msg":"Login successfully","result":{"user_id":"9999940413020708","username":"Akhileshs","email":"akhileshs@beckett.com","last_login":"2016-05-26 06:57:41","first_name":"Akhilesh","last_name":"Singh","gender":"M","dob":"2016-03-30","token":"40df7635009e551beab7"}}

How do I get the token and user id and put these values into next HTTP request

Please let me know any further information is needed from my end.

thanks

1

It's fairly simple:

  1. Add JSON Path PostProcessor as a child of the request which returns above JSON
  2. Configure JSON Path PostProcessor as follows:

    • Variable names: anything meaningful, i.e. token
    • JSON Path Expressions: $..token
    • Other fields may be left as they are
  3. Refer extracted value as ${token} where required

JSON Path PostProcessor Demo

References:

0

That's a scenario that exists in most of the cases wherein you need to extract the authentication token post login. You should use the Regular Expression Extractor post-processor to extract the token, id or anything of this sort. Go to the Thread group and right click and then in the post-processor options you'll find the regular expression extractor option. You'll need to write a regex expression to extract the token or id and give a reference name as well that you can use as a variable in your next requests.

Thanks!

0

1) Add a Post Processor to parse the access token--> JSON Path Extractor and add the Below Expression

$.result.token

2) Define a variable for to save the access token value, in the JSON Path Extractor to save the parsed value. example variable name is 'token'.

3) whereever the access token is required invoke its value, just be defining as,

${<<Access token variable>>}
 example --> ${token}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.