The best http client for Android Studio.
This plugin is based on idea-rest-client.
- Support run retrofit api interface functions directly(支持直接从 retrofit 接口函数执行 )
- Supports GET, POST, PUT, DELETE, PATCH requests
- Multiline request parameters
- Rest file type support
- Internally supported dynamic parameters(动态参数配置支持)
- Response auto format (based on response Content-Type header)
- Customized colors and fonts
- Customized keyboard shortcuts
- Comments
- Support large body download(支持响应体下载)
- Support un-text download and preview(支持非文本类型下载及打开预览)
使用方法:
1. 新建 xxx.rest
格式文件,按照 Preview 编辑即可
2. 直接在 Retrofit Api 函数左侧 Run
即可
How to use:
1. New a xxx.rest
file,and edit like preview
2. Click the Run
icon which left in Retrofit Api
function
You can create rest
file to edit.
Content structure
Run retrofit api method
GET
{BASE_URL}/get
# query params
&id=1
&type=2
# headers
@Content-Type: application/json
@timestamp: {TS_SEC} # current time in seconds
POST
Apponit content-type: @Content-Type: application/json
POST
{BASE_URL}/post_json
# request headers
@Content-Type: application/json
# request body
{"a":"{a}","b":"{b}"}
Apponit content-type: @Content-Type: application/x-www-form-urlencoded
, and last line is form data(can be multiple line)
POST
{BASE_URL}/post_form/{user_id}
# Headers:
@Content-Type: application/x-www-form-urlencoded
# Form data separate with '&'
id=1&s=hello
# also can be:
&id=1
&s=hello
We can find execute icon
on api method:
click the icon will create a rest file in {PROJECT_DIR}/.idea/rest-client/pkg/cls_fun.rest
GET
{BASE_URL}/abc
&q={q}
# Headers
@a: {a}
don't forget Set env params
You can use {name}
to reference env variable.
{PROJECT_DIR}/.idea/rest-client/rest_env.json
(Auto create
){
"test": {
"BASE_URL": "http://localhost:8080",
//common headers
"headers": {
"Content-Type": "application/json",
"timestamp": "{TS}"
},
"user_id": "1",
"a" : "a",
"b" : "b"
},
"dev": {
"BASE_URL": "http://xxx.xxxx.xxx"
}
}
IDEA or Android Studio Settings/Plugins/Marketplace
search Retrofit Rest Client
Settings/Plugins/
Install Plugin from Disk.
{TS}
GET
http://xx.xx.xx/api
@timestamp: {TS} # current time in milliseconds
@timestamp_sec: {TS_SEC} # current time in seconds
@timestamp_custom: {TS_yyyy-MM-dd#HH:mm:ss} # current time custom format with SimpleDateFormat (use '#' instead of ' ')
If your response is too large, the plugin will start download response-body to a file.
When download complete, you can open this file by following actions:
By the way, if you need your json formatter plugin of browser, please enable Allow access to file URLs
This plugin is based on idea-rest-client.
Multiple requests in one file. [like http client]
Response result output tu run window. [like http client]