TestProject Forum

GET HTTP : include -u parameter

I would like to use the GET HTTP addon, but I need to use -u or --user parameter, as the API needs an authentication.
Is there a way to do that ?

Can you add it in the header like this? For more information, read the Directives section on Authorization - HTTP | MDN.

It might be worth replacing the part after ‘Basic’ with a secret parameter for security reasons.

Hello ! Thanks for your support !
The official doc of the API mentions " HTTP requests to the API are protected with HTTP Basic authentication".
So I tried to encode <YOUR_ACCOUNT_SID>:<YOUR_AUTH_TOKEN> into <CREDENTIALS> and set the headers as Authorization: Basic <CREDENTIALS> but I get :

java.util.concurrent.ExecutionException: io.testproject.java.sdk.v2.exceptions.FailureException: The 'Authorization:Basic <cREDENTIALS>' parameter is invalid

Any idea ?

Finally I found the solution !
It’s not Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l but Authorization= Basic YWxhZGRpbjpvcGVuc2VzYW1l that is working !

Thanks a lot, wouldn’t have done it without you !