Skip to content

Latest commit

 

History

History
225 lines (161 loc) · 8.61 KB

File metadata and controls

225 lines (161 loc) · 8.61 KB

AttributesApi

All URIs are relative to http://orion.lab.fiware.org

Method HTTP request Description
getAttributeData GET /v2/entities/{entityId}/attrs/{attrName} Get attribute data
removeASingleAttribute DELETE /v2/entities/{entityId}/attrs/{attrName} Remove a Single Attribute
updateAttributeData PUT /v2/entities/{entityId}/attrs/{attrName} Update Attribute Data

getAttributeData

GetAttributeDataResponse getAttributeData(entityId, attrName, type, metadata)

Get attribute data

Returns a JSON object with the attribute data of the attribute. The object follows the JSON representation for attributes (described in "JSON Attribute Representation" section). Response: * Successful operation uses 200 OK. * Errors use a non-2xx and (optionally) an error payload. See subsection on "Error Responses" for more details.

Example

// 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.AttributesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://orion.lab.fiware.org");

        AttributesApi apiInstance = new AttributesApi(defaultClient);
        String entityId = "entityId_example"; // String | Id of the entity
        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.
        String metadata = "metadata_example"; // String | A list of metadata names to include in the response. See \"Filtering out attributes and metadata\" section for more detail.
        try {
            GetAttributeDataResponse result = apiInstance.getAttributeData(entityId, attrName, type, metadata);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling AttributesApi#getAttributeData");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
entityId String Id of the entity
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]
metadata String A list of metadata names to include in the response. See "Filtering out attributes and metadata" section for more detail. [optional]

Return type

GetAttributeDataResponse

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 -

removeASingleAttribute

removeASingleAttribute(entityId, attrName, type)

Remove a Single Attribute

Removes an entity attribute. 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.

Example

// 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.AttributesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://orion.lab.fiware.org");

        AttributesApi apiInstance = new AttributesApi(defaultClient);
        String entityId = "entityId_example"; // String | Id of the entity.
        String attrName = "attrName_example"; // String | Attribute name.
        String type = "type_example"; // String | Entity type, to avoid ambiguity in case there are several entities with the same entity id.
        try {
            apiInstance.removeASingleAttribute(entityId, attrName, type);
        } catch (ApiException e) {
            System.err.println("Exception when calling AttributesApi#removeASingleAttribute");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
entityId String Id of the entity.
attrName String Attribute name.
type String Entity type, to avoid ambiguity in case there are several entities with the same entity id. [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status code Description Response headers
204 -

updateAttributeData

updateAttributeData(entityId, attrName, contentType, body, type)

Update Attribute Data

The request payload is an object representing the new attribute data. Previous attribute data is replaced by the one in the request. The object follows the JSON representation for attributes (described in "JSON Attribute Representation" section). 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.

Example

// 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.AttributesApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://orion.lab.fiware.org");

        AttributesApi apiInstance = new AttributesApi(defaultClient);
        String entityId = "entityId_example"; // String | Id of the entity to update
        String attrName = "attrName_example"; // String | Attribute name
        String contentType = "contentType_example"; // String | 
        UpdateAttributeDataRequest body = new UpdateAttributeDataRequest(); // UpdateAttributeDataRequest | 
        String type = "type_example"; // String | Entity type, to avoid ambiguity in case there are several entities with the same entity id.
        try {
            apiInstance.updateAttributeData(entityId, attrName, contentType, body, type);
        } catch (ApiException e) {
            System.err.println("Exception when calling AttributesApi#updateAttributeData");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Parameters

Name Type Description Notes
entityId String Id of the entity to update
attrName String Attribute name
contentType String
body UpdateAttributeDataRequest
type String Entity type, to avoid ambiguity in case there are several entities with the same entity id. [optional]

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: Not defined

HTTP response details

Status code Description Response headers
200 -