How to create a JSON response using custom endpoints

Sam van de Kreeke

Published: 30-10-2019

Last updated: 27-08-2020

Exchange data with your front end or external application via JSON. Use it in combination with Angular, or as an API.

  1. Check the names of the properties you want to use.
  2. Create a new post page with a variable in the url. (A var starts with : in the url)
  3. Set the input var and create an object which uses the input var to determine the object.
  4. Set the JSON you want to receive in the template and fill this with the values of your object with liquid.
  5. Try it out! We use Postman to test the http requests.

The example shows the most basic version of setting up an API. The shown API is NOT secure. Anyone can access this type of API. If using a webpage as API please enable authentication or send a secret key along with requests to make the connection more secure.

In this tutorial

Not sure where to start?

Click here to register and start learning