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

Task responds only to POST and GET request.

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.

Endpoint won't work if your storefront is password protected. Disable storefront password or contact us to get development endpoint for your task.

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.

{% 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:

{
    status: "ok"
}

Request rate limits

All request use Fixed Window algorithm for incoming request control.

Request are limited to 60 requests / minute

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

Last updated