Base URL:
https://sembako.sendiko.my.id/
/user/:id
Retrieves a registered user in the system.
id
(string): The unique identifier of the user. Example: 3
{
"Content-Type": "application/json"
}
{
"status": 200,
"user": {
"id": 3,
"username": "Rizky Sendiko",
"email": "example@gmail.com",
"profileUrl": "https://example.com/profile.jpg",
"createdAt": "2025-05-27T17:24:39.000Z",
"updatedAt": "2025-05-27T17:24:39.000Z"
}
}
/users
Creates a new user with the provided details.
{
"Content-Type": "application/json"
}
{
"username": "Sendiko",
"email": "awokwokwok5@gmail.com",
"profileUrl": "https://example.com/profile.jpg"
}
{
"status": 201,
"message": "User created successfully",
"user": {
"id": 8,
"username": "Sendiko",
"email": "awokwokwok5@gmail.com",
"profileUrl": "https://example.com/profile.jpg",
"updatedAt": "2025-06-08T15:37:54.199Z",
"createdAt": "2025-06-08T15:37:54.199Z"
}
}
/grocery/:userId
Retrieves a list of all groceries associated with a specific user ID.
userId
(string): The unique identifier of the user. Example: 3
{
"Content-Type": "application/json"
}
{
"status": 200,
"groceries": [
{
"id": 17,
"userId": 3,
"name": "Beras Raja Platinum",
"unit": "Kg",
"price": 19000,
"imageUrl": "http://sembako.sendiko.my.id/public/groceries/1749017019124-beras raja platinum",
"createdAt": "2025-05-30T08:30:33.000Z",
"updatedAt": "2025-06-04T06:03:39.000Z"
},
{
"id": 18,
"userId": 3,
"name": "Minyak Bimoli",
"unit": "Lt",
"price": 26000,
"imageUrl": "http://sembako.sendiko.my.id/public/groceries/1748593904619-minyak bimoli",
"createdAt": "2025-05-30T08:31:44.000Z",
"updatedAt": "2025-05-30T08:37:05.000Z"
}
]
}
/grocery
Adds a new grocery item to the system.
userId
(string, required): The ID of the user creating the grocery.name
(string, required): The name of the grocery item.unit
(string, required): The unit of measurement (e.g., "Kg", "Lt").price
(number, required): The price of the grocery item.image
(file, optional): An image file for the grocery item.{
"status": 201,
"message": "Grocery created successfully",
"grocery": {
"id": 24,
"userId": "4",
"name": "Telur Anomali",
"unit": "Kg",
"price": "1000000",
"imageUrl": "http://sembako.sendiko.my.id/public/groceries/1749397455180-telur.jpg",
"updatedAt": "2025-06-08T15:44:15.201Z",
"createdAt": "2025-06-08T15:44:15.201Z"
}
}
/grocery/:id
Updates an existing grocery item by its unique ID. All fields are optional for partial updates.
id
(string): The unique identifier of the grocery item. Example: 24
userId
(string, optional): The ID of the user associated with the grocery.name
(string, optional): The updated name of the grocery item.unit
(string, optional): The updated unit of measurement.price
(number, optional): The updated price of the grocery item.image
(file, optional): A new image file for the grocery item.{
"status": 200,
"message": "Grocery updated successfully",
"grocery": {
"id": 24,
"userId": 4,
"name": "Telur Anomali 2",
"unit": "Kg",
"price": 1000000,
"imageUrl": "http://sembako.sendiko.my.id/public/groceries/1749397455180-telur.jpg",
"createdAt": "2025-06-08T15:44:15.000Z",
"updatedAt": "2025-06-08T15:46:23.436Z"
}
}
/grocery/:id
Deletes a specific grocery item from the system by its unique ID.
id
(string): The unique identifier of the grocery item to delete. Example: 24
{
"Content-Type": "application/json"
}
{
"status": 200,
"message": "Grocery deleted successfully"
}
/history/:userId
Retrieves a list of all transaction history records for a specific user ID.
userId
(string): The unique identifier of the user. Example: 3
{
"Content-Type": "application/json"
}
{
"status": 200,
"history": [
{
"id": 6,
"groceryId": 17,
"userId": 3,
"quantity": 15,
"totalPrice": 285000,
"createdAt": "2025-05-30T09:15:20.000Z",
"updatedAt": "2025-05-30T09:15:20.000Z",
"Grocery": {
"id": 17,
"userId": 3,
"name": "Beras Raja Platinum",
"unit": "Kg",
"price": 19000,
"imageUrl": "http://sembako.sendiko.my.id/public/groceries/1749017019124-beras raja platinum",
"createdAt": "2025-05-30T08:30:33.000Z",
"updatedAt": "2025-06-04T06:03:39.000Z"
}
},
{
"id": 7,
"groceryId": 18,
"userId": 3,
"quantity": 3,
"totalPrice": 78000,
"createdAt": "2025-05-30T09:15:47.000Z",
"updatedAt": "2025-05-30T09:15:47.000Z",
"Grocery": {
"id": 18,
"userId": 3,
"name": "Minyak Bimoli",
"unit": "Lt",
"price": 26000,
"imageUrl": "http://sembako.sendiko.my.id/public/groceries/1748593904619-minyak bimoli",
"createdAt": "2025-05-30T08:31:44.000Z",
"updatedAt": "2025-05-30T08:37:05.000Z"
}
},
]
}
/history
Creates a new transaction history record.
{
"Content-Type": "application/json"
}
{
"groceryId": 19,
"userId": 3,
"quantity": 4.5,
"totalPrice": 126000
}
{
"status": 201,
"message": "History created successfully",
"history": {
"id": 13,
"groceryId": 19,
"userId": 3,
"quantity": 4.5,
"totalPrice": 126000,
"updatedAt": "2025-06-08T15:50:00.000Z",
"createdAt": "2025-06-08T15:50:00.000Z"
}
}
/stats/:userId
Retrieves various statistics related to grocery items and user activity.
userId
(string): The unique identifier of the user for whom to retrieve statistics. Example: 3
{
"Content-Type": "application/json"
}
{
"status": 200,
"message": "Grocery count retrieved successfully",
"statistics": {
"groceryCount": 5,
"totalSales": 1090000,
"totalHistory": 6
}
}