curl - 如何在 OpenRefine 中使用 cURL?
问题描述
我正在尝试连接到 OpenRefine 上的 API,该 API 仅适用于带有 OAth 的 cURL 请求,他们给出了以下示例:
curl --location --request POST 'https://apitest.api.com/' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ***************' \
--data-raw '{
"Name": {
"FirstName": "BOB",
"LastName": "SMITH"
},
"Address": {
"Addr1": "123 23RD ST",
"City": "NEW YORK",
"State": "NY",
"Zip": "10010"
}
}'
我改为(使用GREL)
curl --location --request POST 'https://apitest.api.com/' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer ***************' \
--data-raw '{
"Name": {
"FirstName": cells['FirstName'].value,
"LastName": cells['LastName'].value
},
"Address": {
"Addr1": cells['StreetAddress'].value,
"City": cells['City'].value,
"State": cells['State'].value,
"Zip": cells['Zip'].value
}
}'
这给了我一个Parsing error at offset 7: Bad negative number
我也将Authorization: Bearer ***************
and放在了Accept: application/json
该HTTP headers
区域,也没有运气。
我也试过:
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" --header "Authorization: Bearer ******" -d "{
\"Name\": {
\"FirstName\": \" + cells['FirstName'].value + \",
\"LastName\": \" + cells['LastName'].value + \"
},
\"Address\": {
\"Addr1\": \" + cells['Street'].value + \",
\"City\": \" + cells['City'].value + \",
\"State\": \" + cells['State'].value + \",
\"Zip\": \" + cells['Zip'].value + \"
}
}" "https://apitest.api.com/"
在我的控制台中使用显式数据。(我不再收到解析错误,但我也没有得到任何其他信息。)
谢谢!
解决方案
推荐阅读
- electron - 在工作区更改时隐藏电子应用程序窗口(在 macOS 上)
- python - 在 django 中安装 Postgresql 数据库的问题
- javascript - 如何修复 localhost 中的 react cors 错误?
- unity3d - Unity collison 未检测到 2d
- python - 使用 Pythin 脚本从 Outlook 下载附件
- qemu - 在 QEMU 中引导内核 - PFLASH:可能的错误 - 写入块确认
- javascript - 如何将窥视效果从悬停更改为滚动
- lua - 我如何让surface.DrawTexturedRectRotated() 从左边旋转?
- javascript - Angular 使用 Substring 和 ngIf 查看字符串是否在另一个字符串中
- jquery - 有没有办法在粘性标题下方设置边距,以便滚动内容不会触及标题底部边缘?