You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sparse_fieldsets.rst
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,13 @@ Sparse fieldsets
5
5
6
6
.. currentmodule:: flask_rest_jsonapi
7
7
8
-
You can restrict the fields returned by api with the querystring parameter called "fields". It is very useful for performance purpose because fields not returned are not resolved by api. You can use "fields" parameter on any kind of route (classical CRUD route or relationships route) and any kind of http methods as long as method return data.
8
+
You can restrict the fields returned by your API using the query string parameter called "fields". It is very useful for performance purposes because fields not returned are not resolved by the API. You can use the "fields" parameter on any kind of route (classical CRUD route or relationships route) and any kind of HTTP methods as long as the method returns data.
9
9
10
10
.. note::
11
11
12
-
Examples are not urlencoded for a better readability
12
+
Examples are not URL encoded for better readability
13
13
14
-
The syntax of a fields is like that ::
14
+
The syntax of the fields parameter is ::
15
15
16
16
?fields[<resource_type>]=<list of fields to return>
17
17
@@ -22,20 +22,20 @@ Example:
22
22
GET /persons?fields[person]=display_name HTTP/1.1
23
23
Accept: application/vnd.api+json
24
24
25
-
In this example person's display_name is the only field returned by the api. No relationships links are returned so the response is very fast because api doesn't have to compute relationships link and it is a very costly work.
25
+
In this example person's display_name is the only field returned by the API. No relationship links are returned so the response is very fast because the API doesn't have to do any expensive computation of relationship links.
26
26
27
27
You can manage returned fields for the entire response even for included objects
28
28
29
29
Example:
30
30
31
-
If you don't want to compute relationships links for included computers of a person you can do something like that
31
+
If you don't want to compute relationship links for included computers of a person you can do something like this
32
32
33
33
.. sourcecode:: http
34
34
35
35
GET /persons/1?include=computers&fields[computer]=serial HTTP/1.1
36
36
Accept: application/vnd.api+json
37
37
38
-
And of course you can combine both like that:
38
+
And of course you can combine both like this:
39
39
40
40
Example:
41
41
@@ -46,4 +46,4 @@ Example:
46
46
47
47
.. warning::
48
48
49
-
If you want to use both "fields" and "include" don't forget to specify the name of the relationship in fields; if you don't the include wont work.
49
+
If you want to use both "fields" and "include", don't forget to specify the name of the relationship in "fields"; if you don't, the include wont work.
0 commit comments