AnsweredAssumed Answered

How to use a variable/field in JSON header?

Question asked by joeprice99 on Sep 24, 2018
Latest reply on Sep 24, 2018 by joeprice99

Hello:

 

Once I have a token to authenticate with an API stored in a field/variable, how do I stick it back in the cURL in future requests? 

 

If I set it up manually like this it works-

"-X GET

-H \"Cache-Control:no-cache\"

-H \"Content-type: application/json\"

-H \"X-RM12Api-ApiToken: W12l20JDHhNhg2l2Nenis5CgC5qTFMTKILPuW8_lhIKGTLENda_oR5ycU2PoYKEbPB7LI8UeQ32HDGZCRvuKPo0v3grpxpycTHc835VJ19I=\""

 

How do I change

-H \"X-RM12Api-ApiToken: W12l20JDHhNhg2l2Nenis5CgC5qTFMTKILPuW8_lhIKGTLENda_oR5ycU2PoYKEbPB7LI8UeQ32HDGZCRvuKPo0v3grpxpycTHc835VJ19I=\""

 

to something that I can pull from a field?  I've been trying to set it up like

 

-H \"@$token\""

 

with $token being

JSONSetElement( "{}"; ["X-RM12Api-ApiToken";"W12l20JDHhNhg2l2Nenis5CgC5qTFMTKILPuW8_lhIKGTLENda_oR5ycU2PoYKEbPB7LI8UeQ32HDGZCRvuKPo0v3grpxpycTHc835VJ19I=";JSONString])

 

but this has been unsuccessful and getting authentication failed errors.

Outcomes