🎉 New feature: Custom response templates now available!

Documentation

Welcome to the JSONbazaar documentation! This guide will help you understand how to use our API and explore various features.

API endpoints are available at https://jsonbazaar.onrender.com/api.

  1. Users API - Go to users endpoint
  2. Products API - Go to products endpoint
  3. Orders API - Go to orders endpoint
  4. Posts API - Go to posts endpoint
  5. Todos API - Go to todos endpoint
  6. Comments API - Go to comments endpoint

We have wrote API doc with javascript, you can use any language to work around it.

Users API

Get All Users

Retrieve a list of all users

fetch('https://jsonbazaar.onrender.com/api/users')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

[
  {
    "id": "1",
    "name": "Amit Sharma",
    "email": "amit.sharma@example.com",
    "username": "amitsharma",
    "city": "Mumbai",
    "state": "Maharashtra",
    "picture": "https://imgs.search.brave.com/tKpkf8CsWo2aOinlqPvEbQtwFZGkUtj4AwapIAUX358/rs:fit:500:0:0:0/g:ce/aHR0cHM6Ly9pbWcuZnJlZXBpay5jb20vcHJlbWl1bS1waG90by9hcmFiaWFuLWhhbmRzb21lLW1hbl8xMzY4LTEzMjI4MS5qcGc_c2VtdD1haXNfaHlicmlk"
  },
  // ... more users
]

Get User by ID

Retrieve a specific user by their ID

fetch('https://jsonbazaar.onrender.com/api/users/1')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

{
  "id": "1",
  "name": "Amit Sharma",
  "email": "amit.sharma@example.com",
  "username": "amitsharma",
  "city": "Mumbai",
  "state": "Maharashtra",
  "picture": "https://imgs.search.brave.com/tKpkf8CsWo2aOinlqPvEbQtwFZGkUtj4AwapIAUX358/rs:fit:500:0:0:0/g:ce/aHR0cHM6Ly9pbWcuZnJlZXBpay5jb20vcHJlbWl1bS1waG90by9hcmFiaWFuLWhhbmRzb21lLW1hbl8xMzY4LTEzMjI4MS5qcGc_c2VtdD1haXNfaHlicmlk"
}

Create New User

Create a new user with required fields

fetch('https://jsonbazaar.onrender.com/api/users/create', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    id: "51",
    name: "New User",
    email: "new.user@example.com",
    username: "newuser",
    city: "New City",
    state: "New State",
    picture: "https://example.com/image.jpg"
  })
})
  .then(response => response.json())

Response:

{
  "message": "User created successfully",
  "user": {
    "id": "51",
    "name": "New User",
    "email": "new.user@example.com",
    "username": "newuser",
    "city": "New City",
    "state": "New State",
    "picture": "https://example.com/image.jpg"
  }
}

Update User

Update an existing user's information

fetch('https://jsonbazaar.onrender.com/api/users/update/1', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    id: "1",
    name: "Amit Sharma Updated",
    email: "amit.updated@example.com",
    username: "amitsharma",
    city: "Mumbai",
    state: "Maharashtra",
    picture: "https://example.com/new-image.jpg"
  })
})
  .then(response => response.json())

Response:

{
  "message": "User updated successfully",
  "user": {
    "id": "1",
    "name": "Amit Sharma Updated",
    "email": "amit.updated@example.com",
    "username": "amitsharma",
    "city": "Mumbai",
    "state": "Maharashtra",
    "picture": "https://example.com/new-image.jpg"
  }
}

Delete User

Delete a user by their ID

fetch('https://jsonbazaar.onrender.com/api/users/delete/1', {
  method: 'DELETE'
})
  .then(response => response.json())

Response:

{
  "message": "User deleted successfully"
}

Products API

Get All Products

Retrieve a list of all products

fetch('https://jsonbazaar.onrender.com/api/products')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

[
  {
    "id": 1,
    "name": "Crystal Mug",
    "price": 12.99,
    "description": "A shiny mug for your coffee.",
    "image": "https://source.unsplash.com/random/300x300/?mug"
  },
  {
    "id": 2,
    "name": "Leather Wallet",
    "price": 24.5,
    "description": "Sleek and durable wallet.",
    "image": "https://source.unsplash.com/random/300x300/?wallet"
  },
  // ... more products
]

Get Product by ID

Retrieve a specific product by its ID

fetch('https://jsonbazaar.onrender.com/api/products/1')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

{
  "id": 1,
  "name": "Crystal Mug",
  "price": 12.99,
  "description": "A shiny mug for your coffee.",
  "image": "https://source.unsplash.com/random/300x300/?mug"
}

Create New Product

Create a new product with required fields

fetch('https://jsonbazaar.onrender.com/api/products/create', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 36,
    "name": "New Product",
    "price": 29.99,
    "description": "A great new item.",
    "image": "https://source.unsplash.com/random/300x300/?product"
  })
})
  .then(response => response.json())

