SimpleNotes/api/http/test.http

55 lines
1.1 KiB
HTTP

# Register a new user
POST http://localhost:8081/login
Content-Type: application/json
{
"username": "hubert",
"password": "test"
}
> {%
client.global.set("token", response.body.token);
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### Get notes
GET http://localhost:8081/notes
Authorization: Bearer {{token}}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### Create a note
POST http://localhost:8081/notes/tortue
Content-Type: application/json
Authorization: Bearer {{token}}
{
"tags": [
"Dev",
"Server"
]
}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 201, "Response status is not 200");
});
%}
### Read a note
GET http://localhost:8081/notes/babar
Content-Type: application/json
Authorization: Bearer {{token}}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}