SimpleNotes/api/http/test.http
2020-04-25 18:17:41 +02:00

61 lines
1.3 KiB
HTTP

# Register a new user
POST http://localhost:8081/user/login
Content-Type: application/json
{
"username": "{{username}}",
"password": "{{password}}"
}
> {%
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.global.set("uuid", response.body[0].uuid);
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}
### Create note
POST http://localhost:8081/notes
Authorization: Bearer {{token}}
Content-Type: application/json
{
"title": "test",
"tags": [
"Some",
"Tags"
],
"chapters": [
{
"title": "Chapter 1",
"content": "# This is some content"
}
]
}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 201, "Response status is not 201");
});
%}
### Get a note
GET http://localhost:8081/notes/6c4b1524-8cd5-426c-8a07-9a9eb082e9d4
Authorization: Bearer {{token}}
> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}