Skip to content

Commit 97e7517

Browse files
committed
additional request examples
1 parent f17a2cf commit 97e7517

7 files changed

+89
-7
lines changed

docs/request-examples/001-CREATE_Article.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ curl -vs http://localhost:5001/api/articles \
55
"data": {
66
"type": "articles",
77
"attributes": {
8-
"title": "test"
8+
"title": "Moby"
99
},
1010
"relationships": {
1111
"author": {
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
curl -vs http://localhost:5001/api/people/1 \
2+
-H "Accept: application/vnd.api+json" \
3+
-H "Content-Type: application/vnd.api+json" \
4+
-X PATCH \
5+
-d '{
6+
"data": {
7+
"type": "people",
8+
"attributes": {
9+
"name": "Bob"
10+
}
11+
}
12+
}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
curl -vs http://localhost:5001/api/articles/1 \
2+
-H "Accept: application/vnd.api+json" \
3+
-X DELETE

docs/request-examples/007-__SEED__.sh

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
curl -vs http://localhost:5001/api/people \
2+
-H "Accept: application/vnd.api+json" \
3+
-H "Content-Type: application/vnd.api+json" \
4+
-d '{
5+
"data": {
6+
"type": "people",
7+
"attributes": {
8+
"name": "Alice"
9+
}
10+
}
11+
}'
12+
13+
curl -vs http://localhost:5001/api/articles \
14+
-H "Accept: application/vnd.api+json" \
15+
-H "Content-Type: application/vnd.api+json" \
16+
-d '{
17+
"data": {
18+
"type": "articles",
19+
"attributes": {
20+
"title": "Moby"
21+
},
22+
"relationships": {
23+
"author": {
24+
"data": {
25+
"type": "people",
26+
"id": "2"
27+
}
28+
}
29+
}
30+
}
31+
}'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
curl -vs http://localhost:5001/api/articles?filter%5Btitle%5D=Moby \
2+
-H "Accept: application/vnd.api+json"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
curl -vs http://localhost:5001/api/people?filter%5Bname%5D=like:Al \
2+
-H "Accept: application/vnd.api+json"

docs/request-examples/index.md

+38-6
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,60 @@
22

33
These requests have been generated against the "GettingStarted" application and are updated on every deployment.
44

5-
## Create Person
5+
## Simple CRUD
6+
7+
### Create
68

79
[!code-sh[CREATE](000-CREATE_Person.sh)]
810
[!code-json[CREATE](000-CREATE_Person-Response.json)]
911

10-
## Create Article
12+
### Create with Relationship
1113

1214
[!code-sh[CREATE](001-CREATE_Article.sh)]
1315
[!code-json[CREATE](001-CREATE_Article-Response.json)]
1416

1517

16-
## Get All Articles
18+
### Get All
1719

1820
[!code-sh[GET Request](002-GET_Articles.sh)]
1921
[!code-json[GET Response](002-GET_Articles-Response.json)]
2022

21-
## Get Article By Id
23+
### Get By Id
2224

2325
[!code-sh[GET Request](003-GET_Article.sh)]
2426
[!code-json[GET Response](003-GET_Article-Response.json)]
2527

26-
## Get Article with Author
28+
### Get with Relationship
2729

2830
[!code-sh[GET Request](004-GET_Articles_With_Authors.sh)]
29-
[!code-json[GET Response](004-GET_Articles_With_Authors-Response.json)]
31+
[!code-json[GET Response](004-GET_Articles_With_Authors-Response.json)]
32+
33+
### Update
34+
35+
[!code-sh[PATCH Request](005-PATCH_Article.sh)]
36+
[!code-json[PATCH Response](005-PATCH_Article-Response.json)]
37+
38+
### Delete
39+
40+
[!code-sh[DELETE Request](006-DELETE_Article.sh)]
41+
[!code-json[DELETE Response](006-DELETE_Article-Response.json)]
42+
43+
## Filters
44+
45+
_Note that cURL requires URLs to be escaped._
46+
47+
### Equality
48+
49+
[!code-sh[GET Request](008-GET_Articles_With_Filter_Eq.sh)]
50+
[!code-json[GET Response](008-GET_Articles_With_Filter_Eq-Response.json)]
51+
52+
### Like
53+
54+
[!code-sh[GET Request](009-GET_Articles_With_Filter_Like.sh)]
55+
[!code-json[GET Response](009-GET_Articles_With_Filter_Like-Response.json)]
56+
57+
## Sorting
58+
59+
# See Also
60+
61+
- Customizing QuerySet

0 commit comments

Comments
 (0)