Skip to content

Commit 352fec4

Browse files
committed
update docs and snippets for person
1 parent a4167a9 commit 352fec4

File tree

7 files changed

+47
-32
lines changed

7 files changed

+47
-32
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Install
2424

2525

2626

27-
.. include:: ./docs/minimal_api_example.rst
27+
.. include:: ./docs/minimal_api_head.rst
2828

2929

3030
Flask-COMBO-JSONAPI vs `Flask-RESTful <https://flask-restful.readthedocs.io/en/latest/>`_

docs/http_snippets/minimal_api__create_person.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
],
1313
"postData": {
1414
"mimeType": "application/json",
15-
"text": "{\n\t\"data\": {\n\t\t\"type\": \"person\",\n\t\t\"attributes\": {\n\t\t\t\t\"name\": \"John\"\n\t\t}\n\t}\n}"
15+
"text": "{\n \"data\": {\n \"type\": \"person\",\n \"attributes\": {\n \"name\": \"John\"\n }\n }\n}"
1616
}
1717
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
POST /persons HTTP/1.1
22
Content-Type: application/vnd.api+json
33
Host: localhost:5000
4-
Content-Length: 78
4+
Content-Length: 90
55

66
{
7-
"data": {
8-
"type": "person",
9-
"attributes": {
10-
"name": "John"
11-
}
12-
}
7+
"data": {
8+
"type": "person",
9+
"attributes": {
10+
"name": "John"
11+
}
12+
}
1313
}

docs/http_snippets/snippets/minimal_api__get_person_result

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ Content-Type: application/vnd.api+json
1212
"self": "/persons/1"
1313
},
1414
"type": "person"
15+
},
16+
{
17+
"attributes": {
18+
"name": "Sam"
19+
},
20+
"id": "2",
21+
"links": {
22+
"self": "/persons/2"
23+
},
24+
"type": "person"
1525
}
1626
],
1727
"jsonapi": {
@@ -24,6 +34,6 @@ Content-Type: application/vnd.api+json
2434
"self": "http://localhost:5000/persons"
2535
},
2636
"meta": {
27-
"count": 1
37+
"count": 2
2838
}
2939
}

docs/minimal_api_example.rst

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
1-
A minimal API
2-
=============
3-
4-
.. literalinclude:: ../examples/api_minimal.py
5-
:language: python
6-
7-
8-
This example provides the following API structure:
9-
10-
======================== ====== ============= ===========================
11-
URL method endpoint Usage
12-
======================== ====== ============= ===========================
13-
/persons GET person_list Get a collection of persons
14-
/persons POST person_list Create a person
15-
/persons/<int:person_id> GET person_detail Get person details
16-
/persons/<int:person_id> PATCH person_detail Update a person
17-
/persons/<int:person_id> DELETE person_detail Delete a person
18-
======================== ====== ============= ===========================
19-
1+
.. include::./minimal_api_head.rst
202
213
Request:
224

docs/minimal_api_head.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
A minimal API
2+
=============
3+
4+
.. literalinclude:: ../examples/api_minimal.py
5+
:language: python
6+
7+
8+
This example provides the following API structure:
9+
10+
======================== ====== ============= ===========================
11+
URL method endpoint Usage
12+
======================== ====== ============= ===========================
13+
/persons GET person_list Get a collection of persons
14+
/persons POST person_list Create a person
15+
/persons/<int:person_id> GET person_detail Get person details
16+
/persons/<int:person_id> PATCH person_detail Update a person
17+
/persons/<int:person_id> DELETE person_detail Delete a person
18+
======================== ====== ============= ===========================

docs/quickstart.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ Quickstart
55

66
.. currentmodule:: flask_combo_jsonapi
77

8-
It's time to write your first REST API. This guide assumes you have a working understanding of `Flask <http://flask.pocoo.org>`_, and that you have already installed both Flask and Flask-COMBO-JSONAPI. If not, then follow the steps in the :ref:`installation` section.
8+
It's time to write your first advanced REST API.
9+
This guide assumes you have a working understanding of `Flask <https://flask.palletsprojects.com/en/1.1.x/>`_,
10+
and that you have already installed both Flask and Flask-COMBO-JSONAPI.
11+
If not, then follow the steps in the :ref:`installation` section.
912

10-
In this section you will learn basic usage of Flask-COMBO-JSONAPI around a small tutorial that use the SQLAlchemy data layer. This tutorial show you an example of a person and his computers.
13+
In this section you will learn basic usage of Flask-COMBO-JSONAPI
14+
around a small tutorial that use the SQLAlchemy data layer.
15+
This tutorial show you an example of a person and his computers.
1116

12-
First example
17+
Advanced example
1318
-------------
1419

1520
An example of Flask-COMBO-JSONAPI API looks like this:

0 commit comments

Comments
 (0)