Response:

{
  "message": "Product created successfully",
  "product": {
    "id": 36,
    "name": "New Product",
    "price": 29.99,
    "description": "A great new item.",
    "image": "https://source.unsplash.com/random/300x300/?product"
  }
}

Update Product

Update an existing product's information

fetch('https://jsonbazaar.onrender.com/api/products/update/1', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 1,
    "name": "Crystal Mug Updated",
    "price": 14.99,
    "description": "An updated shiny mug for your coffee.",
    "image": "https://source.unsplash.com/random/300x300/?mug"
  })
})
  .then(response => response.json())

Response:

{
  "message": "Product updated successfully",
  "product": {
    "id": 1,
    "name": "Crystal Mug Updated",
    "price": 14.99,
    "description": "An updated shiny mug for your coffee.",
    "image": "https://source.unsplash.com/random/300x300/?mug"
  }
}

Delete Product

Delete a product by its ID

fetch('https://jsonbazaar.onrender.com/api/products/delete/1', {
  method: 'DELETE'
})
  .then(response => response.json())

Response:

{
  "message": "Product deleted successfully"
}

Orders API

Get All Orders

Retrieve a list of all orders

fetch('https://jsonbazaar.onrender.com/api/orders')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

[
  {
    "id": 1,
    "user_id": 42,
    "product_id": 101,
    "quantity": 2,
    "status": "Pending"
  },
  {
    "id": 2,
    "user_id": 13,
    "product_id": 102,
    "quantity": 1,
    "status": "Shipped"
  },
  // ... more orders
]

Get Order by ID

Retrieve a specific order by its ID

fetch('https://jsonbazaar.onrender.com/api/orders/1')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

{
  "id": 1,
  "user_id": 42,
  "product_id": 101,
  "quantity": 2,
  "status": "Pending"
}

Error Response (404):

{
  "message": "Order not found"
}

Create New Order

Create a new order with required fields

fetch('https://jsonbazaar.onrender.com/api/orders/create', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 101,
    "user_id": 25,
    "product_id": 201,
    "quantity": 3,
    "status": "Pending"
  })
})
  .then(response => response.json())

Response (201):

{
  "message": "Order created successfully",
  "order": {
    "id": 101,
    "user_id": 25,
    "product_id": 201,
    "quantity": 3,
    "status": "Pending"
  }
}

Error Response (400):

{
  "message": "Invalid request data"
}

Update Order

Update an existing order's information

fetch('https://jsonbazaar.onrender.com/api/orders/update/1', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 1,
    "user_id": 42,
    "product_id": 101,
    "quantity": 2,
    "status": "Shipped"
  })
})
  .then(response => response.json())

Response (201):

{
  "message": "Order updated successfully",
  "order": {
    "id": 1,
    "user_id": 42,
    "product_id": 101,
    "quantity": 2,
    "status": "Shipped"
  }
}

Error Response (400):

{
  "message": "Invalid request data"
}

Delete Order

Delete an order by its ID

fetch('https://jsonbazaar.onrender.com/api/orders/delete/1', {
  method: 'DELETE'
})
  .then(response => response.json())

Response:

{
  "message": "Order deleted successfully"
}

Posts API

Get All Posts

Retrieve a list of all posts

fetch('https://jsonbazaar.onrender.com/api/posts')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

[
  {
    "id": 1,
    "user_id": 5,
    "title": "AI Trends to Watch in 2025",
    "content": "AI is transforming industries faster than ever before."
  },
  {
    "id": 2,
    "user_id": 12,
    "title": "My Journey Learning Python",
    "content": "Learning Python has been challenging but rewarding!"
  },
  // ... more posts
]

Get Post by ID

Retrieve a specific post by its ID

fetch('https://jsonbazaar.onrender.com/api/posts/1')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

{
  "id": 1,
  "user_id": 5,
  "title": "AI Trends to Watch in 2025",
  "content": "AI is transforming industries faster than ever before."
}

Error Response (404):

{
  "message": "Post not found"
}

Create New Post

Create a new post with required fields

fetch('https://jsonbazaar.onrender.com/api/posts/create', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 26,
    "user_id": 10,
    "title": "The Impact of Climate Change",
    "content": "Climate change is a pressing issue we need to address."
  })
})
  .then(response => response.json())

Response (201):

{
  "message": "Post created successfully",
  "post": {
    "id": 26,
    "user_id": 10,
    "title": "The Impact of Climate Change",
    "content": "Climate change is a pressing issue we need to address."
  }
}

Error Response (400):

{
  "message": "All fields are required"
}

Update Post

Update an existing post's information

fetch('https://jsonbazaar.onrender.com/api/posts/update/1', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 1,
    "user_id": 5,
    "title": "AI Trends to Watch in 2025 - Updated",
    "content": "AI continues to transform industries in exciting ways."
  })
})
  .then(response => response.json())

