-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add device:mUnlink API action #60
Changes from 1 commit
0815a6e
b49599c
4842d41
7177f17
4072f92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ The device document will be duplicated inside the tenant "devices" collection. | |
### HTTP | ||
|
||
``` http | ||
URL: http://kuzzle:7512/_/device-manager/devices/_mAttach | ||
URL: http://kuzzle:7512/_/device-manager/devices/_mAttach[?refresh=wait_for][&strict=true|false] | ||
Method: PUT | ||
Body: | ||
``` | ||
|
@@ -31,7 +31,7 @@ Body: | |
"deviceId": "test-id" | ||
}], | ||
// Using CSV syntax | ||
"csv": "tenant,id\ntenant-kuzzle,test-id" | ||
"csv": "tenantId,deviceId\ntenant-kuzzle,test-id" | ||
} | ||
``` | ||
|
||
|
@@ -61,13 +61,13 @@ Body properties, must contain at least one of | |
|
||
- `records`: an array of object containing `tenantId` and `deviceId` | ||
- `csv`: a csv syntax compatible containing at least this two headers `tenantId,deviceId` with their corresponding values | ||
- `strict`: a boolean value that indicate if the process should fail at first error | ||
|
||
--- | ||
|
||
### Optional: | ||
|
||
* `refresh`: if set to `wait_for`, Kuzzle will not respond until the documents are indexed | ||
* `strict`: (boolean) if set, makes the process fail preemptively if at least one link cannot be applied (e.g. devices that aren't attached to a tenant, or because of non-existing assets) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should not be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO it's better not because some of the device can still be attached and you can correct the errors and then reimport the same document |
||
|
||
--- | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
--- | ||
code: true | ||
type: page | ||
title: mLink | ||
description: Link multiple devices to multiple assets | ||
--- | ||
|
||
# mLink | ||
|
||
Link multiple devices to multiple assets | ||
|
||
--- | ||
|
||
## Query Syntax | ||
|
||
### HTTP | ||
|
||
``` http | ||
URL: http://kuzzle:7512/_/device-manager/devices/_mLink[?refresh=wait_for][&strict] | ||
Method: PUT | ||
Body: | ||
``` | ||
|
||
``` js | ||
{ | ||
// Using JSON | ||
"records" [{ | ||
"assetId": "myAssetId", | ||
"deviceId": "test-id" | ||
}], | ||
// Using CSV syntax | ||
"csv": "assetId, deviceId\nmyAssetId,test-id" | ||
} | ||
``` | ||
|
||
### Other protocols | ||
|
||
``` js | ||
{ | ||
"controller": "device-manager/device", | ||
"action": "mLink", | ||
"body": { | ||
// Using JSON | ||
"records" [{ | ||
"assetId": "myAssetId", | ||
"deviceId": "test-id" | ||
}], | ||
// Using CSV syntax | ||
"csv": "assetId,deviceId\nmyAssetId,test-id", | ||
} | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## Body properties | ||
|
||
Body properties, must contain at least one of the following: | ||
|
||
- `records`: an array of objects, each containing an `assetId` and a `deviceId` properties | ||
- `csv`: a csv syntax compatible containing at least this two headers `assetId,deviceId` with their corresponding values | ||
|
||
--- | ||
|
||
### Optional: | ||
|
||
* `refresh`: if set to `wait_for`, Kuzzle will not respond until the documents are indexed | ||
* `strict`: (boolean) if set, makes the process fail preemptively if at least one link cannot be applied (e.g. devices that aren't attached to a tenant, or because of non-existing assets) | ||
|
||
--- | ||
|
||
## Response | ||
|
||
``` js | ||
{ | ||
"status": 200, | ||
"error": null, | ||
"controller": "device-manager/device", | ||
"action": "mLink", | ||
"requestId": "<unique request identifier>", | ||
"result": { | ||
"errors": [], | ||
"successes": [] | ||
} | ||
} | ||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
code: true | ||
type: page | ||
title: mUnlink | ||
description: Unlink multiple devices from multiple assets | ||
--- | ||
|
||
# mUnlink | ||
|
||
Unlink multiple devices from multiple assets | ||
|
||
--- | ||
|
||
## Query Syntax | ||
|
||
### HTTP | ||
|
||
``` http | ||
URL: http://kuzzle:7512/_/device-manager/devices/_mUnlink[?refresh=wait_for][&strict] | ||
Method: PUT | ||
Body: | ||
``` | ||
|
||
``` js | ||
{ | ||
// Using JSON | ||
"records" [{ | ||
"deviceId": "test-id" | ||
}], | ||
// Using CSV syntax | ||
"csv": " deviceId\ntest-id" | ||
} | ||
``` | ||
|
||
### Other protocols | ||
|
||
``` js | ||
{ | ||
"controller": "device-manager/device", | ||
"action": "mUnlink", | ||
"body": { | ||
// Using JSON | ||
"records" [{ | ||
"deviceId": "test-id" | ||
}], | ||
// Using CSV syntax | ||
"csv": "deviceId\ntest-id", | ||
} | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## Body properties | ||
|
||
Body properties, must contain at least one of the following: | ||
|
||
- `records`: an array of objects, each containing a `deviceId` properties | ||
- `csv`: a csv syntax compatible containing at least this header `deviceId` with his corresponding values | ||
|
||
--- | ||
|
||
### Optional: | ||
|
||
* `refresh`: if set to `wait_for`, Kuzzle will not respond until the documents are indexed | ||
* `strict`: (boolean) if set, makes the process fail preemptively if at least one Unlink cannot be applied (e.g. devices that aren't attached to a tenant, or because of non-existing assets) | ||
|
||
--- | ||
|
||
## Response | ||
|
||
``` js | ||
{ | ||
"status": 200, | ||
"error": null, | ||
"controller": "device-manager/device", | ||
"action": "mUnlink", | ||
"requestId": "<unique request identifier>", | ||
"result": { | ||
"errors": [], | ||
"successes": [] | ||
} | ||
} | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Boolean flag are true if set and false if not set, they can't have explicit value