Skip to main content

HTTP DSL syntax

httpx supports JetBrains HTTP request syntax and VS Code REST Client both.

Environment variables

All environment variables are defined in json files:

  • http-client.env.json - regular variables
  • http-client.private.env.json - private variables, such as passwords, tokens, certificates, and other sensitive information
  • .vscode/settings.json
"rest-client.environmentVariables": {
"$shared": {
"username": "admin",
"password": "123456"
"development": {
"hostname": "localhost:8080"
"production": {
"hostname": "localhost:8081"

Attention: httpx doesn't support File/Request Variables in VS Code REST Client.

Global variables

You can access global variables by response handler script, example as following:


> {%"myip", response.body['origin']);

Then you can use global variables just like normal environment variables:

### post test
Content-Type: application/json

"ip": "{{myip}}"

For more about global API, please visit


  • JetBrains HTTP Client plugin persists global variables in memory, and they will be gone after IDE/project closed.
  • httpx CLI persists global variables in $HOME/.servicex/global_variables.json because command line is short-live
  • Global variables reuse in httpx: if request a wants to use global variables generated by request b, and you should execute httpx b to persist variables then execute httpx a


Some functions are not compatible with JetBrains HTTP Client and VS Code REST Client!!!


Function call styles:

  • function without params: {{$uuid}}, {{$guid}}, {{$timestamp}}, {{$randomInt}}
  • function with params: {{$base64 abc123}}, {{$base64 %name}}, {{$escapeXml <user></user>}}
  • function with template params:
{{$base64 `%{name}:%{password}`}}

If you want to refer env variables, please use %name as param or %{name} in template literal.

Function list:

  • data: uuid, guid, randomInt, timestamp, datetime, localDatetime, projectRoot, historyFolder
  • encode: base64, urlEncode
  • escape: escapeHtml, escapeXml, escapeJson, escapeJavaScript
  • hmac: hmacMD5, hmacSHA1 hmacSHA256 hmacSHA512 - hex encoded: {{$hmacSHA1 key1 text}}, base64 encode: {{$hmacSHA1 key1 text base64}}
  • digest: md5 sha1 sha256 sha512 - hex encoded: {{$sha256 text}}, base64 encoded: {{$sha256 text base64}}
  • misc: processEnv, dotenv