# httpGet Operation - behaviour on HTTP Status 4040 ?

**URL:** <https://community.cdata.com/t/httpget-operation-behaviour-on-http-status-4040/722>\
**Category:** CData Arc\
**Tags:** question, httpget\
**Created:** [May 21, 2024, 11:45am UTC](https://community.cdata.com/t/httpget-operation-behaviour-on-http-status-4040/722 "2024-05-21T11:45:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![russell-jerseypost](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@russell-jerseypost](https://community.cdata.com/u/russell-jerseypost)\
**Post date:** [May 21, 2024, 11:45am UTC](https://community.cdata.com/t/httpget-operation-behaviour-on-http-status-4040/722/1 "2024-05-21T11:45:33Z")

</div>

(Title should read 404 not 4040)

Hi

If I use&nbsp;\<arc:call op=“httpGet” in=“http”\> , will a 404 response raise an exception which I need to catch or can I check the&nbsp; **http:statuscode&nbsp;?**

---

<div class="post-metadata">

**Author:** ![lohith](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/lohith/32/1848_2.png) [@lohith](https://community.cdata.com/u/lohith)\
**Post date:** [May 21, 2024, 12:00pm UTC](https://community.cdata.com/t/httpget-operation-behaviour-on-http-status-4040/722/2 "2024-05-21T12:00:21Z")

</div>

Hi Russel,

Do you mean you want to capture the server response code?&nbsp;Could you please elaborate a bit more to help us understand the issue? A 404 error usually indicates that the server cannot find the web page requested by the user.

---

<div class="post-metadata">

**Author:** ![russell-jerseypost](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@russell-jerseypost](https://community.cdata.com/u/russell-jerseypost)\
**Post date:** [May 21, 2024, 12:14pm UTC](https://community.cdata.com/t/httpget-operation-behaviour-on-http-status-4040/722/3 "2024-05-21T12:14:46Z")

</div>

Hi

The API endpoint I am calling uses 404 to indicate a record has not been found and returns

```json
{"message":"No orders found"}

```

as the body. which fairly common practice for accessing data resources.

I have managed to use try/catch around my httpGet and it successfully catches the 404, but cannot read **http:content**

Looks like I will just have to assume that 404 means “No orders found”

---

<div class="post-metadata">

**Author:** ![lohith](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/lohith/32/1848_2.png) [@lohith](https://community.cdata.com/u/lohith)\
**Post date:** [May 22, 2024, 5:34am UTC](https://community.cdata.com/t/httpget-operation-behaviour-on-http-status-4040/722/4 "2024-05-22T05:34:04Z")

</div>

Hi Russel,

Did you try accessing it using response http:content attribute?

```auto
<arc:set attr="http.URL" value="https://SomeURL" /><arc:set attr="http.user" value="user" /><arc:set attr="http.password" value="password" /><arc:call op="httpGet" in="http" out="response"> <arc:set attr="output.data" value="[response.http:content]" /></arc:call><arc:set attr="output.filename" value="httpResponseContent.txt" /><arc:push item="output" />

```

In the above sample script, the response from the API will be saved in output file.

Do you see any error?

---

<div class="post-metadata">

**Author:** ![russell-jerseypost](https://avatars.discourse-cdn.com/v4/letter/r/439d5e/32.png) [@russell-jerseypost](https://community.cdata.com/u/russell-jerseypost)\
**Post date:** [May 23, 2024, 1:38pm UTC](https://community.cdata.com/t/httpget-operation-behaviour-on-http-status-4040/722/5 "2024-05-23T13:38:26Z")

</div>

I did, but when the status is 404 Cdata Arc didn’t populate content

---

<div class="post-metadata">

**Author:** ![James\_B](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/james_b/32/1688_2.png) [@James\_B](https://community.cdata.com/u/James_B)\
**Post date:** [May 23, 2024, 8:01pm UTC](https://community.cdata.com/t/httpget-operation-behaviour-on-http-status-4040/722/6 "2024-05-23T20:01:18Z")

</div>

In ArcScript, the body of the HTTP error is not returned with the exception code, but you can see the response error if you enable the logging for the connector:

```xml
<!-- read this log after the fact --><arc:set attr="http.logfile" value="/somepath/HTTPLog.txt" /><arc:set attr="http.verbosity" value="3" /><arc:set attr="http.URL" value="https://SomeURL" /><arc:set attr="http.user" value="user" /><arc:set attr="http.password" value="password" /><arc:call op="httpGet" in="http" out="response"> <arc:set attr="output.data" value="[response.http:content]" /></arc:call><arc:set attr="output.filename" value="httpResponseContent.txt" /><arc:push item="output" />

```

But there is not a real time examination of the HTTP body of a 4xx error in the exception thrown.

The REST connector is a better way in the flow to manage endpoints that return a body that you need to examine - in the Advanced tab, you will find an option to create output messages for errors so you can act according to the body of the error reply:

![e2537493-817f-4d34-94cf-6efc3ca8478e.png](https://us1.discourse-cdn.com/cdata/original/1X/f7754df28902740d6d1f7a6b36f484cd09b0e221.png)
