Skip to content

Commit 028e3b0

Browse files
committed
Add list curation endpoints to openapi spec and restapi.rst
1 parent e05f678 commit 028e3b0

2 files changed

Lines changed: 149 additions & 2 deletions

File tree

doc/rest_api_doc/rest_api.rst

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ following endpoints for getting Statements:
2424

2525
The API also supports curating Statements via the
2626
:ref:`curation endpoint <curation>`, helping us improve the quality and accuracy
27-
of our content.
27+
of our content. You can also list curations (all, or by statement or evidence)
28+
via the :ref:`curation list endpoints <curation-list-all>`.
2829

2930
You will optionally need the following information to access a running web service:
3031

@@ -306,11 +307,46 @@ JSON data should contain the following fields:
306307
- **curator**: Your name, initials, email, or other way to identify yourself.
307308
Whichever you choose, please be consistent.
308309

309-
Note that you can also indicate that a Statement is _correct_. In particular,
310+
Note that you can also indicate that a Statement is *correct*. In particular,
310311
if you find that a Statement has some evidence that supports the Statement and
311312
some that does not, curating examples of both is valuable. In general, flagging
312313
correct Statements can be just as valuable as flagging incorrect Statements.
313314

315+
.. _curation-list-all:
316+
317+
List all curations
318+
------------------
319+
320+
.. openapi:: ../../indra_db_service/static/openapi.yaml
321+
:paths: /curation/list
322+
323+
This authenticated endpoint returns all curations in the database. Curator
324+
names are anonymized if the caller does not have the correct permissions.
325+
Authentication is done via an API key in the query parameters.
326+
327+
.. _curation-list-stmt:
328+
329+
List curations for a statement
330+
------------------------------
331+
332+
.. openapi:: ../../indra_db_service/static/openapi.yaml
333+
:paths: /curation/list/{stmt_hash}
334+
335+
This public endpoint returns curations for the given pre-assembly statement
336+
hash. Authentication is not required for this endpoint.
337+
338+
.. _curation-list-stmt-src:
339+
340+
List curations for a statement and evidence
341+
-------------------------------------------
342+
343+
.. openapi:: ../../indra_db_service/static/openapi.yaml
344+
:paths: /curation/list/{stmt_hash}/{src_hash}
345+
346+
This public endpoint returns all curations for a given statement and evidence.
347+
The curations are filtered by both the statement hash and the source (evidence) hash.
348+
Authentication is not required for this endpoint.
349+
314350
Usage examples
315351
==============
316352

indra_db_service/static/openapi.yaml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,82 @@ paths:
190190
schema:
191191
$ref: '#/components/schemas/CurationSubmitResponse'
192192

193+
/curation/list:
194+
get:
195+
summary: List all curations
196+
description: |
197+
This authenticated endpoint returns all curations in the database. Curator
198+
names are anonymized if the caller does not have the correct permissions.
199+
Authentication is done via an API key in the query parameters.
200+
operationId: listAllCurations
201+
parameters:
202+
- $ref: '#/components/parameters/ApiKeyParam'
203+
responses:
204+
'200':
205+
description: List of all curations
206+
content:
207+
application/json:
208+
schema:
209+
type: array
210+
items:
211+
$ref: '#/components/schemas/CurationListEntry'
212+
213+
/curation/list/{stmt_hash}:
214+
get:
215+
summary: List curations for a statement
216+
description: |
217+
Public endpoint. Returns curations for the given pre-assembly statement hash.
218+
Authentication is not required for this endpoint.
219+
operationId: listCurationsForStatement
220+
parameters:
221+
- name: stmt_hash
222+
in: path
223+
required: true
224+
description: Pre-assembly statement hash (pa level).
225+
schema:
226+
type: string
227+
example: "-1072112758478440"
228+
responses:
229+
'200':
230+
description: List of curations for the statement
231+
content:
232+
application/json:
233+
schema:
234+
type: array
235+
items:
236+
$ref: '#/components/schemas/CurationListEntry'
237+
238+
/curation/list/{stmt_hash}/{src_hash}:
239+
get:
240+
summary: List curations for a statement and evidence
241+
description: |
242+
Public endpoint. Returns curations filtered by both statement hash and
243+
source (evidence) hash. Authentication is not required for this endpoint.
244+
operationId: listCurationsForStatementAndSource
245+
parameters:
246+
- name: stmt_hash
247+
in: path
248+
required: true
249+
description: Pre-assembly statement hash (pa level).
250+
schema:
251+
type: string
252+
example: "-1072112758478440"
253+
- name: src_hash
254+
in: path
255+
required: true
256+
description: Source (evidence) hash for raw-level curations.
257+
schema:
258+
type: string
259+
responses:
260+
'200':
261+
description: List of curations for the statement and evidence
262+
content:
263+
application/json:
264+
schema:
265+
type: array
266+
items:
267+
$ref: '#/components/schemas/CurationListEntry'
268+
193269
components:
194270
parameters:
195271
FormatParam:
@@ -372,3 +448,38 @@ components:
372448
id:
373449
type: integer
374450
description: Database id of the submitted curation.
451+
452+
CurationListEntry:
453+
type: object
454+
description: A single curation record as returned by the list endpoints.
455+
properties:
456+
curator:
457+
type: string
458+
description: Curator email (may be anonymized if caller lacks get_curations permission).
459+
date:
460+
type: string
461+
description: Timestamp in HTTP date format (e.g. Thu, 29 Nov 2018 18:00:08 GMT).
462+
ev_json:
463+
type: string
464+
description: Optional evidence JSON (serialized).
465+
id:
466+
type: integer
467+
description: id of the curation.
468+
pa_hash:
469+
type: integer
470+
description: Pre-assembly statement hash.
471+
pa_json:
472+
type: string
473+
description: Optional pre-assembly statement JSON (serialized).
474+
source:
475+
type: string
476+
description: Source of the curation submission (e.g. DB REST API).
477+
source_hash:
478+
type: integer
479+
description: Source (evidence) hash for raw-level curations.
480+
tag:
481+
type: string
482+
description: Short category for the curation (e.g. grounding, correct).
483+
text:
484+
type: string
485+
description: Optional brief description of the curation.

0 commit comments

Comments
 (0)