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

feat(api-v2): Return value UUID on value creation and update #1602

Merged
merged 8 commits into from Feb 27, 2020
25 changes: 23 additions & 2 deletions docs/src/paradox/03-apis/api-v2/editing-values.md
Expand Up @@ -94,8 +94,12 @@ If permissions are not given, configurable default permissions are used

To create a value, the user must have **modify permission** on the containing resource.

The response is a JSON-LD document containing only `@id` and `@type`, returning the IRI
and type of the value that was created.
The response is a JSON-LD document containing:

- `@id`: the IRI of the value that was created.
- `@type`: the value's type.
- `knora-api:valueHasUUID`, the value's UUID, which remains stable across value versions
(except for link values, as explained below).

### Creating a Link Between Resources

Expand Down Expand Up @@ -127,6 +131,15 @@ we can create a link like this:

As with ordinary values, permissions on links can be specified by adding `knora-api:hasPermissions`.

The response is a JSON-LD document containing:

- `@id`: the IRI of the value that was created.
- `@type`: the value's type.
- `knora-api:valueHasUUID`, the value's UUID, which remains stable across value versions,
unless the link is changed to point to a different resource, in which case it is
considered a new link and gets a new UUID. Changing a link's metadata, without
changing its target, creates a new version of the link value with the same UUID.

### Creating a Text Value Without Standoff Markup

Use the predicate `knora-api:valueAsString` of `knora-api:TextValue`:
Expand Down Expand Up @@ -357,6 +370,14 @@ and type of the new value version.
If you submit an outdated value ID in a request to update a value, the response will be
an HTTP 404 (Not Found) error.

The response to a value update request contains:

- `@id`: the IRI of the value that was created.
- `@type`: the value's type.
- `knora-api:valueHasUUID`, the value's UUID, which remains stable across value versions,
unless the value is a link value and is changed to point to a different resource, in which
case it is considered a new link and gets a new UUID.

## Deleting a Value

Knora does not normally delete values; instead, it marks them as deleted, which means
Expand Down
2 changes: 1 addition & 1 deletion docs/src/paradox/03-apis/api-v2/query-language.md
Expand Up @@ -120,7 +120,7 @@ the query refers to, e.g.:

```
PREFIX knora-api: <http://api.knora.org/ontology/knora-api/v2#>
PREFIX incunabula: <http://0.0.0.0:3333/ontology/0803/simple/v2#>
PREFIX incunabula: <http://0.0.0.0:3333/ontology/0803/v2#>
```

In the complex schema, Knora values are represented as objects belonging
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.