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: CONTRIBUTING.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -28,7 +28,7 @@ Instead of `make dev`, run both `make dev-oidc` and `make fake-oidc-server`.
28
28
29
29
We use OpenAPI specification for API documentation. It is located at `docs/api.yaml`.
30
30
31
-
You can run `make api-docs` to preview the document.
31
+
You can run `make api-docs` to preview the document. This will use Docker to build the entire Central docs, which contain the API docs under the "Developers" section.
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,9 @@ A number of operational tasks (creating accounts, setting passwords, etc) may be
24
24
25
25
### Accessing the API
26
26
27
-
ODK Central Backend is, first and foremost, a RESTful HTTP API server that manages Users, Forms, Submissions, and other objects necessary to run an ODK data collection campaign. This API is used by the bundled frontend web interface to form a complete user-installable server solution, but that API can also be used on its own with or without the frontend to programmatically manage a data collection project. We provide a full documentation of the API in the standard [OpenAPI](https://www.openapis.org/) format. You can find a plain version of that documentation [here](https://github.com/getodk/central-backend/blob/master/docs/api.yaml) in the repository, or you can access the [published version](https://docs.getodk.org/central-api/) for a friendlier interface.
27
+
ODK Central Backend is, first and foremost, a RESTful HTTP API server that manages Users, Forms, Submissions, and other objects necessary to run an ODK data collection campaign. This API is used by the bundled frontend web interface to form a complete user-installable server solution, but that API can also be used on its own with or without the frontend to programmatically manage a data collection project.
28
+
29
+
We provide a full documentation of the API in the standard [OpenAPI](https://www.openapis.org/) format. You can find a plain version of that documentation [here](https://github.com/getodk/central-backend/blob/master/docs/api.yaml) in the repository, or you can access the [published version](https://docs.getodk.org/central-api/) for a friendlier interface. Please see the [makefile](Makefile) and [Contribution Guide](https://github.com/getodk/central-backend/blob/master/CONTRIBUTING.md) for information on building the documentation locally.
Copy file name to clipboardExpand all lines: docs/api.yaml
+73-20Lines changed: 73 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -40,15 +40,27 @@ info:
40
40
41
41
**Added**:
42
42
43
-
- Entities accessed via API now have conflict and version-specific conflictingProperties fields
43
+
- Central now supports _Entity Updates via Submissions_ as part of our continued work on Entity-Based Data Collection!
44
+
* Submissions for Entity Updates specify which properties/label to update with new values and an Entity's target `baseVersion`, which is used to track conflicts
45
+
- Entities accessed via the API have additional information about conflicts (when multiple Submissions update the same Entity)
46
+
* Each [Entity](/central-api-entity-management/#getting-entity-details) now has a `conflict` field, which is either:
47
+
* `null`. The Entity does not have conflicting versions.
48
+
* `soft`. The Entity has a version that was based on a version other than the version immediately prior to it. (The specified `baseVerson` was not the latest version on the server.)
49
+
* `hard`. The Entity has a version that was based on a version other than the version immediately prior to it. Further, that version updated the same property as another update.
50
+
* If an Entity has a conflict, it can be marked as resolved. After that, the conflict field will be null until a new conflicting version is received.
51
+
* Each Entity Version (`currentVersion` or list of versions) has new fields `baseVersion`, `dataReceived`, and `conflictingProperties`
52
+
- [Datasets](/central-api-dataset-management/#datasets) extended metadata now has a `conflicts` field, which counts number of Entities currently in conflict
53
+
- Entity conflicts can be resolved using the existing [PATCH](/central-api-entity-management/#updating-an-entity) endpoint, with or without new data
54
+
- New `relevantToConflict` query parameter on [GET entities/:uuid/versions](/central-api-entity-management/#listing-versions)
44
55
45
-
* Conflicts are either `hard` (baseVersion conflicts and multiple versions update the same property), `soft` (baseVersion conflicts but data updates are independent), or `null`
46
56
47
57
**Changed**:
48
58
49
-
- Conflicts can be resolved using the [PATCH entity](/central-api-entity-management/#updating-an-entity) endpoint with or without new data
59
+
- Dataset entity list [entities.csv](/central-api-dataset-management/#download-dataset) can now be filtered
60
+
- Entity Update [PATCH](/central-api-entity-management/#updating-an-entity) endpoint now expects `baseVersion` query parameter or `force` flag
50
61
51
-
### ODK Central v2023.4
62
+
63
+
## ODK Central v2023.4
52
64
53
65
**Added**:
54
66
@@ -67,14 +79,14 @@ info:
67
79
- New endpoint [PATCH /projects/:id/datasets/:name](/central-api-dataset-management/#update-dataset-metadata) to change whether approval of Submission is required to create an Entity.
68
80
- New [Entities](/central-api-entity-management) endpoints for richer Entity-Based Data Collection workflows. These endpoints provide ways of accessing Entities, as well as the ability to _create_, _update_ and _soft-delete_ Entities via the API!
69
81
70
-
* New endpoint [GET /projects/:id/datasets/:name/entities](/central-api-entities/#entities-metadata) for listing Entities within a Dataset.
71
-
* New endpoint [GET /projects/:id/datasets/:name/entities/:uuid](/central-api-entities/#getting-entity-details) for getting the metadata, or details, about a specific Entity.
72
-
* New endpoint [GET /projects/:id/datasets/:name/entities/:uuid/versions](/central-api-entities/#listing-versions) for listing the versions of an Entity.
73
-
* New endpoint [GET /projects/:id/datasets/:name/entities/:uuid/diffs](/central-api-entities/#getting-changes-between-versions) for getting the changes between versions of an Entity.
74
-
* New endpoint [GET /projects/:id/datasets/:name/entities/:uuid/audits](/central-api-entities/#entity-audit-log) for getting the server audit logs about a specific Entity.
75
-
* New endpoint [POST /projects/:id/datasets/:name/entities](/central-api-entities/#creating-an-entity) for creating an Entity from JSON.
76
-
* New endpoint [PATCH /projects/:id/datasets/:name/entities/:uuid](/central-api-entities/#updating-an-entity) for updating the data or label of an Entity.
77
-
* New endpoint [DELETE /projects/:id/datasets/:name/entities/:uuid](/central-api-entities/#deleting-an-entity) for soft-deleting an Entity.
82
+
* New endpoint [GET /projects/:id/datasets/:name/entities](/central-api-entity-management/#entities-metadata) for listing Entities within a Dataset.
83
+
* New endpoint [GET /projects/:id/datasets/:name/entities/:uuid](/central-api-entity-management/#getting-entity-details) for getting the metadata, or details, about a specific Entity.
84
+
* New endpoint [GET /projects/:id/datasets/:name/entities/:uuid/versions](/central-api-entity-management/#listing-versions) for listing the versions of an Entity.
85
+
* New endpoint [GET /projects/:id/datasets/:name/entities/:uuid/diffs](/central-api-entity-management/#getting-changes-between-versions) for getting the changes between versions of an Entity.
86
+
* New endpoint [GET /projects/:id/datasets/:name/entities/:uuid/audits](/central-api-entity-management/#entity-audit-log) for getting the server audit logs about a specific Entity.
87
+
* New endpoint [POST /projects/:id/datasets/:name/entities](/central-api-entity-management/#creating-an-entity) for creating an Entity from JSON.
88
+
* New endpoint [PATCH /projects/:id/datasets/:name/entities/:uuid](/central-api-entity-management/#updating-an-entity) for updating the data or label of an Entity.
89
+
* New endpoint [DELETE /projects/:id/datasets/:name/entities/:uuid](/central-api-entity-management/#deleting-an-entity) for soft-deleting an Entity.
78
90
79
91
**Changed**:
80
92
@@ -9853,6 +9865,8 @@ paths:
9853
9865
9854
9866
The CSV format closely matches the [OData Dataset Service](/central-api-odata-endpoints/#odata-dataset-service) format, with columns for system properties such as `__id` (the Entity UUID), `__createdAt`, `__creatorName`, etc., the Entity Label `label`, and the Dataset/Entity Properties themselves. If any Property for an given Entity is blank (e.g. it was not captured by that Form or was left blank), that field of the CSV is blank.
9855
9867
9868
+
The `$filter` querystring parameter can be used to filter on system-level properties, similar to how filtering in the [OData Dataset Service](/central-api-odata-endpoints/#odata-dataset-service) works.
9869
+
9856
9870
This endpoint supports `ETag` header, which can be used to avoid downloading the same content more than once. When an API consumer calls this endpoint, the endpoint returns a value in the ETag header. If you pass that value in the If-None-Match header of a subsequent request, then if the Dataset has not been changed since the previous request, you will receive `304 Not Modified` response; otherwise you'll get the new data.
9857
9871
operationId: Download Dataset
9858
9872
parameters:
@@ -9870,6 +9884,12 @@ paths:
9870
9884
schema:
9871
9885
type: string
9872
9886
example: people
9887
+
- name: $filter
9888
+
in: query
9889
+
description: If provided, will filter responses to those matching the query. Only system-level Entity fields are available to reference. The operators `lt`, `le`, `eq`, `neq`, `ge`, `gt`, `not`, `and`, and `or` are supported, and the built-in functions `now`, `year`, `month`, `day`, `hour`, `minute`, `second`.
9890
+
schema:
9891
+
type: string
9892
+
example: __system/conflict eq \'hard\'
9873
9893
responses:
9874
9894
200:
9875
9895
description: OK
@@ -10015,7 +10035,7 @@ paths:
10015
10035
10016
10036
Value type of all properties is `string`.
10017
10037
10018
-
You can provide header `X-Action-Notes` to store the metadata about the request. The metadata can retrieved using [Entity Audit Log](/central-api-entities/#entity-audit-log)
10038
+
You can provide header `X-Action-Notes` to store the metadata about the request. The metadata can retrieved using [Entity Audit Log](/central-api-entity-management/#entity-audit-log)
10019
10039
operationId: Creating an Entity
10020
10040
parameters:
10021
10041
- name: projectId
@@ -10093,7 +10113,21 @@ paths:
10093
10113
tags:
10094
10114
- Entity Management
10095
10115
summary: Getting Entity Details
10096
-
description: This returns the metadata and current data of an Entity
10116
+
description: |-
10117
+
This returns the metadata and current data of an Entity.
10118
+
10119
+
The data and label of an Entity are found in the `currentVersion` object under `data` and `label` respectively. The `currentVersion` object also contains version-specific metadata fields such as `version`, `baseVersion`, details about conflicts that version introduced, etc. See the [versions](/central-api-entity-management/#listing-versions) endpoint for more details.
10120
+
10121
+
The Entity also contains top-level system metadata such as `uuid`, `createdAt` and `updatedAt` timestamps, and `creatorId` (or full `creator` if extended metadata is requested).
10122
+
10123
+
**Conflicts**
10124
+
10125
+
An Entity's metadata also has a `conflict` field, which indicates the current conflict status of the Entity. The value of a conflict can either be:
10126
+
* `null`. The Entity does not have conflicting versions.
10127
+
* `soft`. The Entity has a version that was based on a version other than the version immediately prior to it. (The specified `baseVerson` was not the latest version on the server.)
10128
+
* `hard`. The Entity has a version that was based on a version other than the version immediately prior to it. Further, that version updated the same property as another update.
10129
+
10130
+
If an Entity has a conflict, it can be marked as resolved. After that, the conflict field will be null until a new conflicting version is received.
10097
10131
operationId: Getting Entity Details
10098
10132
parameters:
10099
10133
- name: projectId
@@ -10224,7 +10258,7 @@ paths:
10224
10258
summary: Deleting an Entity
10225
10259
description: Use this API to delete an Entity. With this API, Entity is soft-deleted,
10226
10260
which means it is still in the database and you can retreive it by passing
10227
-
`?deleted=true` to [GET /projects/:id/datasets/:name/entities](/central-api-entities/#entities-metadata).
10261
+
`?deleted=true` to [GET /projects/:id/datasets/:name/entities](/central-api-entity-management/#entities-metadata).
10228
10262
In the future, we will provide a way to restore deleted entities and purge
10229
10263
deleted entities.
10230
10264
operationId: Deleting an Entity
@@ -10279,13 +10313,15 @@ paths:
10279
10313
- Entity Management
10280
10314
summary: Updating an Entity
10281
10315
description: |-
10282
-
Use this API to update one or all properties of an Entity. It will throw `400 - Bad Request` if any of the updating properties doesn't exist in the dataset.
10316
+
This endpoint is used to update the label or the properties (passed as JSON in the request body) of an Entity. You only need to include the properties you wish to update. To unset the value of any property, you can set it to empty string (""). The label must be a non-empty string. Setting a property to `null` will throw an error. Attempting to update a property that doesn't exist in the Dataset will throw an error.
10283
10317
10284
-
To unset value of any property, you can set it to empty string (""). Setting it to `null` will throw an error.
10318
+
**Specifying a base version**
10285
10319
10286
-
**Resolve the conflict**
10320
+
You must either provide the query parameter `baseVersion` or use the `force=true` query paramater. You cannot cause a new Entity conflict via the API, which is why when specifying `baseVersion`, it must match the current version of the Entity on the server. This acts as a check to ensure you are not trying to update based on stale data. If you wish to update the Entity regardless of the current state, then you can use the `force` flag.
10287
10321
10288
-
You can also use this endpoint to resolve the conflict by passing `resolve=true` query parameter. If you set `resolve` parameter then providing data in the body is optional, in that case only `conflict` status from the Entity will be cleared.
10322
+
**Resolving a conflict**
10323
+
10324
+
You can also use this endpoint to resolve an Entity conflict by passing the `resolve=true` query parameter, in which case providing data in the request body is optional. When not providing new data, only the `conflict` status from the Entity will be cleared and no new version will be created. When providing data, the `conflict` will be cleared and an updated version of the Entity will be added.
10289
10325
operationId: Updating an Entity
10290
10326
parameters:
10291
10327
- name: projectId
@@ -10309,6 +10345,13 @@ paths:
10309
10345
schema:
10310
10346
type: string
10311
10347
example: 54a405a0-53ce-4748-9788-d23a30cc3afa
10348
+
- name: baseVersion
10349
+
in: query
10350
+
description: The base version of the Entity you are applying the update to (must match the latest version on the server)
10351
+
required: false
10352
+
schema:
10353
+
type: integer
10354
+
example: 2
10312
10355
- name: force
10313
10356
in: query
10314
10357
description: Flag to forcefully update the Entity
@@ -10406,6 +10449,8 @@ paths:
10406
10449
This returns the Entity metadata and data for every version of this Entity, in ascending creation order.
10407
10450
10408
10451
This endpoint supports retrieving extended metadata; provide a header `X-Extended-Metadata: true` to return a `creator` data object alongside the `creatorId` Actor ID reference.
10452
+
10453
+
There is an optional query flag `relevantToConflict` that returns the subset of past versions of an Entity that are relevant to the Entity's current conflict. This includes the latest version, the base version, the previous server version, and any other versions since the last time the Entity was in a conflict-free state. If the Entity is not in conflict, zero versions are returned.
10409
10454
operationId: Listing Entity Versions
10410
10455
parameters:
10411
10456
- name: projectId
@@ -10429,6 +10474,12 @@ paths:
10429
10474
schema:
10430
10475
type: string
10431
10476
example: 54a405a0-53ce-4748-9788-d23a30cc3afa
10477
+
- name: relevantToConflict
10478
+
in: query
10479
+
description: Flag to return only the versions of the entity that are relevant to the current conflict.
The `$top` and `$skip` querystring parameters, specified by OData, apply `limit` and `offset` operations to the data, respectively. The `$count` parameter, also an OData standard, will annotate the response data with the total row count, regardless of the scoping requested by `$top` and `$skip`. If `$top` parameter is provided in the request then the response will include `@odata.nextLink` that you can use as is to fetch the next set of data.
11985
12038
11986
-
The [`$filter` querystring parameter](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#_Toc31358948)can be used to filter by any data field in the system-level schema, but not the Dataset properties. The operators `lt`, `le`, `eq`, `ne`, `ge`, `gt`, `not`, `and`, and `or` are supported. The built-in functions `now`, `year`, `month`, `day`, `hour`, `minute`, `second` are supported.
12039
+
The [`$filter` querystring parameter](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#_Toc31358948)can be used to filter by any data field in the system-level schema, but not the Dataset properties. The operators `lt`, `le`, `eq`, `ne`, `ge`, `gt`, `not`, `and`, and `or` are supported. The built-in functions `now`, `year`, `month`, `day`, `hour`, `minute`, `second` are supported.
0 commit comments