Forum Discussion

Cata's avatar
Cata
Occasional Contributor
3 years ago
Solved

How to combine 2 JSON values to then send in a follow-up request?

Hi there,

I have a situation with an authorization token that I need to use for subsequent requests.
So, from my first request I get a json response in the form of a token as two different properties e.i. 
tokenType: Bearer
Token: 7yw7adwadaawaw9d9

Now all of my follow up requests need to contain these values in one header in the request, like this:
Authorization: Bearer 7yw7adwadaawaw9d9

Now, I have tried to use the Property Transfer option but it doesn't seem to work because it only allows me to send one json property in the header of my future requests, so my question is:
Can I somehow combine the two properties to come together exactly like in the example mentioned above and send them in that Header, like that?


Any help would be greatly appreciated.
Thank you very much

  • Save the token in Project level custom properties, say TOKEN
    In the test request step, add Header
    Authorization and value as Bearer ${#Project#TOKEN}

2 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    Save the token in Project level custom properties, say TOKEN
    In the test request step, add Header
    Authorization and value as Bearer ${#Project#TOKEN}
    • Cata's avatar
      Cata
      Occasional Contributor

      I couldn't save the token at project level because it's dynamic and it refreshes every few minutes but I managed to take the token from my initial request and add it in a Property Transfer test step and then write the Authorization Header on my subsequent requests with the Bearer ahead of the syntax which called the token.
      So thank you very much. Your syntax helped me.