Skip to content

Latest commit

 

History

History
555 lines (452 loc) · 26.7 KB

OperationsApi.md

File metadata and controls

555 lines (452 loc) · 26.7 KB

kern.services.CumulocityClient.Api.OperationsApi

All URIs are relative to https://<TENANT_DOMAIN>

Method HTTP request Description
DeleteOperationCollectionResource DELETE /devicecontrol/operations Delete a list of operations
GetOperationCollectionResource GET /devicecontrol/operations Retrieve a list of operations
GetOperationResource GET /devicecontrol/operations/{id} Retrieve a specific operation
PostOperationCollectionResource POST /devicecontrol/operations Create an operation
PutOperationResource PUT /devicecontrol/operations/{id} Update a specific operation status

DeleteOperationCollectionResource

void DeleteOperationCollectionResource (string? xCumulocityProcessingMode = null, string? agentId = null, DateTime? dateFrom = null, DateTime? dateTo = null, string? deviceId = null, string? status = null)

Delete a list of operations

Delete a list of operations. The DELETE method allows for deletion of operation collections.

Required roles
ROLE_DEVICE_CONTROL_ADMIN

Example

using System.Collections.Generic;
using System.Diagnostics;
using kern.services.CumulocityClient.Api;
using kern.services.CumulocityClient.Client;
using kern.services.CumulocityClient.Model;

namespace Example
{
    public class DeleteOperationCollectionResourceExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://<TENANT_DOMAIN>";
            // Configure HTTP basic authorization: Basic
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";
            // Configure Bearer token for authorization: OAI-Secure
            config.AccessToken = "YOUR_BEARER_TOKEN";
            // Configure OAuth2 access token for authorization: SSO
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new OperationsApi(config);
            var xCumulocityProcessingMode = PERSISTENT;  // string? | Used to explicitly control the processing mode of the request. See [Processing mode](#processing-mode) for more details. (optional)  (default to PERSISTENT)
            var agentId = simulator_145074_1;  // string? | An agent ID that may be part of the operation. (optional) 
            var dateFrom = DateTime.Parse("2013-10-20T19:20:30+01:00");  // DateTime? | Start date or date and time of the operation. (optional) 
            var dateTo = DateTime.Parse("2013-10-20T19:20:30+01:00");  // DateTime? | End date or date and time of the operation. (optional) 
            var deviceId = 1234;  // string? | The ID of the device the operation is performed for. (optional) 
            var status = FAILED;  // string? | Status of the operation. (optional) 

