Skip to content
BoltCMS extension allow create and edit content via REST API
PHP
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
src
.gitignore
JsonContentExtension.php
README.md
composer.json
readme.md

README.md

JSON content

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
You can’t perform that action at this time.