Skip to content

Commit

Permalink
Add test, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Sep 20, 2023
1 parent e09b522 commit 81dd5c4
Show file tree
Hide file tree
Showing 4 changed files with 1,756 additions and 17 deletions.
30 changes: 13 additions & 17 deletions docs/source/endpoints/querystring.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
---
myst:
html_meta:
"description": "The @querystring endpoint returns the querystring configuration of plone.app.querystring."
"property=og:description": "The @querystring endpoint returns the querystring configuration of plone.app.querystring."
"description": "The @querystring endpoint returns metadata about available query operations."
"property=og:description": "The @querystring endpoint returns metadata about available query operations."
"property=og:title": "Querystring"
"keywords": "Plone, plone.restapi, REST, API, Querystring"
---

# Querystring

The `@querystring` endpoint returns the `querystring` configuration of `plone.app.querystring`.
The `@querystring` endpoint returns metadata about the query operations that can be performed using the [`@querystringsearch`](querystringsearch) endpoint.

Instead of simply exposing the `querystring` related `field` and `operation` entries from the registry, it serializes them in the same way that `p.a.querystring` does in its `@@querybuilderjsonconfig` view.
The results include all of the indexes that can be queried, along with metadata about each index.
The top-level `indexes` property includes all indexes, and the top-level `sortable_indexes` property includes only the indexes that can be used to sort.

This form is structured in a more convenient way for frontends to process:
Each index result includes a list of the query operations that can be performed on that index.
The `operations` property contains the list of operations as dotted names.
The `operators` property contains additional metadata about each operation.

- *Vocabularies* will be resolved.
Their values will be inlined in the `values` property.
- *Operations* will be inlined as well.
The `operations` property will contain the list of operations as dotted names.
The `operators` property will contain the full definition of each of those operations supported by that field.
- Indexes that are flagged as *sortable* are listed in a dedicated top-level property `sortable_indexes`.
If an index uses a vocabulary, the vocabulary values are included in the `values` property.
The vocabulary is resolved in the same context where the `/@querystring` endpoint is called (requires `plone.app.querystring >= 2.1.0`).

Available options for the querystring in a Plone site can be queried by interacting with the `/@querystring` endpoint on the portal root:
## Get Querystring Config


## Querystring Config

To retrieve all `querystring` options in the portal, call the `/@querystring` endpoint with a `GET` request:
To get the metadata about all query operations available in the portal, call the `/@querystring` endpoint with a `GET` request:

```{eval-rst}
.. http:example:: curl httpie python-requests
:request: ../../../src/plone/restapi/tests/http-examples/querystring_get.req
```

The server will respond with all `querystring` options in the portal:
The server will respond with the metadata:

```{literalinclude} ../../../src/plone/restapi/tests/http-examples/querystring_get.resp
:language: http
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GET /plone/front-page/@querystring HTTP/1.1
Accept: application/json
Authorization: Basic YWRtaW46c2VjcmV0
Loading

0 comments on commit 81dd5c4

Please sign in to comment.