            try
            {
                // Delete a list of operations
                apiInstance.DeleteOperationCollectionResource(xCumulocityProcessingMode, agentId, dateFrom, dateTo, deviceId, status);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling OperationsApi.DeleteOperationCollectionResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DeleteOperationCollectionResourceWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Delete a list of operations
    apiInstance.DeleteOperationCollectionResourceWithHttpInfo(xCumulocityProcessingMode, agentId, dateFrom, dateTo, deviceId, status);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling OperationsApi.DeleteOperationCollectionResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
xCumulocityProcessingMode string? Used to explicitly control the processing mode of the request. See Processing mode for more details. [optional] [default to PERSISTENT]
agentId string? An agent ID that may be part of the operation. [optional]
dateFrom DateTime? Start date or date and time of the operation. [optional]
dateTo DateTime? End date or date and time of the operation. [optional]
deviceId string? The ID of the device the operation is performed for. [optional]
status string? Status of the operation. [optional]

Return type

void (empty response body)

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.com.nsn.cumulocity.error+json

HTTP response details

Status code Description Response headers
204 A list of operations was removed. -
401 Authentication information is missing or invalid. -
403 Not authorized to perform this operation. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetOperationCollectionResource

OperationCollection GetOperationCollectionResource (string? agentId = null, string? bulkOperationId = null, int? currentPage = null, DateTime? dateFrom = null, DateTime? dateTo = null, string? deviceId = null, string? fragmentType = null, int? pageSize = null, bool? revert = null, string? status = null, bool? withTotalElements = null, bool? withTotalPages = null)

Retrieve a list of operations

Retrieve a list of operations. Notes about operation collections: * The embedded operation object contains deviceExternalIDs only when queried with an agentId parameter. * The embedded operation object is filled with deviceName, but only when requesting resource: Get a collection of operations. * Operations are returned in the order of their ascending IDs.

Required roles
ROLE_DEVICE_CONTROL_READ

Example

using System.Collections.Generic;
using System.Diagnostics;
using kern.services.CumulocityClient.Api;
using kern.services.CumulocityClient.Client;
using kern.services.CumulocityClient.Model;

namespace Example
{
    public class GetOperationCollectionResourceExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://<TENANT_DOMAIN>";
            // Configure HTTP basic authorization: Basic
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";
            // Configure Bearer token for authorization: OAI-Secure
            config.AccessToken = "YOUR_BEARER_TOKEN";
            // Configure OAuth2 access token for authorization: SSO
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new OperationsApi(config);
            var agentId = simulator_145074_1;  // string? | An agent ID that may be part of the operation. If this parameter is set, the operation response objects contain the `deviceExternalIDs` object. (optional) 
            var bulkOperationId = 1237;  // string? | The bulk operation ID that this operation belongs to. (optional) 
            var currentPage = 3;  // int? | The current page of the paginated results. (optional)  (default to 1)
            var dateFrom = DateTime.Parse("2013-10-20T19:20:30+01:00");  // DateTime? | Start date or date and time of the operation. (optional) 
            var dateTo = DateTime.Parse("2013-10-20T19:20:30+01:00");  // DateTime? | End date or date and time of the operation. (optional) 
            var deviceId = 1234;  // string? | The ID of the device the operation is performed for. (optional) 
            var fragmentType = com_cumulocity_model_WebCamDevice;  // string? | The type of fragment that must be part of the operation. (optional) 
            var pageSize = 10;  // int? | Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects. (optional)  (default to 5)
            var revert = true;  // bool? | If you are using a range query (that is, at least one of the `dateFrom` or `dateTo` parameters is included in the request), then setting `revert=true` will sort the results by the newest operations first. By default, the results are sorted by the oldest operations first.  (optional)  (default to false)
            var status = FAILED;  // string? | Status of the operation. (optional) 
            var withTotalElements = true;  // bool? | When set to `true`, the returned result will contain in the statistics object the total number of elements. Only applicable on [range queries](https://en.wikipedia.org/wiki/Range_query_(database)). (optional)  (default to false)
            var withTotalPages = true;  // bool? | When set to `true`, the returned result will contain in the statistics object the total number of pages. Only applicable on [range queries](https://en.wikipedia.org/wiki/Range_query_(database)). (optional)  (default to false)

            try
            {
                // Retrieve a list of operations
                OperationCollection result = apiInstance.GetOperationCollectionResource(agentId, bulkOperationId, currentPage, dateFrom, dateTo, deviceId, fragmentType, pageSize, revert, status, withTotalElements, withTotalPages);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling OperationsApi.GetOperationCollectionResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetOperationCollectionResourceWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Retrieve a list of operations
    ApiResponse<OperationCollection> response = apiInstance.GetOperationCollectionResourceWithHttpInfo(agentId, bulkOperationId, currentPage, dateFrom, dateTo, deviceId, fragmentType, pageSize, revert, status, withTotalElements, withTotalPages);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling OperationsApi.GetOperationCollectionResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
agentId string? An agent ID that may be part of the operation. If this parameter is set, the operation response objects contain the `deviceExternalIDs` object. [optional]
bulkOperationId string? The bulk operation ID that this operation belongs to. [optional]
currentPage int? The current page of the paginated results. [optional] [default to 1]
dateFrom DateTime? Start date or date and time of the operation. [optional]
dateTo DateTime? End date or date and time of the operation. [optional]
deviceId string? The ID of the device the operation is performed for. [optional]
fragmentType string? The type of fragment that must be part of the operation. [optional]
pageSize int? Indicates how many entries of the collection shall be returned. The upper limit for one page is 2,000 objects. [optional] [default to 5]
revert bool? If you are using a range query (that is, at least one of the `dateFrom` or `dateTo` parameters is included in the request), then setting `revert=true` will sort the results by the newest operations first. By default, the results are sorted by the oldest operations first. [optional] [default to false]
status string? Status of the operation. [optional]
withTotalElements bool? When set to `true`, the returned result will contain in the statistics object the total number of elements. Only applicable on range queries. [optional] [default to false]
withTotalPages bool? When set to `true`, the returned result will contain in the statistics object the total number of pages. Only applicable on range queries. [optional] [default to false]

Return type

OperationCollection

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.com.nsn.cumulocity.operationcollection+json, application/vnd.com.nsn.cumulocity.error+json

HTTP response details

Status code Description Response headers
200 The request has succeeded and the list of operations is sent in the response. -
401 Authentication information is missing or invalid. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetOperationResource

Operation GetOperationResource (string id)

Retrieve a specific operation

Retrieve a specific operation (by a given ID).

Required roles
ROLE_DEVICE_CONTROL_READ OR owner of the resource OR ADMIN permission on the device

Example

using System.Collections.Generic;
using System.Diagnostics;
using kern.services.CumulocityClient.Api;
using kern.services.CumulocityClient.Client;
using kern.services.CumulocityClient.Model;

namespace Example
{
    public class GetOperationResourceExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://<TENANT_DOMAIN>";
            // Configure HTTP basic authorization: Basic
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";
            // Configure Bearer token for authorization: OAI-Secure
            config.AccessToken = "YOUR_BEARER_TOKEN";
            // Configure OAuth2 access token for authorization: SSO
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new OperationsApi(config);
            var id = 123;  // string | Unique identifier of the operation.

            try
            {
                // Retrieve a specific operation
                Operation result = apiInstance.GetOperationResource(id);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling OperationsApi.GetOperationResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetOperationResourceWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Retrieve a specific operation
    ApiResponse<Operation> response = apiInstance.GetOperationResourceWithHttpInfo(id);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling OperationsApi.GetOperationResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string Unique identifier of the operation.

Return type

Operation

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.com.nsn.cumulocity.operation+json, application/vnd.com.nsn.cumulocity.error+json

HTTP response details

Status code Description Response headers
200 The request has succeeded and the operation is sent in the response. -
401 Authentication information is missing or invalid. -
404 Operation not found. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PostOperationCollectionResource

Operation PostOperationCollectionResource (PostOperationCollectionResourceRequest postOperationCollectionResourceRequest, string? accept = null, string? xCumulocityProcessingMode = null)

Create an operation

Create an operation. It is possible to add custom fragments to operations, for example com_cumulocity_model_WebCamDevice is a custom object of the webcam operation.

Required roles
ROLE_DEVICE_CONTROL_ADMIN OR owner of the device OR ADMIN permissions on the device

Example

using System.Collections.Generic;
using System.Diagnostics;
using kern.services.CumulocityClient.Api;
using kern.services.CumulocityClient.Client;
using kern.services.CumulocityClient.Model;

namespace Example
{
    public class PostOperationCollectionResourceExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://<TENANT_DOMAIN>";
            // Configure HTTP basic authorization: Basic
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";
            // Configure Bearer token for authorization: OAI-Secure
            config.AccessToken = "YOUR_BEARER_TOKEN";
            // Configure OAuth2 access token for authorization: SSO
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new OperationsApi(config);
            var postOperationCollectionResourceRequest = new PostOperationCollectionResourceRequest(); // PostOperationCollectionResourceRequest | 
            var accept = application/json;  // string? | Advertises which content types, expressed as MIME types, the client is able to understand. (optional) 
            var xCumulocityProcessingMode = PERSISTENT;  // string? | Used to explicitly control the processing mode of the request. See [Processing mode](#processing-mode) for more details. (optional)  (default to PERSISTENT)

            try
            {
                // Create an operation
                Operation result = apiInstance.PostOperationCollectionResource(postOperationCollectionResourceRequest, accept, xCumulocityProcessingMode);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling OperationsApi.PostOperationCollectionResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the PostOperationCollectionResourceWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Create an operation
    ApiResponse<Operation> response = apiInstance.PostOperationCollectionResourceWithHttpInfo(postOperationCollectionResourceRequest, accept, xCumulocityProcessingMode);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling OperationsApi.PostOperationCollectionResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
postOperationCollectionResourceRequest PostOperationCollectionResourceRequest
accept string? Advertises which content types, expressed as MIME types, the client is able to understand. [optional]
xCumulocityProcessingMode string? Used to explicitly control the processing mode of the request. See Processing mode for more details. [optional] [default to PERSISTENT]

Return type

Operation

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

  • Content-Type: application/vnd.com.nsn.cumulocity.operation+json
  • Accept: application/vnd.com.nsn.cumulocity.operation+json, application/vnd.com.nsn.cumulocity.error+json

HTTP response details

Status code Description Response headers
201 An operation was created. -
401 Authentication information is missing or invalid. -
422 Unprocessable Entity – invalid payload. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

PutOperationResource

Operation PutOperationResource (string id, PutOperationResourceRequest putOperationResourceRequest, string? accept = null, string? xCumulocityProcessingMode = null)

Update a specific operation status

Update a specific operation (by a given ID). You can only update its status.

Required roles
ROLE_DEVICE_CONTROL_ADMIN OR owner of the resource OR ADMIN permission on the device

Example

using System.Collections.Generic;
using System.Diagnostics;
using kern.services.CumulocityClient.Api;
using kern.services.CumulocityClient.Client;
using kern.services.CumulocityClient.Model;

namespace Example
{
    public class PutOperationResourceExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://<TENANT_DOMAIN>";
            // Configure HTTP basic authorization: Basic
            config.Username = "YOUR_USERNAME";
            config.Password = "YOUR_PASSWORD";
            // Configure Bearer token for authorization: OAI-Secure
            config.AccessToken = "YOUR_BEARER_TOKEN";
            // Configure OAuth2 access token for authorization: SSO
            config.AccessToken = "YOUR_ACCESS_TOKEN";

            var apiInstance = new OperationsApi(config);
            var id = 123;  // string | Unique identifier of the operation.
            var putOperationResourceRequest = new PutOperationResourceRequest(); // PutOperationResourceRequest | 
            var accept = application/json;  // string? | Advertises which content types, expressed as MIME types, the client is able to understand. (optional) 
            var xCumulocityProcessingMode = PERSISTENT;  // string? | Used to explicitly control the processing mode of the request. See [Processing mode](#processing-mode) for more details. (optional)  (default to PERSISTENT)

            try
            {
                // Update a specific operation status
                Operation result = apiInstance.PutOperationResource(id, putOperationResourceRequest, accept, xCumulocityProcessingMode);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling OperationsApi.PutOperationResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the PutOperationResourceWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Update a specific operation status
    ApiResponse<Operation> response = apiInstance.PutOperationResourceWithHttpInfo(id, putOperationResourceRequest, accept, xCumulocityProcessingMode);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling OperationsApi.PutOperationResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string Unique identifier of the operation.
putOperationResourceRequest PutOperationResourceRequest
accept string? Advertises which content types, expressed as MIME types, the client is able to understand. [optional]
xCumulocityProcessingMode string? Used to explicitly control the processing mode of the request. See Processing mode for more details. [optional] [default to PERSISTENT]

Return type

Operation

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

  • Content-Type: application/vnd.com.nsn.cumulocity.operation+json
  • Accept: application/vnd.com.nsn.cumulocity.operation+json, application/vnd.com.nsn.cumulocity.error+json

HTTP response details

Status code Description Response headers
200 An operation was updated. -
401 Authentication information is missing or invalid. -
404 Operation not found. -
422 Validation error. -

[Back to top] [Back to API list] [Back to Model list] [Back to README]