[英]Does HTTPie have the equivalent of curl's -d option?
我想使用 HTTPie 查询 REST API。 我通常使用 curl 这样做,我可以使用它指定maxKeys
和startAfterFilename
例如
curl --location --request GET -G \
"https://some.thing.some.where/data/v1/datasets/mydataset/versions/2/files" \
-d maxKeys=100 \
-d startAfterFilename=YYYMMDD_HHMMSS.file \
--header "Authorization: verylongtoken"
如何在 HTTPie 中使用这些-d
选项?
在您的情况下,命令如下所示:
http -F https://some.thing.some.where/data/v1/datasets/mydataset/versions/2/files \
Authorization:verylongtoken \
startAfterFilename=="YYYMMDD_HHMMSS.file" \
maxKeys=="100"
虽然,有很多方法可以通过httpie
传递一些数据。 例如
http POST http://example.com/posts/3 \
Origin:example.com \ # : HTTP headers
name="John Doe" \ # = string
q=="search" \ # == URL parameters (?q=search)
age:=29 \ # := for non-strings
list:='[1,3,4]' \ # := json
file@file.bin \ # @ attach file
token=@token.txt \ # =@ read from file (text)
user:=@user.json # :=@ read from file (json)
或者,在表格的情况下
http --form POST example.com \
name="John Smith" \
cv=@document.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.