Update the Value of Specific Attributes
put
/iot/api/v2/apps/{app-id}/devices/{device-id}/deviceModels/{devicemodel-id}/attributes/{attribute-name}
Does the specified attribute update by the specified value. New values for the attribute are specified in the requst body JSON document. Incoming JSON document format is {"value":<value>}
Request
Path Parameters
-
app-id: string
Unique identifier of the application
-
attribute-name: string
Attribute name
-
device-id: string
Unique identifier of the device
-
devicemodel-id: string
URN of the device model
Response
Supported Media Types
- application/json
- application/vnd.oracle.resource+json;type=singular
200 Response
Successfully processed.
Root Schema : ResourceRequestStatusImpl_receive
Type:
Show Source
object
-
complete:
boolean
Property description was not set
-
endpointId:
string
Property description was not set
-
requestId:
string
Property description was not set
-
requestMethod:
string
Property description was not set
-
requestReceivedTime:
string
Property description was not set
-
requestUrl:
string
Property description was not set
-
responseEventTime:
integer
Property description was not set
-
responseJson:
string
Property description was not set
-
responseReceivedTime:
string
Property description was not set
-
responseStatusCode:
string
One of [HTTP 200: OK, HTTP 201: Created, HTTP 202: Accepted, HTTP 203: Non Authoritative Information, HTTP 204: No Content, HTTP 400: Bad Request, HTTP 401: Unauthorized, HTTP 402: Payment Required, HTTP 403: Forbidden, HTTP 404: Not Found, HTTP 405: Method Not Allowed, HTTP 406: Not Acceptable, HTTP 408: Request Timeout, HTTP 409: Conflict, HTTP 500: Internal Server Error, HTTP 502: Bad Gateway, HTTP 503: Service Unavailable].
-
status:
string
One of [RECEIVED, DISPATCHED, COMPLETED, EXPIRED, FAILED, UNKNOWN].
400 Response
Bad Request. The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications.
401 Response
Unauthorized. The request requires user authentication.
403 Response
Forbidden. The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated.
404 Response
Not Found. The server has not found anything matching the Request-URI. No indication is given of whether the condition is temporary or permanent.
405 Response
Method Not Allowed. The method specified in the Request-Line is not allowed for the resource identified by the Request-URI.
406 Response
Request Not Acceptable. The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request.
415 Response
Unsupported Media Type. The request entity has a media type which the server or resource does not support.
Examples
curl -X PUT
-u <username>:<password>
http://iotserver/iot/api/v2/apps/{app-id}/devices/{device-id}/deviceModels/{devicemodel-id}/attributes/{attribute-name}
Example of Response Body
The following example shows the content of the response body in JSON format
{
"requestTime":"2016-07-22T10:44:57.746Z",
"responseEventTime":"2016-07-22T10:44:57.746Z",
"responseStatusCode":"HTTP 200: OK",
"method":"Request method",
"responseTime":"Time when the response is received by server",
"response":"Original response message payload JSON document",
"endpointId":"1a4078c65aeb-36f",
"links":[
{
"rel":"self",
"href":"http://iotserver/iot/api/version/resource/path"
},
{
"rel":"canonical",
"href":"http://iotserver/iot/api/version/resource/path"
}
],
"id":"556427295e26-6855",
"complete":false,
"url":"http://iotserver/iot/api/version/resource/path",
"status":"RECEIVED"
}
Complete cURL Example
The following example shows compete cURL comand that can be used to perform described operation
curl -X PUT
-u <username>:<password>
http://iotserver/iot/api/v2/apps/1bd010095943-5cae/devices/1bd010095943-5cae/deviceModels/1bd010095943-5cae/attributes/{attribute-name}
Note that in the request, http://iotserver will be replaced by the name and port of your assigned IoT Cloud Service instance. The format of the Cloud Service instance is https:// myinstance-myidentitydomain.iot.us.oraclecloud.com and the default port is 443.