DataJet
Search…
⌃K

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"
}
Last modified 15d ago