# Passing data from ansible to service now table

**URL:** <https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981>\
**Category:** Ansible Project\
**Created:** [May 20, 2020, 7:57am UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981 "2020-05-20T07:57:43Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [May 20, 2020, 7:57am UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/1 "2020-05-20T07:57:43Z")

</div>

Hi Team,

I am sending data from ansible to service now using uri, data is passing to snow table but job status is not showing successful.  
I am getting “The read operation timed out” error ,Please suggest me how this can be resolved

- name: Passing Data to Snow  
uri:  
url: “[https://test.service-now.com/api/eplc/table\_update\_integration/create](https://test.service-now.com/api/eplc/table_update_integration/create)”  
method: POST  
Headers: “application/json”  
body: ‘{“List”:{{EPG\_all}}, “Region”:"NA " }’  
body\_format: json  
user: “{{ snow\_username }}”  
password: “{{ snow\_password }}”  
force\_basic\_auth: yes  
status\_code: 200  
timeout: 10

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 20, 2020, 12:35pm UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/2 "2020-05-20T12:35:18Z")

</div>

> Hi Team,
> 
> I am sending data from ansible to service now using uri, data is passing to snow table but job status is not showing  
> successful.  
> I am getting "The read operation timed out" error ,Please suggest me how this can be resolved  
> - name: Passing Data to Snow  
> uri:  
> url: "[https://test.service-now.com/api/eplc/table\_update\_integration/create&quot](https://test.service-now.com/api/eplc/table_update_integration/create&quot);  
> method: POST  
> Headers: "application/json"  
> body: '{"List":{{EPG\_all}}, "Region":"NA " }'  
> body\_format: json  
> user: "{{ snow\_username }}"  
> password: "{{ snow\_password }}"  
> force\_basic\_auth: yes  
> status\_code: 200  
> timeout: 10

It certainly doesn't help that you reduce the timeout to 10 seconds. Also please post complete error message (without  
the credentials).

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [May 20, 2020, 1:43pm UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/3 "2020-05-20T13:43:24Z")

</div>



---

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [May 20, 2020, 1:43pm UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/4 "2020-05-20T13:43:46Z")

</div>

Hi Racke,

I have already increase the timeout but still getting the same error.  
“Status code was -1 and not [200]: ‘The read operation timed out’”

---

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [May 20, 2020, 1:52pm UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/5 "2020-05-20T13:52:29Z")

</div>

Please find the complete tasks out put-

