1.0.1 • Published 6 years ago

jangle-cms v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

jangle-cms

a headless cms built on mongoose.

API Documentation

"It's not done until the docs are great." - Evan Czaplicki, creator of elm

Jangle breaks up API endpoints into two categories:

  • Public: Does not require an authentication token.

  • Protected: Requires an authentication token for access.

Authentication API (Public)

Check if any users exist, sign up, and sign in.

RouteDescriptionQuery Params
GET /api/auth/statusDetermine if any users have been created.(None)
POST /api/auth/sign-upCreate first user with an email, password, and role.(None)
POST /api/auth/sign-inAttempt to sign in a user with an email and password.(None)

List API

Find, create, update, and remove items.

RouteDescriptionQuery Params
GET /api/:listFind items in :list collection.where, skip, limit, populate, select, sort
GET /api/:list/:idGet :list items with :idpopulate, select
POST /api/:listCreate a new item in :listNone.
PUT /api/:list/:idCompletely replace the :list item with :id with a new item.None.
PATCH /api/:list/:idUpdate some fields for the :list item with :idNone.
DELETE /api/:list/:idRemove the :list item with :idpermanent

Schema API

Get available lists and their fields (So you can roll your own Admin UI).

RouteDescriptionQuery Params
GET /api/jangle/schemasGets all Jangle lists and their fields.None
GET /api/jangle/schemas/:listFinds the Jangle list with name :list and its fields.None

History API

Look at item history, preview and commit a restore to a previous version.

RouteDescriptionQuery Params
GET /api/jangle/history/:idReturns complete history for an item.None
GET /api/jangle/history/:id/restorePreview the result of a version restore.list, version
POST /api/jangle/history/:id/restorePerform a version restore.list, version

Publishing API

Make content visible to anonymous users (read-only).

RouteDescriptionQuery Params
POST /api/:list/publish/:idPublishes the latest version of an item.None
DELETE /api/:list/unpublish/:idUnpublishes a published item.None

Examples

GET /api/jangle/users
> { error: true, message: "Please provide a valid token.", data: [] }

GET /api/jangle/users?token=<...>
> { error: false, message: "Found 3 users.", data: [ ... ]}

POST /api/jangle/users?token=<your-token>
body: { "email": "ryan.nhg@gmail.com", "password": "...", "role: "admin" }
> { error: false, message: 'User created.', data: { ... } }