-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(metadata): improve asset metadata (#346)
* feat: add optional property 'strategy' in MetadataProperty * feat: add optional property 'format' in MetadataProperty * feat: implement replace metadata * renaming: change asset metadata replace naming * style: fix to pass linter * documentation: definition of replaceMetadata in the asset controller * feat: change put to patch for the http verb to be more meaningful * documentation: update http method * Update doc/2/controllers/assets/replace-metadata/index.md Co-authored-by: Alexandre Bouthinon <[email protected]> KZLPRD-323 --------- Co-authored-by: Eric <[email protected]> Co-authored-by: Alexandre Bouthinon <[email protected]>
- Loading branch information
Showing
5 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
code: true | ||
type: page | ||
title: replaceMetadata | ||
description: Replace asset metadata | ||
--- | ||
|
||
# replaceMetadata | ||
|
||
Replace `metadata` of an asset. It will replace only the fields specified in the request body. | ||
|
||
## Query Syntax | ||
|
||
### HTTP | ||
|
||
```http | ||
URL: http://kuzzle:7512/_/device-manager/:engineId/assets/:_id/metadata | ||
Method: PATCH | ||
``` | ||
|
||
### Other protocols | ||
|
||
```js | ||
{ | ||
"controller": "device-manager/assets", | ||
"action": "replaceMetadata", | ||
"engineId": "<engineId>", | ||
"_id": "<assetId>", | ||
"body": { | ||
"metadata": { | ||
"<metadata name>": "<metadata value>" | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Arguments | ||
|
||
- `engineId`: Engine ID | ||
- `_id`: Asset ID | ||
|
||
## Body properties | ||
|
||
- `metadata`: Object containing metadata | ||
|
||
## Response | ||
|
||
```js | ||
{ | ||
"action": "replaceMetadata", | ||
"collection": "assets", | ||
"controller": "device-manager/assets", | ||
"error": null, | ||
"headers": {}, | ||
"index": /** index */, | ||
"node": /** node */, | ||
"requestId": /** request id */, | ||
"result": { | ||
"_id": /** asset id */, | ||
"_source": { | ||
"groups": [], | ||
"lastMeasuredAt": null, | ||
"linkedDevices": [], | ||
"measures": { | ||
/** mesures */ | ||
}, | ||
"metadata": { | ||
/** REPLACED METADATA */ | ||
}, | ||
"model": /** asset model */, | ||
"reference": /** asset reference */, | ||
"_kuzzle_info": { | ||
/** data management info */ | ||
} | ||
} | ||
}, | ||
"status": 200, | ||
"volatile": null | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters