zillingen/json-content

The Bolt CMS extension allow create and edit records using REST API

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:bolt-extension

v0.1.0 2020-01-11 03:54 UTC

This package is auto-updated.

Last update: 2024-04-11 15:12:45 UTC


README

JSON-content is the BoltCMS extension allow to create and edit content using REST API

Configuration

After extension was installed you need change access token in the extension's config. This token need to authenticate requests of your HTTP client.

Config example:

path: /api/content
auth:
  enabled: true
  access_token: LeeD7che3sohs8ou8iizegeepai9oup

REST schema

View

View record by id

Example:

curl -X GET http://localhost:8000/api/content/entry/1

Create

Create record from json

Example:

curl -X POST \
     -H 'Content-Type: application/json' \
     -H 'X-Auth-Token: LeeD7che3sohs8ou8iizegeepai9oup' \ 
     -d '{"title":"My new entry","slug":"my-new-entry","ownerid":"1","status":"published"}' \
     http://localhost:8000/api/content/entry

You can create content entity with taxonomies.

POST request example with more advanced JSON:

POST http://localhost:8000/api/content/posts
Content-Type: application/json
X-Auth-Token: LeeD7che3sohs8ou8iizegeepai9oup

{
  "slug": "new-blog-post",
  "ownerid": 1,
  "status": "published",
  "title": "New blog post",
  "image": {
    "file": "2020-01/post-image.jpg"
  },
  "taxonomy": {
    "tags": [
      {
        "name": "News",
        "slug": "news"
      },
      {
        "name": "Review",
        "slug": "reviews"
      }
    ],
    "categories": [
      {
        "slug": "news",
        "name": "News"
      }
    ]
  }
}

Patch

Patch content entity fields

Example:

curl -X PATCH \
     -H 'Content-Type: application/json' \
     -H 'X-Auth-Token: LeeD7che3sohs8ou8iizegeepai9oup' \ 
     -d '{"title":"Patched title"}' \
     http://localhost:8000/api/content/entry/1