Overview
Stubby provides you simple api's to fetch data into your next app. You can simply send a post request to this URL
Type | Value |
---|---|
method | GET |
url | https://stubby.io/api/v1/sites/{site_id}/collections |
Parameters
Property | Value | Comment |
---|---|---|
apiKey | string | API key for your site |
Sample code
const STUBBY_CMS_API_KEY = "<API_KEY>";
const siteId = "<YOUR_SITE_ID>";
const url = new URL(`https://stubby.io/api/v1/sites/${siteId}/collections`);
url.searchParams.append("apiKey", STUBBY_CMS_API_KEY);
const res = await fetch(url.href);
const data = await res.json(); // data contains a list of all pages
Response
The response will be sent as a tree structure representing the folder structure you have organized in your app. You can use this data to populate things like side nav, blog posts landing pages etc.