Here are some example cURL commands to interact with the API:
-
Create a User
sh
Copy code
curl -X POST http://localhost:3000/users \ -H "Content-Type: application/json" \ -d '{ "email": "newuser@mail.com", "password": "newpassword1234", "name": "New User" }' -
Get All Users
sh
Copy code
curl -X GET http://localhost:3000/users -
Get User by ID
sh
Copy code
curl -X GET http://localhost:3000/users/1 -
Update a User
sh
Copy code
curl -X PUT http://localhost:3000/users/1 \ -H "Content-Type: application/json" \ -d '{ "email": "updateduser@mail.com", "password": "updatedpassword1234", "name": "Updated User" }' -
Delete a User
sh
Copy code
curl -X DELETE http://localhost:3000/users/1 -
Create a Feed Stock
sh
Copy code
curl -X POST http://localhost:3000/feed-stocks \ -H "Content-Type: application/json" \ -d '{ "stock": 100 }' -
Get All Feed Stocks
sh
Copy code
curl -X GET http://localhost:3000/feed-stocks -
Get Feed Stock by ID
sh
Copy code
curl -X GET http://localhost:3000/feed-stocks/1 -
Update a Feed Stock
sh
Copy code
curl -X PUT http://localhost:3000/feed-stocks/1 \ -H "Content-Type: application/json" \ -d '{ "stock": 200 }' -
Delete a Feed Stock
sh
Copy code
`curl -X DELETE http://localhost:3000/feed-stocks/1`
- Create a Transaction
sh
Copy code
`curl -X POST http://localhost:3000/transactions \
-H "Content-Type: application/json" \
-d '{
"feed_stock_change": -1,
"chicken_count": 100,
"type": "DEP",
"location": "Location A"
}'`
- Get All Transactions
sh
Copy code
`curl -X GET http://localhost:3000/transactions`
- Get Transaction by ID
sh
Copy code
`curl -X GET http://localhost:3000/transactions/1`
- Update a Transaction
sh
Copy code
`curl -X PUT http://localhost:3000/transactions/1 \
-H "Content-Type: application/json" \
-d '{
"feed_stock_change": 0,
"chicken_count": 150,
"type": "WITH",
"location": "Location B"
}'`
- Delete a Transaction
sh
Copy code
`curl -X DELETE http://localhost:3000/transactions/1`
This documentation provides a comprehensive overview of the REST API endpoints, methods, request bodies, responses, and sample cURL commands for interacting with the API.