diff --git a/API.md b/API.md index 6a4ed371..e1f1ae77 100644 --- a/API.md +++ b/API.md @@ -129,14 +129,14 @@ For performance considerations, sometimes the client might want to choose the fields the server sends to it in order to improve the query speed. This customization is available for top-level fields of most of the [resources](#resources). To choose the fields, the client should pass -`?_fields=field1,field2,...` suffix to the query. This works regardless of the +`?fields=field1,field2,...` suffix to the query. This works regardless of the requesttype (`GET`, `PUT` etc.). For example, to list posts while getting only their IDs and tags, the client should send a `GET` query like this: ``` -GET /posts/?_fields=id,tags +GET /posts/?fields=id,tags ``` diff --git a/client/js/controllers/posts_controller.js b/client/js/controllers/posts_controller.js index f65fd405..2765f9fb 100644 --- a/client/js/controllers/posts_controller.js +++ b/client/js/controllers/posts_controller.js @@ -48,7 +48,7 @@ class PostsController { requestPage: page => { const text = this._decorateSearchQuery(ctx.searchQuery.text); return api.get( - `/posts/?query=${text}&page=${page}&pageSize=40&_fields=` + + `/posts/?query=${text}&page=${page}&pageSize=40&fields=` + `id,type,tags,score,favoriteCount,` + `commentCount,thumbnailUrl`); }, @@ -64,7 +64,7 @@ class PostsController { topNavController.activate('posts'); Promise.all([ api.get('/post/' + id), - api.get(`/post/${id}/around?_fields=id&query=` + api.get(`/post/${id}/around?fields=id&query=` + this._decorateSearchQuery('')), ]).then(responses => { const [postResponse, aroundResponse] = responses; diff --git a/client/js/controllers/tags_controller.js b/client/js/controllers/tags_controller.js index 35b96269..cd0acf8b 100644 --- a/client/js/controllers/tags_controller.js +++ b/client/js/controllers/tags_controller.js @@ -208,7 +208,7 @@ class TagsController { requestPage: page => { const text = ctx.searchQuery.text; return api.get( - `/tags/?query=${text}&page=${page}&pageSize=50&_fields=` + + `/tags/?query=${text}&page=${page}&pageSize=50&fields=` + `names,suggestions,implications,lastEditTime,usages`); }, headerRenderer: this._tagsHeaderView, diff --git a/server/szurubooru/func/util.py b/server/szurubooru/func/util.py index b4137106..270bf476 100644 --- a/server/szurubooru/func/util.py +++ b/server/szurubooru/func/util.py @@ -7,7 +7,7 @@ from contextlib import contextmanager from szurubooru import errors def get_serialization_options(ctx): - return ctx.get_param_as_list('_fields', required=False, default=None) + return ctx.get_param_as_list('fields', required=False, default=None) def serialize_entity(entity, field_factories, options): if not entity: