Blank HTTP

Anytime you create Blank HTTP task, an endpoint will be generated. By calling this endpoint, you will trigger the task. Additionally, you can return a response to any client that called this endpoint. It might be useful when on storefront 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 you create the task, you will find autogenerated endpoint in app dashboard (after you select newly created task from the list on the right).

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 request.

Additionally, you need to include header parameter named token. You will find value for this header just under autogenerated endpoint.

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.

{% assign response = "{}" | parse %}
{% assign response["status"] = "ok" %}

In above example, response is a global hook's object. This variable will be always returned to the client when Blank HTTP task is called. First we parse stringified, empty JSON object and assign it to response variable. Next, we set property status to ok. This is what will be returned to client:

{
status: "ok"
}

‚Äč