为webservices写ansible-playbook

时间:2015-08-19 05:55:58

标签: api ansible ansible-playbook

如何在Ansbile中使用POST

curl -k -X POST -H "Accept:application/json" -H "Content-Type:application/json"-u user:A231212123432 "https://www.example.com"

请求正文

{
"a":"1"
"b":"2"
"c":"3"
}

1 个答案:

答案 0 :(得分:0)

根据docs,它可以这样工作:

- url: https://www.example.com
  method: POST
  user: user
  password: A231212123432
  HEADER_Content-Type: "application/json"
  body: '{ "a":"1" "b":"2" "c":"3" }'