- There can be an unlimited number of categories
- Categories can be disabled
- There can be an unlimited number of posts
- Each post can be in several categories
- Each post can have an unlimited number of tags
- Authors can manage their posts
- Administrator can manage all posts and categories
- Guests can view published posts, provided that the post has at least one active category.
- Disabled categories should not be displayed to authors and guests.
curl -X POST 'http://127.0.0.1:8000/api/blog/categories' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 1|BJNusG6iCLFVYaWAZSJio0Rh7TpzdDbD9aZ6YdMP20d90436' \
-d '{"data":{"type":"categories", "attributes": {"title": "Lifestyle", "slug": "lifestyle", "status": "A"}}}'
curl -X POST 'http://127.0.0.1:8000/api/blog/categories' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 1|BJNusG6iCLFVYaWAZSJio0Rh7TpzdDbD9aZ6YdMP20d90436' \
-d '{"data":{"type":"categories", "attributes": {"title": "IT", "slug": "it", "status": "A"}}}'
curl -X PATCH 'http://127.0.0.1:8000/api/blog/categories/1' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 1|BJNusG6iCLFVYaWAZSJio0Rh7TpzdDbD9aZ6YdMP20d90436' \
-d '{"data":{"type":"categories", "id": "1", "attributes": {"status": "D"}}}'
curl -X POST 'http://127.0.0.1:8000/api/blog/posts' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 2|3Zj3NwFaVTOFBJI7zyPLlCVJRsq33YhYI81t8OxTbd2c47f5' \
-d '{"data":{"type":"posts", "attributes": {"title": "How to Create JSON:API Resources", "content": "In our second blog post", "publishedAt": null}, "relationships": {"categories": {"data": [{"type": "categories", "id": "2"}]}}}}'
curl -X POST 'http://127.0.0.1:8000/api/blog/tags' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 2|3Zj3NwFaVTOFBJI7zyPLlCVJRsq33YhYI81t8OxTbd2c47f5' \
-d '{"data":{"type":"tags", "attributes": {"title": "JSON-API", "postId": 1}}}'
curl -X POST 'http://127.0.0.1:8000/api/blog/tags' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 2|3Zj3NwFaVTOFBJI7zyPLlCVJRsq33YhYI81t8OxTbd2c47f5' \
-d '{"data":{"type":"tags", "attributes": {"title": "Laravel", "postId": 1}}}'
curl -X PATCH 'http://127.0.0.1:8000/api/blog/posts/1' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 2|3Zj3NwFaVTOFBJI7zyPLlCVJRsq33YhYI81t8OxTbd2c47f5' \
-d '{"data":{"type":"posts", "id": "1", "attributes": {"publishedAt": "2023-07-10T12:00+00:00"}}}'
curl -g -X POST 'http://127.0.0.1:8000/api/blog/posts/{postId}/relationships/categories' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 1|BJNusG6iCLFVYaWAZSJio0Rh7TpzdDbD9aZ6YdMP20d90436' \
-d '{"data": [{"type":"categories", "id":"10"}]}'
curl -g -X DELETE 'http://127.0.0.1:8000/api/blog/posts/{postId}/relationships/categories' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 1|BJNusG6iCLFVYaWAZSJio0Rh7TpzdDbD9aZ6YdMP20d90436' \
-d '{"data": [{"type":"categories", "id":"10"}]}'
curl -g -X PATCH 'http://127.0.0.1:8000/api/blog/posts/{postId}/relationships/categories' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Authorization: Bearer 1|BJNusG6iCLFVYaWAZSJio0Rh7TpzdDbD9aZ6YdMP20d90436' \
-d '{"data": [{"type":"categories", "id":"10"}]}'
curl -X GET 'http://127.0.0.1:8000/api/blog/posts?include=author,tags,categories' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json'
curl -g -X GET 'http://127.0.0.1:8000/api/blog/posts?include=author,tags,categories&filter[title]=API' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json'
curl -g -X GET 'http://127.0.0.1:8000/api/blog/posts?include=author,tags,categories&filter[content]=blog' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json'
curl -g -X GET 'http://127.0.0.1:8000/api/blog/posts?include=author,tags,categories&filter[categories][id][]=1' \
-H 'Accept: application/vnd.api+json' \
-H 'Content-Type: application/vnd.api+json'