Response (201):

{
  "message": "Post updated successfully",
  "post": {
    "id": 1,
    "user_id": 5,
    "title": "AI Trends to Watch in 2025 - Updated",
    "content": "AI continues to transform industries in exciting ways."
  }
}

Error Response (400):

{
  "message": "All fields are required"
}

Delete Post

Delete a post by its ID

fetch('https://jsonbazaar.onrender.com/api/posts/delete/1', {
  method: 'DELETE'
})
  .then(response => response.json())

Response:

{
  "message": "Post deleted successfully"
}

Todos API

Get All Todos

Retrieve a list of all todos

fetch('https://jsonbazaar.onrender.com/api/todos')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

[
  {
    "id": 1,
    "user_id": 5,
    "title": "Finish reading book",
    "completed": false
  },
  {
    "id": 2,
    "user_id": 12,
    "title": "Buy groceries",
    "completed": true
  },
  // ... more todos
]

Get Todo by ID

Retrieve a specific todo by its ID

fetch('https://jsonbazaar.onrender.com/api/todos/1')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

{
  "id": 1,
  "user_id": 5,
  "title": "Finish reading book",
  "completed": false
}

Error Response (404):

{
  "message": "Todo not found"
}

Create New Todo

Create a new todo with required fields

fetch('https://jsonbazaar.onrender.com/api/todos/create', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 70,
    "user_id": 10,
    "title": "Finish online course",
    "completed": false
  })
})
  .then(response => response.json())

Response (201):

{
  "message": "Todo created successfully",
  "todo": {
    "id": 70,
    "user_id": 10,
    "title": "Finish online course",
    "completed": false
  }
}

Error Response (400):

{
  "message": "Invalid request body"
}

Update Todo

Update an existing todo's information

fetch('https://jsonbazaar.onrender.com/api/todos/update/1', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 1,
    "user_id": 5,
    "title": "Finish reading book",
    "completed": true
  })
})
  .then(response => response.json())

Response (201):

{
  "message": "Todo updated successfully",
  "todo": {
    "id": 1,
    "user_id": 5,
    "title": "Finish reading book",
    "completed": true
  }
}

Error Response (400):

{
  "message": "Invalid request body"
}

Delete Todo

Delete a todo by its ID

fetch('https://jsonbazaar.onrender.com/api/todos/delete/1', {
  method: 'DELETE'
})
  .then(response => response.json())

Response:

{
  "message": "Todo deleted successfully"
}

Comments API

Get All Comments

Retrieve a list of all comments

fetch('https://jsonbazaar.onrender.com/api/comments')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

[
  {
    "id": 1,
    "post_id": 5,
    "user_id": 12,
    "content": "Great post, really enjoyed reading it!"
  },
  {
    "id": 2,
    "post_id": 8,
    "user_id": 3,
    "content": "This helped me understand the topic better, thanks!"
  },
  // ... more comments
]

Get Comment by ID

Retrieve a specific comment by its ID

fetch('https://jsonbazaar.onrender.com/api/comments/1')
  .then(response => response.json())
  .then(data => console.log(data))

Response:

{
  "id": 1,
  "post_id": 5,
  "user_id": 12,
  "content": "Great post, really enjoyed reading it!"
}

Error Response (404):

{
  "message": "Comment not found"
}

Create New Comment

Create a new comment with required fields

fetch('https://jsonbazaar.onrender.com/api/comments/create', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 21,
    "post_id": 10,
    "user_id": 16,
    "content": "Really insightful, thanks for sharing!"
  })
})
  .then(response => response.json())

Response (201):

{
  "message": "Comment created",
  "comment": {
    "id": 21,
    "post_id": 10,
    "user_id": 16,
    "content": "Really insightful, thanks for sharing!"
  }
}

Error Response (400):

{
  "message": "Missing required fields"
}

Update Comment

Update an existing comment's information

fetch('https://jsonbazaar.onrender.com/api/comments/update/1', {
  method: 'PUT',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    "id": 1,
    "post_id": 5,
    "user_id": 12,
    "content": "Great post, really enjoyed reading it! (Edited)"
  })
})
  .then(response => response.json())

Response (201):

{
  "message": "Comment updated",
  "comment": {
    "id": 1,
    "post_id": 5,
    "user_id": 12,
    "content": "Great post, really enjoyed reading it! (Edited)"
  }
}

Error Response (400):

{
  "message": "Missing required fields"
}

Delete Comment

Delete a comment by its ID

fetch('https://jsonbazaar.onrender.com/api/comments/delete/1', {
  method: 'DELETE'
})
  .then(response => response.json())

Response:

{
  "message": "Comment deleted successfully"
}
Thank you for checking out this API documentation! If you have any questions or need further assistance, feel free to reach out to us.