【问题标题】:How to authorize bintray api如何授权bintray api
【发布时间】:2016-06-22 15:06:42
【问题描述】:
这里的 bintray 文档说:
Bintray REST API 需要一个应用 API 密钥。可以从用户配置文件页面获取 API 密钥。使用 HTTP >Basic Authentication 实现身份验证,用户名作为用户名,API 密钥作为 >密码。经过身份验证的 REST 调用只能通过 HTTPs 使用。
我不懂“HTTP >Basic Authentication”,在linux中怎么办curl?
【问题讨论】:
标签:
java
api
maven
curl
bintray
【解决方案1】:
将参数 --basic 和 -u username:api_key 添加到 curl 命令...基本身份验证是一种通过 HTTP 发送授权标头的未加密方式请求
【解决方案2】:
例如上传文件:
curl -SvT POST \
FILE \
--user "$BINTRAY_USER:$BINTRAY_KEY" \
https://api.bintray.com/content/organization/repository/package/$version/
要在同一版本位置发布所有文件,请使用以下命令:
curl -SvX POST \
--user "$BINTRAY_USER:$BINTRAY_KEY" \
https://api.bintray.com/content/organization/repository/package/$version/publish
获取signed_url:
Linux:
curl -SvX POST \
https://api.bintray.com/signed_url/organization/repository/FILE?encrypt=false \
--user "$BINTRAY_USER:$BINTRAY_KEY" \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-d '{"expiry": "4000000000000"}'
Win(您可以使用“k”选项跳过证书验证):
curl -SkvX POST ^
https://api.bintray.com/signed_url/organization/repository/FILE?encrypt=false ^
--user "%BINTRAY_USER%:%$BINTRAY_KEY%" ^
-H "cache-control: no-cache" ^
-H "content-type: application/json" ^
-d "{"expiry": "4000000000000"}"