FipamoContentAPI

FipamoContentAPI

A bag of methods for getting content from an install.

Constructor

new FipamoContentAPI(baseURL, key)

Author:
  • Ro
Source:
Parameters:
Name Type Default Description
baseURL string null

url of install, defaults to local

key string null

user api key found in Settings

Methods

page(id) → {object}

Promise method for retrieving single page
GET /api/v1/page/single/:id

Source:
Parameters:
Name Type Description
id string

uuid of desired page

Returns:
Type:
object

json object that contains data for requested page

page object example

     {
       "id":1,
       "uuid":"uuid-for-entry",
       "title":"Entry Title",
       "feature":"/path/to/image.jpg",
       "path":"2020/09",
       "layout":"page",
       "tags":"these, are, tags",
       "author":"your-name",
       "created":"2020 Sep Tue 01",
       "updated":"2020 Sep Tue 01",
       "deleted":false,
       "menu":false,
       "featured":false,
       "published":true,
       "slug":"entry-title",
       "content":"Premium Content"
     }
Example
api.page("a-uuid-for-a-page").then(page=>{
        console.log("Page Object", page);
})

pages(type) → {object}

Promise method for retrieving page data
GET/api/v1/page/:type

Source:
Parameters:
Name Type Default Description
type string null

type of pages (published | menu | featured) being retrieved; null value defaults to published

Returns:
Type:
object

json object that contains pages of requested type

pages object example

    {
      "pages":
      [
        {
          "id":1,
          "uuid":"uuid-for-entry",
          "title":"Entry Title",
          "feature":"/path/to/image.jpg",
          "path":"2020/09",
          "layout":"page",
          "tags":"these, are, tags",
          "author":"your-name",
          "created":"2020 Sep Tue 01",
          "updated":"2020 Sep Tue 01",
          "deleted":false,
          "menu":false,
          "featured":false,
          "published":true,
          "slug":"entry-title",
          "content":"Premium Content"
        },
        {
          "id":2,
          "uuid":"uuid-for-entry",
          "title":"Another Title",
          "feature":"/path/to/image.jpg",
          "path":"2020/09",
          "layout":"page",
          "tags":"these, are, tags",
          "author":"your-name",
          "created":"2020 Sep Tue 01",
          "updated":"2020 Sep Tue 01",
          "deleted":false,
          "menu":false,
          "featured":false,
          "published":true,
          "slug":"another-title",
          "content":"Premium Content"
        }
      ],
    "totalItems":2
    }
Example
api.pages('published').then(pages=>{
   console.log("Pages Object", pages);
})

tags() → {object}

Promise method for retrieving all tags used by pages
GET /api/v1/page/tags

Source:
Returns:
Type:
object

json object that contains site tags and page stubs associated with said tag

tags object example

      [
        {
          "tag_name":"this is a tag",
          "slug":"this-is-a-tag",
          "pages":
            [
              {
                "title":"This is a title",
                "slug":"this-is-a-title",
                "path":"2021/04"
              },
              
              {
                "title":"This is another title",
                "slug":"this-is-another-title",
                "path":"2020/10"
              }
            ]
        },
        {
          "tag_name":"this is another tag",
          "slug":"this-is-another-tag",
          "pages":
            [
              {
                "title":"This is a title",
                "slug":"this-is-a-title",
                "path":"2021/04"
              },
              
              {
                "title":"This is another title",
                "slug":"this-is-another-title",
                "path":"2020/10"
              }
            ]
        }
      ]  
Example
api.tags().then(tags=>{
       console.log("Tags Object", tags);
})