Skip to content

Commit 6321a47

Browse files
committed
example requests to readme
1 parent 071b922 commit 6321a47

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,84 @@ services.AddJsonApi(config => {
2323
app.UseJsonApi();
2424
```
2525

26+
## Example Requests
27+
28+
### GET TodoItems
29+
30+
Request:
31+
32+
```
33+
curl -X GET
34+
-H "Content-Type: application/vnd.api+json"
35+
"http://localhost:5000/api/v1/todoItems/"
36+
```
37+
38+
Response:
39+
40+
```
41+
{
42+
"links": {
43+
"self": "http://localhost:5000/api/v1/todoItems/"
44+
},
45+
"data": [
46+
{
47+
"type": "todoItems",
48+
"id": "2",
49+
"attributes": {
50+
"name": "Something To Do"
51+
},
52+
"relationships": {
53+
"owner": {
54+
"self": "http://localhost:5000/api/v1/todoItems/2/relationships/owner",
55+
"related": "http://localhost:5000/api/v1/todoItems/2/owner"
56+
}
57+
},
58+
"links": {
59+
"self": "http://localhost:5000/api/v1/todoItems/2"
60+
}
61+
}
62+
]
63+
}
64+
```
65+
66+
### Get People/{id}
67+
Request:
68+
69+
```
70+
curl -X GET
71+
-H "Content-Type: application/vnd.api+json"
72+
"http://localhost:5000/api/v1/people/1"
73+
```
74+
75+
Response:
76+
77+
```
78+
{
79+
"links": {
80+
"self": "http://localhost:5000/api/v1/people/1"
81+
},
82+
"data": {
83+
"type": "people",
84+
"id": "1",
85+
"attributes": {
86+
"name": "Captain Obvious"
87+
},
88+
"relationships": {
89+
"todoItems": {
90+
"self": "http://localhost:5000/api/v1/people/1/relationships/todoItems",
91+
"related": "http://localhost:5000/api/v1/people/1/todoItems"
92+
}
93+
},
94+
"links": {
95+
"self": "http://localhost:5000/api/v1/people/1"
96+
}
97+
}
98+
}
99+
```
100+
101+
## References
102+
[JsonApi Specification](http://jsonapi.org/)
103+
26104
## Current Assumptions
27105

28106
- Using Entity Framework

0 commit comments

Comments
 (0)