Skip to content

Commit 1a9cfe3

Browse files
committed
Add some .http files
1 parent 8c59d1b commit 1a9cfe3

File tree

2 files changed

+132
-0
lines changed

2 files changed

+132
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
@hostAddress = http://localhost:14141
2+
3+
### Get all books with their authors.
4+
5+
GET {{hostAddress}}/api/books?include=author
6+
7+
### Get the first two books.
8+
9+
GET {{hostAddress}}/api/books?page[size]=2
10+
11+
### Filter books whose title contains whitespace, sort descending by publication year.
12+
13+
GET {{hostAddress}}/api/books?filter=contains(title,'%20')&sort=-publishYear
14+
15+
### Get only the titles of all books.
16+
17+
GET {{hostAddress}}/api/books?fields[books]=title
18+
19+
### Get the names of all people.
20+
21+
GET {{hostAddress}}/api/people?fields[people]=name
22+
23+
### Create a new person.
24+
25+
POST {{hostAddress}}/api/people
26+
Content-Type: application/vnd.api+json
27+
28+
{
29+
"data": {
30+
"type": "people",
31+
"attributes": {
32+
"name": "Alice"
33+
}
34+
}
35+
}
36+
37+
### Create a new book, authored by the created person.
38+
39+
POST {{hostAddress}}/api/books
40+
Content-Type: application/vnd.api+json
41+
42+
{
43+
"data": {
44+
"type": "books",
45+
"attributes": {
46+
"title": "Getting started with JSON:API",
47+
"publishYear": 2000
48+
},
49+
"relationships": {
50+
"author": {
51+
"data": {
52+
"type": "people",
53+
"id": "4"
54+
}
55+
}
56+
}
57+
}
58+
}
59+
60+
### Change the publication year and author of the book with ID 1.
61+
62+
PATCH {{hostAddress}}/api/books/1
63+
Content-Type: application/vnd.api+json
64+
65+
{
66+
"data": {
67+
"type": "books",
68+
"id": "1",
69+
"attributes": {
70+
"publishYear": 1820
71+
},
72+
"relationships": {
73+
"author": {
74+
"data": {
75+
"type": "people",
76+
"id": "4"
77+
}
78+
}
79+
}
80+
}
81+
}
82+
83+
### Delete the book with ID 1.
84+
85+
DELETE {{hostAddress}}/api/books/1
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
@hostAddress = https://localhost:44340
2+
3+
### Gets all high-priority todo-items, including their owner, assignee and tags.
4+
5+
GET {{hostAddress}}/api/todoItems?include=owner,assignee,tags&filter=equals(priority,'High')
6+
7+
### Creates a todo-item, linking it to an existing owner, assignee and tags.
8+
9+
POST {{hostAddress}}/api/todoItems
10+
Content-Type: application/vnd.api+json
11+
12+
{
13+
"data": {
14+
"type": "todoItems",
15+
"attributes": {
16+
"description": "Create release",
17+
"priority": "High",
18+
"durationInHours": 1
19+
},
20+
"relationships": {
21+
"owner": {
22+
"data": {
23+
"type": "people",
24+
"id": "1"
25+
}
26+
},
27+
"assignee": {
28+
"data": {
29+
"type": "people",
30+
"id": "1"
31+
}
32+
},
33+
"tags": {
34+
"data": [
35+
{
36+
"type": "tags",
37+
"id": "1"
38+
},
39+
{
40+
"type": "tags",
41+
"id": "2"
42+
}
43+
]
44+
}
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)