Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for posting content via a REST API #793

Merged
merged 15 commits into from
Jan 8, 2022

Conversation

lukeraymonddowning
Copy link
Contributor

@lukeraymonddowning lukeraymonddowning commented Dec 24, 2021

This PR adds a REST API that can be accessed by users to perform the following operations:

  • Create an article: api.articles.store
  • Update an article: api.articles.update
  • Delete an article: api.articles.delete

The idea is that bloggers could set up an API integration that would allow them to automatically publish content to Laravel IO when their articles go live. This would make it far easier to port content over to Laravel IO and increase article output.

These routes are protected by Laravel Sanctum. Tokens can be created and deleted from a user's profile settings page.

All 3 endpoints reuse the existing controllers, allowing for validation rules, request objects and more to be shared across HTTP and REST, reducing the amount of maintenance required to keep the API up to date.

@lukeraymonddowning lukeraymonddowning marked this pull request as ready for review December 27, 2021 13:31
Copy link
Contributor

@joedixon joedixon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great, thanks @lukeraymonddowning 👏

I just made a few comments. Let me know what you think.

@driesvints
Copy link
Member

@lukeraymonddowning can you maybe rebase with main to make sure the new UI is working on the recently merged Tailwind v3 PR?

driesvints and others added 5 commits December 29, 2021 17:35
* Added check inside the create method of the RegisterController to find duplicate github ID

* Added error message saying "We already found a user with the given GitHub account.......

* fixed failing test

* fixed stycli errors

* styleci fixes

* styleci fixes

* more styleci fixes

* wip

Co-authored-by: Dries Vints <[email protected]>
* update dependencies

* update classes

* remove classes duplication

* resolve conflict

* Remove dependency

Co-authored-by: faissaloux <[email protected]>
@lukeraymonddowning
Copy link
Contributor Author

@driesvints rebased. UI is fine after the update 👍

@driesvints
Copy link
Member

I'll try to review all of this again this weekend. Thanks!

@driesvints driesvints self-assigned this Jan 8, 2022
@driesvints driesvints mentioned this pull request Jan 8, 2022
@driesvints driesvints merged commit 3e13297 into laravelio:main Jan 8, 2022
@driesvints
Copy link
Member

This was a fantastic PR. Thank you so much for this @lukeraymonddowning 👏

I also opened an issue to follow up with some documentation eventually: #803. We'll try to look into that when we find some time.

@SamuelNitsche
Copy link

I'm not sure if I miss something but I think that there is currently no way to obtain the api token created by sanctum. The user profile only displays the hashed api token. The unhashed token should be displayed once after creating the api token was created (see docs)

@lukeraymonddowning
Copy link
Contributor Author

@SamuelNitsche you're right, an oversight by me. Going to push a fix later

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

6 participants