我想用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选项?
发布于 2021-11-03 12:28:05
在您的示例中,命令如下所示:
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.txthttps://stackoverflow.com/questions/69798987
复制相似问题