Visual Studio Code REST Client plugin how to refer to settings.json variable


I want to refer to settings.json file variables in settings.json file using REST CLIENT extension in visual code. Below my variables in settings.json:

{
"rest-client.environmentVariables": {
    "Service Principal 1": {
        "aadV2TenantId": "00000000-0000-0000-0000-000000000000",
        "aadV2AppUri": "https://analysis.windows.net/powerbi/api",
        "aadV2ClientId": "00000000-0000-0000-0000-000000000000",
        "aadV2ClientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    },
    "Service Principal 2": {
        "aadV2TenantId": "domain.com",
        "aadV2AppUri": "https://analysis.windows.net/powerbi/api",
        "aadV2ClientId": "00000000-0000-0000-0000-000000000000",
        "aadV2ClientSecret": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    }
}

}

My code in REST API Client http file to check if this is referring is:

@test = {{aadV2TenantId}}

### Display the value of @test
POST https://httpbin.org/post
Content-Type: application/json

{
  "test": "{{test}}"
}

but it is not connecting to settings.json file. It is not seeing this variable. Why?

How to do this?

Leave a Reply

Your email address will not be published. Required fields are marked *