Full API interaction for content Create, Update & Delete via external clients
This is an important release! v0.9.0 is introducing some breaking changes. If you have been using the api.Externalable
interface to accept content from external clients, you will need to update a couple methods and change some client code for API endpoints.
-
Huge thanks to @kkeuning for his work on the
api.Updateable
interface, enabling outside clients to update content via the Content API. This allows Ponzu systems to handle POST requests to/api/content/update?type=<Type>&id=<id>
and will merge in updated fields to the database. -
A new
api.Deleteable
interface is available, with a single method:Delete(http.ResponseWriter, *http.Request) error
- this enables external clients to delete content from the database via the Content API endpoint:/api/content/delete?type=<Type>&id=<id>
Note: along with both of the additions above come
item.Hookable
methods so Ponzu users can hook into the req/res lifecycle and do validation, logging, trigger notifications, modify data etc. -
BREAKING CHANGE:
api.Externalable
and its methodAccept(http.ResponseWriter, *http.Request) error
have been renamed to follow the convention set with Updateable and Deleteable, and are nowapi.Createable
andCreate(http.ResponseWriter, *http.Request) error
This also means that the Content API endpoint for creating content from external clients is now
/api/content/create?type=<Type>
instead of/api/content/external?type=<Type>
I apologize for any inconvenience this brings, and for making breaking changes, but the clarity and consistency this adds are nicer to work with. I believe it will set a precedence for naming patterns that will keep the codebase cleaner and easier to pick up down the line.
From here, we have only a bit of clean-up, a Filterable interface (#86) proposed by @olliephillips which acts as a stored procedure of sorts, and optimizations to the db.SortContent
function which is causing issues when large amounts of external content is created at once. Unless there are other suggestions that would change the overall Ponzu API, completion of these items and more testing should allow us to hit the v1.0.0 mark!
To get the latest release:
$ go get -u github.com/ponzu-cms/ponzu/...
$ cd $PROJ
$ ponzu upgrade