Create or replace a Custom Device data source
PUT/api/v1/orgs/{orgId}/devices/{deviceId}/data-source
Create the device's data source if none exists yet, or fully replace it if one
does (upsert). Every field in the request overwrites the corresponding stored field, except connectorType (see below). Omitting description clears it. It is not preserved from the previous value.
Request Body
name(string, required): A descriptive name for the data source.description(string, optional): A detailed description of the data source.connectorType(string, optional): One ofMQTT(v3.1),WEDA Data-Stream,HTTP-Server. Immutable once set: while the data source's currentconnectorTypeis unset, this may set it; once it has a value, sending the same value again is accepted as a no-op, but sending a different value returns400. OmittingconnectorTypeor sendingnullkeeps the current value. It never clears it.
Parameters
orgId(string, required, path): Organization identifier.deviceId(UUID, required, path): Custom device identifier.
Responses
201 Created: No data source existed yet for this device. A new one was created.200 OK: A data source already existed. It was replaced.400 Bad Request:connectorTypewas already set to a different value and this request tries to change it.417 Expectation Failed: WEDA could not apply the change to the device, so the change was not saved. GET returns the previous settings, but the running device may already use part of the new settings. The error is temporary. Resend the same request after a short wait to bring both back in line. Resending is safe and gives the same result each time. If the request was creating the data source, use the ID returned by the successful retry.
Request
Responses
- 200
- 201
- 400
- 417
OK
Created
Bad Request - connectorType is already set and the request tries to change it to a different value.
Expectation Failed - the change could not be applied and was not saved. The running device may already use part of the new settings. Resend the same request.