# HTTP

Anytime you create HTTP task, an endpoint will be generated. By calling this endpoint, you can trigger the task. Additionally, you can return a response to any client that called this endpoint. It might be useful when you need to fetch store's data that is not available through Shopify Storefront API (inventory levels lookup, gift card balance lookup etc.).

### Calling autogenerated task endpoint

After your task is created, you can find autogenerated endpoint in app dashboard (Developer Console, bottom left section after selecting task)

It will look something like that:

`https://your-store-name.myshopify.com/apps/datajet/task/task_id`

When calling the endpoint from your storefront you can use this short version:

`/apps/datajet/task/task_id`

{% hint style="info" %}
Task responds only to POST and GET request.
{% endhint %}

Additionally, you need to include header parameter named `token`. You will find value for this header just under autogenerated endpoint. Token validation can be disabled in task options.

{% hint style="danger" %}
Endpoint won't work if your storefront is password protected. Disable storefront password or contact us to get development endpoint for your task.
{% endhint %}

### Returning response to client

Let's have a look at simple example in which our task is going to return `"status": "ok"` response to client.

```javascript
{% json response %}
    {
        "body": {
            "status": "ok"
        },
        "status": 200
    }
{% endjson %}
```

In above example, `response` is a global object. This variable is going to be always returned to the client when HTTP task is called. This is what would be returned to client:

```javascript
{
    status: "ok"
}
```

### Request rate limits

All request use Fixed Window algorithm for incoming request control.

{% hint style="info" %}
Request are limited to 60 requests / minute
{% endhint %}

When limit is reached a `429 Too Many Requests` code is returned. Additionally you can find current limits in response headers:

* ratelimit-limit
* ratelimit-policy
* ratelimit-remaining
* ratelimit-reset<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datajet-app.com/scripts/blank/http.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
