JetClient is a simple and powerful API client plugin for JetBrains IDEs (IntelliJ IDEA, GoLand, PyCharm, PhpStorm, etc.). It combines the best features of existing API clients with additional enhancements, all within your IDE. Key features include:
Watch the JetClient plugin video to learn about the plugin features.
A Project is a root collection consisting of folders and requests. It includes its own settings, environments, variables, and an init script. Projects in JetClient are independent of the IDE project, you can have multiple JetClient projects within a single IDE project.
File Sync (Git Sync) enables saving and restoring your request collections on the local file system. This allows for easy sharing of collections with your team via Git or any other version control system (VCS).
Save All
or Save
to
save. To restore or view diffs, select the corresponding options from the same context menu.To exclude a specific folder from syncing, disable synchronization in its properties. This change will apply to all nested folders as well.
Environments enable the use of different sets of variables for various contexts. These are organized into Environment Groups, and you can select multiple environments simultaneously, one from each group.
A Default
environment group is always available, typically including environments like Local
, Staging
,
and Production
.
You can also create your own environment groups, such as User
, Client
, Region
, API Version
, and others.
Environments are defined per project and can be created in the Environments
tab.
Variables for these environments are set in the Variables
tab.
Variables in JetClient can be defined at different levels: project, folder, and runtime.
Variables
tab of the project or folder, using
the JSON5 format.The variables editor is divided into two sections: Shared and Local.
Project variables include environment-specific variables and globals
, which are accessible regardless of the selected
environment. They are organized within a JSON object with the environment as a top-level property:
{
globals: {
baseUrl: 'https://api.example.com'
},
local: {
token: 'localToken'
},
dev: {
token: 'devToken'
}
}
Folder variables can include both general variables and environment-specific variables. General variables are accessible regardless of the selected environment, while environment-specific variables are only available when the corresponding environment is selected:
{
myFolderVar: 'myValue',
dev: {
myFolderVar: 'devValue'
}
}
Variables in JetClient can be primitive types, objects, and arrays, and are usable in scripts, requests, and folders. To utilize a variable in any field, enclose it in double curly braces: {{myVar}}
. You can reference entire objects or arrays, for example in the body of a request, using {{myRequestBody}}
.
Variables can also reference other variables, as shown in the example below:
{
array: [
{
myProperty: 123
}
],
// This variable resolves to string "123"
myVar: '{{array[0].myProperty}}',
// This variable resolves to number 123
myVar2: {{array[0].myProperty}}
}
Variables are resolved in the following order, from highest to lowest priority:
Requests and folders in JetClient can have Pre-request and Test scripts written in JavaScript, while test suites contain only Test scripts. The project includes an Init Script executed once per run, which can be used to define global functions and variables. For example:
CryptoJS = require("crypto-js");
hmacSHA256 = (message) => {
return CryptoJS.HmacSHA256(message, jc.environment.get('secret')).toString();
}
You can then use CryptoJS
and hmacSHA256
in your pre-request and test scripts.
Scripts are executed in the following order when you send a request or run a folder with the runner:
Steps 2-5 are repeated for each request in the run.
For test suites, scripts execute in this order:
Scripts from jc.runRequest
, jc.runFolder
, or jc.runTestSuite
follow the same execution order as for requests,
folders, and test suites.
JetClient built-in library is similar to Postman's but instead of pm
it is called jc
.
For example,
jc.test("Status code is 200", () => {
jc.expect(jc.response.code).to.eql(200)
})
JetClient scripts can utilize the Chai Assertion Library BDD. For more details, see the JetClient Library documentation. Also, see JetClient Library Types for type definitions.
JetClient includes built-in libraries such
as ajv
, atob
, btoa
, chai
, cheerio
, crypto-js
, csv-parse/lib/sync
, lodash
,
moment
, tv4
, uuid
, and xml2js
, which you can import using the require
function.
Additionally, you can add your own libraries to the scripts. Navigate to Settings > Tools > JetClient
and set
the Libraries directory
.
If you are using npm libraries, specify the directory containing your package.json
and node_modules
.
Otherwise, use the directory where your script libraries are located. You can then use require to import your libraries.
Manage cookies using the Cookies Manager
. To open it, click on Cookies Manager
in the toolbar of the tool window.
Proxies are supported using the IDE Proxy Settings.
To send a request using the HTTP/2
protocol, please select HTTP/2
option
in Settings > Tools > JetClient > HTTP Version
.
JetClient supports importing collections from various sources:
To import a cURL request, simply copy the cURL command and paste it into the URL field of a request.
.idea/JetClient
directory of your project and in JetClient sync files if synchronization
is enabled.