我正在尝试将以下卷曲转换为 ansible 播放:
curl -u user:password -v -X POST -d @restrictions.json -H
"Content-Type: application/vnd.atl.bitbucket.bulk+json"
http://BitBucketServer/rest/branch-permissions/2.0/projects/project/repos/my-repo/restrictions
Ansible play:
- name: Branch permission
uri:
url: http://172.28.200.66:7990/rest/branch-permissions/2.0/projects/V10/repos/my-repo/restrictions
method: POST
user: "{{username}}"
password: "{{password}}"
src: restrictions.json
force_basic_auth: yes
status_code: 400
body_format: json
它失败并出现以下错误:
"errors": [{
"context": null,
"exceptionName": "org.codehaus.jackson.map.JsonMappingException",
"message": "Can not deserialize instance of com.atlassian.stash.internal.repository.ref.restriction.rest.RestRestrictionRequest out of START_ARRAY tokenn at [Source: com.atlassian.stash.internal.web.util.web.CountingServletInputStream@3ab1a43; line: 1, column: 1]"
}]
}, "msg": "HTTP Error 400: Bad Request",
我通过添加以下内容解决了这个问题: 头: 内容类型:"application/vnd.atl.bitbucket.bulk+json"