Get a page

Updated on

Overview

Stubby providers you simple API to fetch data into your next app. You can simply send a get request to URL below

Type Value
method GET
url https://stubby.io/api/v1/sites/{siteId}/pages/{id | slug}

Parameters

Property Value Comment
apiKey string Api key from stubby.io

Sample code

const STUBBY_CMS_API_KEY = "<API_KEY>"; 
const siteId = "<YOUR_SITE_ID>";
const slugOrId = "hello-world";

const url = new URL(`https://stubby.io/api/v1/sites/${siteId}/pages/${slugOrId}`);
url.searchParams.append("apiKey", STUBBY_CMS_API_KEY);

const res = await fetch(url.href);

const data = await res.json(); // data contains the page content

Response

The response will be sent as a tree structure representing the folder structure you have organized in your app.