Can't inject mandatory tokens in headers?

Maroso

Client
Регистрация
31.07.2013
Сообщения
23
Благодарностей
2
Баллы
3
I need to execute below curl code in order to get access to json feed:
Код:
curl -H "Content-Type: application/json" -H "token1: 0nf6k2wqft57" -H "token2: htrey54678jjjrr" -H "token3: [email protected]" -i https://api.domain.com/products.json
But I have the tokens in variable like this:
Код:
curl -H "Content-Type: application/json" -H "token1: {-Variable.TokenOne-}" -H "token2: {-Variable.AccessTwo-}" -H "token3: {-Variable.TokenThree-}" -i https://api.domain.com/products.json
In orer to get access to json feed I nned to send the above tokens

What I tried untill now was:
1. C# code:
Код:
// format header strings
string tokenone = project.Variables ["TokenOne"]. Value;
// set header
instance.SetHeader("token1", uidtokenvar);
++ same for the other tokens

2. Get request to url "https://api.domain.com/products.json"

But it doesn't work

Any suggestion?
 

Maroso

Client
Регистрация
31.07.2013
Сообщения
23
Благодарностей
2
Баллы
3

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 270
Благодарностей
5 854
Баллы
113
Sorry, not clear what you need to do...
Do you want to create Get-request with required headers or what?
instance.SetHeader is not for http requests
 

Maroso

Client
Регистрация
31.07.2013
Сообщения
23
Благодарностей
2
Баллы
3
Yes @VladZen I want to create the Get-request with required headers. Forgot to mention that.
 

VladZen

Administrator
Команда форума
Регистрация
05.11.2014
Сообщения
22 270
Благодарностей
5 854
Баллы
113

Вложения

Maroso

Client
Регистрация
31.07.2013
Сообщения
23
Благодарностей
2
Баллы
3
Thanks so much @VladZen it seems to be working now. I used similar way of what you did, but in "More">>"User agent"I didn't added the:
{-Profile.UserAgent-}
Content-Type: application/json

I just added the token headers (facepalm)

Anyway, thanks a lot, it work now :-)
 
  • Спасибо
Реакции: VladZen

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)