{  
“status”: -1,  
“\_ansible\_no\_log”: false,  
“url”: “[https://test.service-now.com/api/eplc/table\_update\_integration/create](https://test.service-now.com/api/eplc/table_update_integration/create)”,  
“changed”: false,  
“elapsed”: 10,  
“content”: “”,  
“invocation”: {  
“module\_args”: {  
“directory\_mode”: null,  
“force”: false,  
“remote\_src”: null,  
“status\_code”: [  
“200”  
],  
“follow”: false,  
“owner”: null,  
“body\_format”: “json”,  
“client\_key”: null,  
“group”: null,  
“use\_proxy”: true,  
“unix\_socket”: null,  
“unsafe\_writes”: null,  
“serole”: null,  
“content”: null,  
“setype”: null,  
“follow\_redirects”: “safe”,  
“return\_content”: false,  
“method”: “POST”,  
“body”: {  
“Region”: “NA - Prod”,  
“List”: [  
data  
},  
“url\_username”: “_**",  
“src”: null,  
“dest”: null,  
“selevel”: null,  
“force\_basic\_auth”: true,  
“removes”: null,  
“http\_agent”: “ansible-httpget”,  
“user”: “”,  
“regexp”: null,  
“password”: "**",  
“url\_password”: "_\*\*”,  
“url”: “[https://test.service-now.com/api/eplc/table\_update\_integration/create](https://test.service-now.com/api/eplc/table_update_integration/create)”,  
“backup”: null,  
“seuser”: null,  
“client\_cert”: null,  
“creates”: null,  
“headers”: {  
“Content-Type”: “application/json”  
},  
“delimiter”: null,  
“mode”: null,  
“timeout”: 100,  
“attributes”: null,  
“validate\_certs”: true  
}  
},  
“redirected”: false,  
“msg”: “Status code was -1 and not [200]: ‘The read operation timed out’”  
}

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 20, 2020, 3:07pm UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/6 "2020-05-20T15:07:32Z")

</div>

> Please find the complete tasks out put-  
> {  
> "status": -1,  
> "\_ansible\_no\_log": false,  
> "url": "[https://test.service-now.com/api/eplc/table\_update\_integration/create&quot;](https://test.service-now.com/api/eplc/table_update_integration/create&quot;),  
> "changed": false,  
> "elapsed": 10,  
> "content": "",  
> "invocation": {  
> "module\_args": {  
> "directory\_mode": null,  
> "force": false,  
> "remote\_src": null,  
> "status\_code": [  
> "200"  
> ],  
> "follow": false,  
> "owner": null,  
> "body\_format": "json",  
> "client\_key": null,  
> "group": null,  
> "use\_proxy": true,  
> "unix\_socket": null,  
> "unsafe\_writes": null,  
> "serole": null,  
> "content": null,  
> "setype": null,  
> "follow\_redirects": "safe",  
> "return\_content": false,  
> "method": "POST",  
> "body": {  
> "Region": "NA - Prod",  
> "List": [  
> data  
> },  
> "url\_username": "\*\*\*\*",  
> "src": null,  
> "dest": null,  
> "selevel": null,  
> "force\_basic\_auth": true,  
> "removes": null,  
> "http\_agent": "ansible-httpget",  
> "user": "",  
> "regexp": null,  
> "password": "\*\*\*",  
> "url\_password": "\*\*\*",  
> "url": "[https://test.service-now.com/api/eplc/table\_update\_integration/create&quot;](https://test.service-now.com/api/eplc/table_update_integration/create&quot;),  
> "backup": null,  
> "seuser": null,  
> "client\_cert": null,  
> "creates": null,  
> "headers": {  
> "Content-Type": "application/json"  
> },  
> "delimiter": null,  
> "mode": null,  
> "timeout": 100,  
> "attributes": null,  
> "validate\_certs": true  
> }  
> },  
> "redirected": false,  
> "msg": "Status code was -1 and not [200]: 'The read operation timed out'"  
> }

I would increase the timeout to a ridiculous value like 20 minutes and test if it:

\* succeeds  
\* stops before the timeout exceeded  
\* stops after the timeout exceeded

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [May 21, 2020, 9:41am UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/7 "2020-05-21T09:41:35Z")

</div>

Hi Rack,

As you suggested I have increased the timeout to 20 min but still getting the same error and task stops before the timeout value.

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 21, 2020, 9:44am UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/8 "2020-05-21T09:44:17Z")

</div>

> Hi Rack,
> 
> As you suggested I have increased the timeout to 20 min but still getting the same error and task stops before the  
> timeout value.

So it is most likely that the API causes your problems. Please investigate at that end.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [May 21, 2020, 10:20am UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/9 "2020-05-21T10:20:07Z")

</div>

thanks Rack one more thing I have observed sometimes i am getting belwo connection failure and some time Read operation timeout error.  
Status code was -1 and not [200]: Connection failure: connection was closed before a valid response was received: ‘’"

could you please suggest what the possible reason of this two errors.? and in my ansible script has no issue.

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [May 21, 2020, 10:32am UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/10 "2020-05-21T10:32:38Z")

</div>

> thanks Rack one more thing I have observed sometimes i am getting belwo connection failure and some time Read  
> operation timeout error.  
> Status code was -1 and not [200]: Connection failure: connection was closed before a valid response was received: ''"
> 
> could you please suggest what the possible reason of this two errors.? and in my ansible script has no issue.

For the third and last time: most likely reason is the \*API itself\*.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke

---

<div class="post-metadata">

**Author:** ![Diyawary](https://avatars.discourse-cdn.com/v4/letter/d/d2c977/32.png) [@Diyawary](https://forum.ansible.com/u/Diyawary)\
**Post date:** [May 21, 2020, 10:47am UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/11 "2020-05-21T10:47:42Z")

</div>

Thanks Racke for you help.

---

<div class="post-metadata">

**Author:** ![David\_Foley](https://avatars.discourse-cdn.com/v4/letter/d/9e8a1a/32.png) [@David\_Foley](https://forum.ansible.com/u/David_Foley)\
**Post date:** [May 21, 2020, 2:52pm UTC](https://forum.ansible.com/t/passing-data-from-ansible-to-service-now-table/32981/12 "2020-05-21T14:52:09Z")

</div>

Is the Body Correct ? and that you aren’t missing any JSON values?
