ponzu-cms / ponzu

Headless CMS with automatic JSON API. Featuring auto-HTTPS from Let's Encrypt, HTTP/2 Server Push, and flexible server framework written in Go.
https://docs.ponzu-cms.org
BSD 3-Clause "New" or "Revised" License
5.67k stars 387 forks source link

Add support for Content-type: application/json on create, update and delete #335

Closed dhilst closed 2 years ago

dhilst commented 4 years ago

This PR should add support for creating and updating records through JSON, by posting application/json requests

dhilst commented 4 years ago

I need to update update.go too with something similar...

olliephillips commented 4 years ago

Comments on reasoning/logic/flow really appreciated @dhilst. It should make a review easier.

@nilslice @ponzu-cms/team

dhilst commented 4 years ago

I just updated update.go and delete.go with relevant code :)

dhilst commented 4 years ago

I'm using this content/foo.go https://gist.github.com/dhilst/09f0fba73aa544408b0532a8176de855

And these calls to test

http -v POST :8080/api/content/create type==Foo bar="i got it?"
http -v POST :8080/api/content/update type==Foo id==1 bar="update"
http -v POST :8080/api/content/delete type==Foo id==1

httpie

nilslice commented 4 years ago

@dhilst this looks great, thank you for the work to get it implemented. I apologize for the delay, and will just reiterate that I'm holding off on accepting new PRs until (not in any order):

  1. the CI pipeline is fixed
  2. the CLI tooling's reliance on $GOPATH is dropped
  3. go module support is added

Sorry if this is causing any blockers for you -- I do intend to get your PR merged, but I feel irresponsible doing so until we can ensure the current feature set is stable with latest Go and has a strong foundation for future growth. Hope that is reasonable 😬

nilslice commented 4 years ago

@olliephillips - thanks much for tending to this as well, we'll get it across the finish line!