Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no Total-Records header in GET requests. only in HEAD requests. #1931

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This document describes changes between each past release.
- Storage backend API has changed, notions of collection and records were replaced
by the generic terms *resource* and *object*. Plugins that subclass the internal
``ShareableResource`` class may also break.
- GET requests no longer include the ``Total-Records`` header. To get a count in a collection
you need to do a HEAD request. And the new header name is ``Total-Objects``. (#1624)
- Remove the ``UserResource`` class. And ``ShareableResource`` is now deprecated in
favor of ``Resource``.

Expand All @@ -28,13 +30,13 @@ This document describes changes between each past release.
- Ignore admin plugin node_modules folder while running black (#1902)
- Remove regexp py36 warnings. (#1907)
- Changed psycopg2 dependency for psycopg2-binary. (#1905)
- Renamed core notions (ie. record and collection) (#710)


11.2.1 (2018-12-09)
-------------------

- Still supports jsonschema 2.6 before 3.0 is released as a production release. (#1923)
- Renamed core notions (ie. record and collection) (#710)
glasserc marked this conversation as resolved.
Show resolved Hide resolved


11.2.0 (2018-11-29)
Expand Down
3 changes: 0 additions & 3 deletions docs/api/1.x/_details-get-list.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
A ``Total-Objects`` response header indicates the total number of objects
of the list (not the response, since it can be paginated).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably have a _details-head-list.rst where we mention that the header can be obtained with HEAD


A ``Last-Modified`` response header provides a human-readable (rounded to second)
of the current collection timestamp.

Expand Down
3 changes: 1 addition & 2 deletions docs/api/1.x/buckets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,13 @@ Retrieving all buckets
.. sourcecode:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Total-Objects, Last-Modified, ETag
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Last-Modified, ETag
Content-Length: 54
Content-Type: application/json; charset=UTF-8
Date: Thu, 10 Sep 2015 08:37:32 GMT
Etag: "1441874072429"
Last-Modified: Thu, 10 Sep 2015 08:34:32 GMT
Server: waitress
Total-Objects: 1

{
"data": [
Expand Down
9 changes: 3 additions & 6 deletions docs/api/1.x/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ List bucket collections
.. sourcecode:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Content-Length, Expires, Alert, Retry-After, Last-Modified, Total-Objects, ETag, Pragma, Cache-Control, Backoff, Next-Page
Access-Control-Expose-Headers: Content-Length, Expires, Alert, Retry-After, Last-Modified, ETag, Pragma, Cache-Control, Backoff, Next-Page
Cache-Control: no-cache
Content-Length: 144
Content-Type: application/json; charset=UTF-8
Date: Fri, 26 Feb 2016 14:14:40 GMT
Etag: "1456496072475"
Last-Modified: Fri, 26 Feb 2016 14:14:32 GMT
Server: waitress
Total-Objects: 3

{
"data": [
Expand Down Expand Up @@ -777,7 +776,7 @@ From now on, the cache control headers are set for the `GET` requests:
:emphasize-lines: 3,8

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Total-Objects, Last-Modified, ETag, Cache-Control, Expires, Pragma
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Last-Modified, ETag, Cache-Control, Expires, Pragma
Cache-Control: max-age=3600
Content-Length: 11
Content-Type: application/json; charset=UTF-8
Expand All @@ -786,7 +785,6 @@ From now on, the cache control headers are set for the `GET` requests:
Expires: Mon, 14 Sep 2015 14:51:47 GMT
Last-Modified: Mon, 14 Sep 2015 13:47:30 GMT
Server: waitress
Total-Objects: 0

{
"data": [{}]
Expand All @@ -803,7 +801,7 @@ If set to ``0``, the collection records become explicitly uncacheable (``no-cach
:emphasize-lines: 3,8,10

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Total-Objects, Last-Modified, ETag, Cache-Control, Expires, Pragma
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Last-Modified, ETag, Cache-Control, Expires, Pragma
Cache-Control: max-age=0, must-revalidate, no-cache, no-store
Content-Length: 11
Content-Type: application/json; charset=UTF-8
Expand All @@ -813,7 +811,6 @@ If set to ``0``, the collection records become explicitly uncacheable (``no-cach
Last-Modified: Mon, 14 Sep 2015 13:47:30 GMT
Pragma: no-cache
Server: waitress
Total-Objects: 0

{
"data": []
Expand Down
3 changes: 1 addition & 2 deletions docs/api/1.x/filtering.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,12 @@ collection was not changed, a |status-304| response is returned.

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, ETag, Next-Page, Total-Objects, Last-Modified
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, ETag, Next-Page, Last-Modified
Content-Length: 436
Content-Type: application/json; charset=UTF-8
Date: Tue, 28 Apr 2015 12:08:11 GMT
Last-Modified: Mon, 12 Apr 2015 11:12:07 GMT
ETag: "1430222877724"
Total-Objects: 2

{
"data": [
Expand Down
3 changes: 1 addition & 2 deletions docs/api/1.x/groups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -320,14 +320,13 @@ Retrieving all groups
.. sourcecode:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Total-Objects, Last-Modified, ETag
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Last-Modified, ETag
Content-Length: 147
Content-Type: application/json; charset=UTF-8
Date: Thu, 13 Aug 2015 12:16:05 GMT
Etag: "1439468156451"
Last-Modified: Thu, 13 Aug 2015 12:15:56 GMT
Server: waitress
Total-Objects: 1

{
"data": [
Expand Down
1 change: 0 additions & 1 deletion docs/api/1.x/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ Retrieve history
Etag: "1469006098757"
Last-Modified: Wed, 20 Jul 2016 09:14:58 GMT
Server: waitress
Total-Objects: 4

{
"data": [
Expand Down
46 changes: 44 additions & 2 deletions docs/api/1.x/records.rst
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,13 @@ Retrieving stored records
.. sourcecode:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Next-Page, Total-Objects, Last-Modified, ETag
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Next-Page, Last-Modified, ETag
Content-Length: 110
Content-Type: application/json; charset=UTF-8
Date: Thu, 18 Jun 2015 17:24:38 GMT
Etag: "1434648278603"
Last-Modified: Thu, 18 Jun 2015 17:24:38 GMT
Server: waitress
Total-Objects: 1

{
"data": [
Expand All @@ -265,6 +264,49 @@ Retrieving stored records
]
}

.. _records-head:

Count of stored records
=======================
leplatrem marked this conversation as resolved.
Show resolved Hide resolved

.. http:head:: /buckets/(bucket_id)/collections/(collection_id)/records

:synopsis: Includes a response header to tell how many records exist in the collection.

**Requires authentication**

**Example Request**

.. sourcecode:: bash

$ http head http://localhost:8888/v1/buckets/blog/collections/articles/records --auth="bob:p4ssw0rd" --verbose
leplatrem marked this conversation as resolved.
Show resolved Hide resolved

.. sourcecode:: http

HEAD /v1/buckets/blog/collections/articles/records HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Authorization: Basic Ym9iOg==
Connection: keep-alive
Host: localhost:8888
User-Agent: HTTPie/0.9.2

.. sourcecode:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Total-Records, Total-Objects, Alert, Next-Page, Last-Modified, ETag
Content-Length: 110
Content-Type: application/json; charset=UTF-8
Date: Thu, 18 Jun 2015 17:24:38 GMT
Etag: "1434648278603"
Total-Objects: 33
Total-Records: 33
Last-Modified: Thu, 18 Jun 2015 17:24:38 GMT
Server: waitress

.. note::
The header ``Total-Records`` header is deprecated in favor of ``Total-Objects`` but kept for
backwards compatibility.

.. _record-get:

Expand Down
3 changes: 1 addition & 2 deletions docs/api/1.x/selecting_fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ Nested objects fields are specified using dots (e.g. ``address.street``).

HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, ETag, Next-Page, Total-Objects, Last-Modified
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, ETag, Next-Page, Last-Modified
Content-Length: 436
Content-Type: application/json; charset=UTF-8
Date: Tue, 28 Apr 2015 12:08:11 GMT
Last-Modified: Mon, 12 Apr 2015 11:12:07 GMT
ETag: "1430222877724"
Total-Objects: 2

{
"data": [
Expand Down
4 changes: 3 additions & 1 deletion docs/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Changelog
1.21 (unreleased)
'''''''''''''''''

- The ``Total-Records`` header was deprecated and renamed to ``Total-Objects``.
- The ``Total-Records`` header is no longer included in any GET request. Only available
in HEAD requests. Also, the name of that header is deprecated, but kept, in favor of
``Total-Objects`` (#1624, #710)

1.20 (2018-06-07)
'''''''''''''''''
Expand Down
9 changes: 3 additions & 6 deletions docs/tutorials/first-steps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Let us fetch our new collection of tasks:
.. code-block:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Next-Page, Total-Objects, Last-Modified, ETag
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Next-Page, Last-Modified, ETag
Backoff: 10
Connection: keep-alive
Content-Length: 152
Expand All @@ -174,7 +174,6 @@ Let us fetch our new collection of tasks:
ETag: "1436171996916"
Last-Modified: Mon, 06 Jul 2015 08:39:56 GMT
Server: nginx/1.4.6 (Ubuntu)
Total-Objects: 1

{
"data": [
Expand Down Expand Up @@ -397,7 +396,7 @@ Just add the ``_since`` querystring filter, using the value of any ``ETag`` (or
.. code-block:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Next-Page, Total-Objects, Last-Modified, ETag
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Next-Page, Last-Modified, ETag
Backoff: 10
Connection: keep-alive
Content-Length: 101
Expand All @@ -406,7 +405,6 @@ Just add the ``_since`` querystring filter, using the value of any ``ETag`` (or
ETag: "1434641474977"
Last-Modified: Thu, 18 Jun 2015 15:31:14 GMT
Server: nginx/1.4.6 (Ubuntu)
Total-Objects: 0

{
"data": [
Expand Down Expand Up @@ -621,11 +619,10 @@ If Bob wants to get the record list, he will get his records as well as Alice's
.. code-block:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Total-Objects, Last-Modified, ETag
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Last-Modified, ETag
Content-Length: 371
Content-Type: application/json; charset=UTF-8
Etag: "1434646257547"
Total-Objects: 3

{
"data": [
Expand Down
6 changes: 2 additions & 4 deletions docs/tutorials/permissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,14 @@ One can fetch the list of articles.
.. code-block:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Total-Objects, Last-Modified, ETag
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Last-Modified, ETag
Connection: keep-alive
Content-Length: 351
Content-Type: application/json; charset=UTF-8
Date: Thu, 16 Jul 2015 15:06:20 GMT
ETag: "1437058727907"
Last-Modified: Thu, 16 Jul 2015 14:58:47 GMT
Server: nginx/1.4.6 (Ubuntu)
Total-Objects: 2

{
"data": [
Expand Down Expand Up @@ -426,15 +425,14 @@ Or the list of comments.
.. code-block:: http

HTTP/1.1 200 OK
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Total-Objects, Last-Modified, ETag
Access-Control-Expose-Headers: Backoff, Retry-After, Alert, Content-Length, Next-Page, Last-Modified, ETag
Connection: keep-alive
Content-Length: 147
Content-Type: application/json; charset=UTF-8
Date: Thu, 16 Jul 2015 15:08:48 GMT
ETag: "1437058244384"
Last-Modified: Thu, 16 Jul 2015 14:50:44 GMT
Server: nginx/1.4.6 (Ubuntu)
Total-Objects: 1

{
"data": [
Expand Down
Loading