【发布时间】:2018-08-31 09:47:19
【问题描述】:
我想通过 Ansible 的 REST API 将 HTML 文件上传到 GitLab。
我的 curl 请求运行良好:
curl -H "Content-Type: application/x-www-form-urlencoded" --request POST --header 'PRIVATE-TOKEN: my_tocken' --data-urlencode content@/tmp/report.html 'https://my_server/api/v4/projects/3/repository/files/my_customer%2Freportname%2Ehtml?branch=master&commit_message=create%20a%20new%20report' -k
如何用uri模块翻译?
uri:
url: "https://my_server/api/v4/projects/3/repository/files/my_customer%2Freportname%2Ehtml?branch=master&commit_message=create%20a%20new%20report"
validate_certs: no
method: POST
headers:
Content-Type: application/x-www-form-urlencoded
PRIVATE-TOKEN: "my_tocken"
status_code: 200
body: "data-urlencode=content@/tmp/report.html"
我明白了:
"json": {
"error": "content is missing"
},
【问题讨论】:
标签: curl ansible gitlab uri urlencode