

命令行 API 调试工具: HTTPie & jq
source link: https://fann.im/blog/2015/01/20/httpie-and-jq/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

命令行 API 调试工具: HTTPie & jq
Jan 20, 2015
HTTPie 类似 cURL,更简单易用,jq 用来解析 JSON,一起配合使用做 API 开发调试非常方便:
- GET:
http :9090/api/test
- POST:
http -f post --session=fann :9090/api/login' user=fannheyward passwd=passwd
- GET with cookie:
http --session=fann :9090/api/profile
jq .
- 格式化整个 JSONjq ".status"
- 只显示 status 字段的值jq ". | {name: .name, icon: .icon}"
- 重组 JSON,只显示 name&icon 字段jq ".[] | {name: .name}"
- 遍历 JSON 数组,只显示每个元素的 name 字段
更多高级用法参考各自文档。
Was this page helpful?
Recommend
-
85
README.md HTTPie for curl If you like the interface of HTTPie but miss the features of curl, curl-httpie is what you are sear...
-
62
HTTPie 是一个命令行 HTTP 客户端。目标是让 CLI 与 Web services 的交互尽可能的更友好。它提供了一个简单的 http 命令,可以让我们用简单自然的表述发送任意 HTTP 请求,并且可以输出带代码高亮的结果。HTTPie 可以使...
-
75
readme.md ...
-
11
Published April 18, 2019 #howto #hugo
-
6
FFmpeg 命令行工具 - 高级特性、Web 音视频、调试和测试 这篇文章讲解 FFmpeg 命令行工具中使用高级特性、Web 音视频、调试和测试相关的功能。
-
13
Note on reinstalling httpie for SSLv3 Handshake failureotsukare Thoughts after a day of workI ran into this issue recently with httpie (The python cod...
-
12
Quick tips with httpie Lun 05 août 2013by Karl Dubost (Working at Mozilla since 2013) When w...
-
10
loguru - 打印日志(特别是异常的详细信息) loguru本身是一个日志库,跟logging库差不多,但是它还支持更丰富的一些功能,其中一项就是它可以显示抛出异常时的调用栈和各参数值。 使用方法很简单,我们只用使用loguru.logger.catch
-
9
We’re excited to introduce a new way of passing raw request data as an alternative to piping, XML pretty printing, and improved packaging. Raw request data HTTPie has always used piping as the way to pass
-
6
Friday! It's the time to let you know what have we been up to. Check out what's new this week 👇 HTTPie for Web & Desktop Our mission to provide the best experience to anyone working with APIs continues at full spe...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK