zesty.io

Product

Use Cases

Integrations

Learn

Creating a Customizable JSON Endpoint For Content

Zesty.io's custom API JSON endpoints will save your app developers a lot of time by making requesting dynamic data on your frontend quick and easy. Learn more about the Zesty.io [headless CMS offering here](https://www.zesty.io/en-us/cms/headless-cms-websites-with-decoupled-architecture/).

Implementing Custom Endpoints

Before jumping into the steps below we recommend installing a JSON viewer extension for Chrome for effortless viewing and simple debugging JSON.

  1. Navigate to the Web IDE section, locate the blue "create file" button at the top of the left-hand navigation, and click it.
  2. Select Custom File Type from the dropdown.
  3. Name your file. The name of this file will be used to reference your custom endpoint. For example if the file is named /test-data the endpoint is referenced at https://www.example.com/test-data.jsonThe preview URL can also be used in place of your live domain. Note: always consume the production URL when accessing endpoints. Preview.zesty.io URLs not only show unpublished data but also are not cached.
  4. Copy this code example below, and paste it into your new file

Note: Don't forget to add the leading slash in your file name as the file name gets concatenated to your instance's url.

  1. Replace content references in the copied code above with actual content models in your Zesty.io instance. You have full access to Parsley code in this view.

  2. Edit content references as necessary to form proper JSON. We provide .escapeForJS() for WYSIWYG content. To create comma separated lists in an each loop implement calls like {{if {tag._length} != {tab._num} }},{{end-if}}.

  3. Setup optional get parameters like start and limit to make custom pagination calls https://www.yourdomain.com/test-data.json?start=0&limit=5

Start Here

We will listen to your needs and walk you through how Zesty can help your team.

Connect with Content Experts

Book a free 15-minute consultation with a content expert. Discuss your application, pain points and requirements. Understand how Zesty's lower total cost of ownership, features, functionality can elevate your business by creating extraordinary digital experiences.

Trusted By

zesty customer logo Sonyzesty customer logo Rocket Leaguezesty customer logo Singlifezesty customer logo Acornszesty customer logo Phoenix Sunszesty customer logo Wattpadzesty customer logo Corner Shopzesty customer logo Bjs

Enter your details to connect with a Content Expert

First Name

Last Name

Email

Phone (optional)

Company

Please tell us about your project (optional)

G2 MOMENTUM LEADER

zesty customer logo zesty customer logo zesty customer logo zesty customer logo