All URIs are relative to http://orion.lab.fiware.org
| Method | HTTP request | Description |
|---|---|---|
| getAttributeValue | GET /v2/entities/{entityId}/attrs/{attrName}/value | Get Attribute Value |
| updateAttributeValue | PUT /v2/entities/{entityId}/attrs/{attrName}/value | Update Attribute Value |
GetAttributeValueResponse getAttributeValue(entityId, attrName, type)
Get Attribute Value
This operation returns the `value` property with the value of the attribute. * If attribute value is JSON Array or Object: * If `Accept` header can be expanded to `application/json` or `text/plain` return the value as a JSON with a response type of application/json or text/plain (whichever is the first in `Accept` header or `application/json` in case of `Accept: /`). * Else return a HTTP error "406 Not Acceptable: accepted MIME types: application/json, text/plain" * If attribute value is a string, number, null or boolean: * If `Accept` header can be expanded to text/plain return the value as text. In case of a string, citation marks are used at the begining and end. * Else return a HTTP error "406 Not Acceptable: accepted MIME types: text/plain" Response: * Successful operation uses 200 OK. * Errors use a non-2xx and (optionally) an error payload. See subsection on "Error Responses" for more details.
// Import classes:
import city.makeour.ngsi.v2.invoker.ApiClient;
import city.makeour.ngsi.v2.invoker.ApiException;
import city.makeour.ngsi.v2.invoker.Configuration;
import city.makeour.ngsi.v2.invoker.models.*;
import city.makeour.ngsi.v2.api.AttributeValueApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://orion.lab.fiware.org");
AttributeValueApi apiInstance = new AttributeValueApi(defaultClient);
String entityId = "entityId_example"; // String | Id of the entity in question
String attrName = "attrName_example"; // String | Name of the attribute to be retrieved.
String type = "type_example"; // String | Entity type, to avoid ambiguity in case there are several entities with the same entity id.
try {
GetAttributeValueResponse result = apiInstance.getAttributeValue(entityId, attrName, type);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling AttributeValueApi#getAttributeValue");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| entityId | String | Id of the entity in question | |
| attrName | String | Name of the attribute to be retrieved. | |
| type | String | Entity type, to avoid ambiguity in case there are several entities with the same entity id. | [optional] |
No authorization required
- Content-Type: Not defined
- Accept: application/json
| Status code | Description | Response headers |
|---|---|---|
| 200 | - |
updateAttributeValue(entityId, attrName, contentType, body, type)
Update Attribute Value
The request payload is the new attribute value. * If the request payload MIME type is `application/json`, then the value of the attribute is set to the JSON object or array coded in the payload (if the payload is not a valid JSON document, then an error is returned). * If the request payload MIME type is `text/plain`, then the following algorithm is applied to the payload: * If the payload starts and ends with citation-marks (`"`), the value is taken as a string (the citation marks themselves are not considered part of the string) * If `true` or `false`, the value is taken as a boolean. * If `null`, the value is taken as null. * If these first three tests 'fail', the text is interpreted as a number. * If not a valid number, then an error is returned and the attribute's value is unchanged. The payload MIME type in the request is specified in the `Content-Type` HTTP header. Response: * Successful operation uses 204 No Content * Errors use a non-2xx and (optionally) an error payload. See subsection on "Error Responses" for more details.
// Import classes:
import city.makeour.ngsi.v2.invoker.ApiClient;
import city.makeour.ngsi.v2.invoker.ApiException;
import city.makeour.ngsi.v2.invoker.Configuration;
import city.makeour.ngsi.v2.invoker.models.*;
import city.makeour.ngsi.v2.api.AttributeValueApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setBasePath("http://orion.lab.fiware.org");
AttributeValueApi apiInstance = new AttributeValueApi(defaultClient);
String entityId = "entityId_example"; // String | Id of the entity to be updated.
String attrName = "attrName_example"; // String | Attribute name.
String contentType = "contentType_example"; // String |
UpdateAttributeValueRequest body = new UpdateAttributeValueRequest(); // UpdateAttributeValueRequest |
String type = "type_example"; // String | Entity type, to avoid ambiguity in case there are several entities with the same entity id.
try {
apiInstance.updateAttributeValue(entityId, attrName, contentType, body, type);
} catch (ApiException e) {
System.err.println("Exception when calling AttributeValueApi#updateAttributeValue");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}| Name | Type | Description | Notes |
|---|---|---|---|
| entityId | String | Id of the entity to be updated. | |
| attrName | String | Attribute name. | |
| contentType | String | ||
| body | UpdateAttributeValueRequest | ||
| type | String | Entity type, to avoid ambiguity in case there are several entities with the same entity id. | [optional] |
null (empty response body)
No authorization required
- Content-Type: application/json
- Accept: Not defined
| Status code | Description | Response headers |
|---|---|---|
| 200 | - |