https://api.softhouse.rocks
An API that implements jsonplaceholder post and users endpoints, backed by a mongo database.
The purpose for this API is educational and meant as a step between using jsonplaceholder in a UI and implementing your own API.
- GET
- POST
- PUT
- PATCH
- DELETE
/posts - List of posts
/posts/{postId} - Gets a specific post with Id
curl -i -H "Content-Type:application/json" http://api.softhouse.rocks/posts/1
Gets the information from the specified URI
The result will look like this:
{"_id":"5e806d9f42fbde006b6b9ecf","userId":1,"id":1,"title":"sunt aut facere repellat provident occaecati excepturi optio reprehenderit","body":"quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto","__v":0}
curl http://api.softhouse.rocks/posts/1 | jq .
Gets the information in the specified URI and displays it in JSON format
The result will look like this:
{
"_id": "5e9ecdbd3c9c34a2d807ce9d",
"id": 1,
"__v": 0,
"body": "string",
"title": "string",
"userId": 1
}
curl -i -X POST -H "Content-Type:application/json" http://api.softhouse.rocks/posts -d '{"title":"Hi, World", "body":"Fresh as morning dew", "userId": "1"}'
Posts the information you give to the Object
The result will look like this:
{"_id":"5e9eb17e09cee0002106f314","body":"Fresh as morning dew","title":"Hi, World","userId":1,"id":811,"__v":0}
{
"_id": "5e9eadf3a8eb15002609e47b",
"body": "Fresh as morning dew",
"title": "Hi, World",
"userId": 1,
"id": 807,
"__v": 0
}
curl -i -X PUT http://api.softhouse.rocks/posts/3 -H "Content-Type:application/json" -d '{
"body": "NewBody", "title": "NewTitle", "userId": "1337"}'
Replaces the information on the specified path, with the provided data
Status: 200 OK
Returns body with the old information, should look like this
{"_id":"5e9ed8353c9c34a2d807f465","id":3,"__v":0,"body":"OldBody","title":"OldTitle","userId":13}
With jq:
{
"_id": "5ea14af48e9e2e7dc0da885c",
"id": 3,
"__v": 0,
"body": "NewBody",
"title": "NewTitle",
"userId": 1337
}
curl -i -X PATCH http://api.softhouse.rocks/posts/3 -H "Content-Type:application/json" -d '{
"body": "newBody", "userId": "3"}'
Updates a part of the object on the specified path, depending on the provided data
Status: 200 OK
Returns body with the updated information
{"body": "newBody", "title": "oldTitle", userId": "3"}
curl -i -X DELETE http://api.softhouse.rocks/posts/1
Deletes an object or endpoint at the specified path
Status:
200 OK - Path found, was deleted
204 No Content - Path not found, nothing changed
- GET
- POST
- PUT - Must have specific user Id
/users - List of users
/users/{userId} - Gets a specific user with users Id
curl -i -H "Content-Type:application/json" http://api.softhouse.rocks/users/1
Gets the information from the specified URI.
{"address":{"geo":{"lat":-37.3159,"lng":81.1496},"street":"Kulas Light","suite":"Apt. 556","city":"Gwenborough","zipcode":"92998-3874"},"_id":"5e806d9f42fbde006b6b9ec5","id":1,"name":"Leanne Graham","username":"Bret","email":"[email protected]","__v":0}
curl -X GET http://api.softhouse.rocks/users/1 | jq .<br>
{
"address": {
"geo": {
"lat": -37.3159,
"lng": 81.1496
},
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874"
},
"_id": "5e806d9f42fbde006b6b9ec5",
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "[email protected]",
"__v": 0
}
Gets the information in the specified URI and displays it in JSON format.