Posts API Documentation

A Simple to use CRUD API for your Posts application. This API is ready to use with any frontend/backend framework or language.

Endpoints

Name Endpoint Method Copy
Post List /api/posts GET
Post Detail /api/posts/1 GET
Post Create /api/posts POST
Post Update /api/posts/1 PUT
Post Delete /api/posts/1 DELETE

How to Use

Post List API
Details

fetch('https://simplecrudapi.com/api/posts')
	.then(response => response.json())
	.then(json => console.log(json))
	.catch(error => console.error(error));

Post Detail API
Details

fetch('https://simplecrudapi.com/api/posts/1')
	.then(response => response.json())
	.then(json => console.log(json))
	.catch(error => console.error(error));

Post Create API
Details

fetch('https://simplecrudapi.com/api/posts', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'title': 'Sample Post Title',
    'content': 'Sample Post Description.',
    'category_id': 1,
    'tag_ids': [2, 3]
  })
})
	.then(response => response.json())
	.then(json => console.log(json))
	.catch(error => console.error('Error posting data:', error));

Post Update API
Details

fetch('https://simplecrudapi.com/api/posts/1', {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'title': 'Updated Post Title',
    'content': 'Updated content of the post',
    'category_id': 1,
    'tag_ids': [2, 3]
  })
})
	.then(response => response.json())
	.then(json => console.log(json))
	.catch(error => console.error('Error updating data:', error));

Post Delete API
Details

fetch('https://simplecrudapi.com/api/posts/1', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json'
  }
})
	.then(response => response.json())
	.then(json => console.log(json))
	.catch(error => console.error('Error deleting post:', error));

Code Sandbox Demos

No Code sandbox demos found yet!

No demos found, You can create a demo and contact us to put that with your credit link.

Contact Us

Or,

Browse All Code sandbox Demos
Previous
Users API

Our Proudly Sponsors 🎉

© 2024 Simple CRUD API. All rights reserved.