-
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(asset): add upsert method (#323)
- Loading branch information
Showing
6 changed files
with
246 additions
and
1 deletion.
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,67 @@ | ||
--- | ||
code: true | ||
type: page | ||
title: upsert | ||
description: Update or Create an asset | ||
--- | ||
|
||
# upsert | ||
|
||
Update or Create an asset. | ||
The Upsert operation allows you to create a new asset or update an existing one if it already exists. This operation is useful when you want to ensure that an asset is either created or updated in a single request. | ||
|
||
## Query Syntax | ||
|
||
### HTTP | ||
|
||
```http | ||
URL: http://kuzzle:7512/_/device-manager/:engineId/assets/:_id | ||
Method: POST | ||
``` | ||
|
||
## Other protocols | ||
|
||
```js | ||
{ | ||
"controller": "device-manager/assets", | ||
"action": "upsert", | ||
"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 | ||
{ | ||
"status": 200, | ||
"error": null, | ||
"controller": "device-manager/assets", | ||
"action": "update", | ||
"requestId": "<unique request identifier>", | ||
"result": { | ||
"_id": "<assetId>", | ||
"_source": { | ||
// Asset content | ||
}, | ||
} | ||
} | ||
``` |
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
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