# ansible api syntax

**URL:** <https://forum.ansible.com/t/ansible-api-syntax/16015>\
**Category:** Ansible Project\
**Created:** [August 22, 2014, 2:52pm UTC](https://forum.ansible.com/t/ansible-api-syntax/16015 "2014-08-22T14:52:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin\_hansen](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@kevin\_hansen](https://forum.ansible.com/u/kevin_hansen)\
**Post date:** [August 22, 2014, 2:52pm UTC](https://forum.ansible.com/t/ansible-api-syntax/16015/1 "2014-08-22T14:52:45Z")

</div>

Trying to use the api to copy a file and I’d like a diff of the changes.

I’m trying :

results = ansible.runner.Runner(pattern=argument[‘’] ,check=True,diff=True,module\_name=‘copy’, module\_args=‘src=/tmp/x.txt dest=/tmp/’,).run()

results are:

{‘contacted’: {‘rexpap2’: {‘changed’: True,  
‘invocation’: {‘module\_args’: ‘src=/tmp/x.txt dest=/tmp/’,  
‘module\_name’: ‘copy’}}},

running on centos 7 / python 2.7 ansible version 1.7.1

Am passing the right stuff to Runner to get the diff? I went fishing through the source to come up with the syntax I’m using but not really sure it is correct or if I can even get diffs back from the api.

Thanks,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 22, 2014, 3:58pm UTC](https://forum.ansible.com/t/ansible-api-syntax/16015/2 "2014-08-22T15:58:27Z")

</div>

Normally this would be a question posted to ansible-devel, so please use this list int he future for development topics.

Basically this data comes back via callbacks and not the API return, so it’s going to be difficult to extract.
