Skip to content

Latest commit

 

History

History
530 lines (427 loc) · 21.1 KB

RetentionRulesApi.md

File metadata and controls

530 lines (427 loc) · 21.1 KB

kern.services.CumulocityClient.Api.RetentionRulesApi

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

Method HTTP request Description
DeleteRetentionRuleResource DELETE /retention/retentions/{id} Remove a retention rule
GetRetentionRuleCollectionResource GET /retention/retentions Retrieve all retention rules
GetRetentionRuleResource GET /retention/retentions/{id} Retrieve a retention rule
PostRetentionRuleCollectionResource POST /retention/retentions Create a retention rule
PutRetentionRuleResource PUT /retention/retentions/{id} Update a retention rule

DeleteRetentionRuleResource

void DeleteRetentionRuleResource (string id)

Remove a retention rule

Remove a specific retention rule by a given ID.

Required roles
ROLE_RETENTION_RULE_ADMIN AND the rule is editable

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 DeleteRetentionRuleResourceExample
    {
        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 RetentionRulesApi(config);
            var id = 1569;  // string | Unique identifier of the retention rule.

            try
            {
                // Remove a retention rule
                apiInstance.DeleteRetentionRuleResource(id);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RetentionRulesApi.DeleteRetentionRuleResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DeleteRetentionRuleResourceWithHttpInfo variant

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

try
{
    // Remove a retention rule
    apiInstance.DeleteRetentionRuleResourceWithHttpInfo(id);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling RetentionRulesApi.DeleteRetentionRuleResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string Unique identifier of the retention rule.

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 retention rule was removed. -
401 Authentication information is missing or invalid. -
403 Not authorized to perform this operation. -
404 Retention rule not found. -

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

GetRetentionRuleCollectionResource

RetentionRuleCollection GetRetentionRuleCollectionResource (int? currentPage = null, int? pageSize = null, bool? withTotalElements = null, bool? withTotalPages = null)

Retrieve all retention rules

Retrieve all retention rules on your tenant.

Required roles
ROLE_RETENTION_RULE_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 GetRetentionRuleCollectionResourceExample
    {
        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 RetentionRulesApi(config);
            var currentPage = 3;  // int? | The current page of the paginated results. (optional)  (default to 1)
            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 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 all retention rules
                RetentionRuleCollection result = apiInstance.GetRetentionRuleCollectionResource(currentPage, pageSize, withTotalElements, withTotalPages);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RetentionRulesApi.GetRetentionRuleCollectionResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetRetentionRuleCollectionResourceWithHttpInfo variant

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

try
{
    // Retrieve all retention rules
    ApiResponse<RetentionRuleCollection> response = apiInstance.GetRetentionRuleCollectionResourceWithHttpInfo(currentPage, pageSize, 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 RetentionRulesApi.GetRetentionRuleCollectionResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
currentPage int? The current page of the paginated results. [optional] [default to 1]
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]
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

RetentionRuleCollection

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 The request has succeeded and all retention rules are sent in the response. -
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]

GetRetentionRuleResource

RetentionRule GetRetentionRuleResource (string id)

Retrieve a retention rule

Retrieve a specific retention rule by a given ID.

Required roles
ROLE_RETENTION_RULE_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 GetRetentionRuleResourceExample
    {
        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 RetentionRulesApi(config);
            var id = 1569;  // string | Unique identifier of the retention rule.

            try
            {
                // Retrieve a retention rule
                RetentionRule result = apiInstance.GetRetentionRuleResource(id);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RetentionRulesApi.GetRetentionRuleResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the GetRetentionRuleResourceWithHttpInfo variant

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

try
{
    // Retrieve a retention rule
    ApiResponse<RetentionRule> response = apiInstance.GetRetentionRuleResourceWithHttpInfo(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 RetentionRulesApi.GetRetentionRuleResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string Unique identifier of the retention rule.

Return type

RetentionRule

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 The request has succeeded and the retention rule is sent in the response. -
401 Authentication information is missing or invalid. -
403 Not authorized to perform this operation. -
404 Retention rule not found. -

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

PostRetentionRuleCollectionResource

RetentionRule PostRetentionRuleCollectionResource (PostRetentionRuleCollectionResourceRequest postRetentionRuleCollectionResourceRequest, string? accept = null)

Create a retention rule

Create a retention rule on your tenant.

Required roles
ROLE_RETENTION_RULE_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 PostRetentionRuleCollectionResourceExample
    {
        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 RetentionRulesApi(config);
            var postRetentionRuleCollectionResourceRequest = new PostRetentionRuleCollectionResourceRequest(); // PostRetentionRuleCollectionResourceRequest | 
            var accept = application/json;  // string? | Advertises which content types, expressed as MIME types, the client is able to understand. (optional) 

            try
            {
                // Create a retention rule
                RetentionRule result = apiInstance.PostRetentionRuleCollectionResource(postRetentionRuleCollectionResourceRequest, accept);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RetentionRulesApi.PostRetentionRuleCollectionResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the PostRetentionRuleCollectionResourceWithHttpInfo variant

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

try
{
    // Create a retention rule
    ApiResponse<RetentionRule> response = apiInstance.PostRetentionRuleCollectionResourceWithHttpInfo(postRetentionRuleCollectionResourceRequest, accept);
    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 RetentionRulesApi.PostRetentionRuleCollectionResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
postRetentionRuleCollectionResourceRequest PostRetentionRuleCollectionResourceRequest
accept string? Advertises which content types, expressed as MIME types, the client is able to understand. [optional]

Return type

RetentionRule

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 A retention rule was created. -
401 Authentication information is missing or invalid. -
403 Not authorized to perform this operation. -
422 Unprocessable Entity – invalid payload. -

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

PutRetentionRuleResource

RetentionRule PutRetentionRuleResource (string id, RetentionRule retentionRule, string? accept = null)

Update a retention rule

Update a specific retention rule by a given ID.

Required roles
ROLE_RETENTION_RULE_ADMIN AND (the rule is editable OR it's the tenant management)

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 PutRetentionRuleResourceExample
    {
        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 RetentionRulesApi(config);
            var id = 1569;  // string | Unique identifier of the retention rule.
            var retentionRule = new RetentionRule(); // RetentionRule | 
            var accept = application/json;  // string? | Advertises which content types, expressed as MIME types, the client is able to understand. (optional) 

            try
            {
                // Update a retention rule
                RetentionRule result = apiInstance.PutRetentionRuleResource(id, retentionRule, accept);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling RetentionRulesApi.PutRetentionRuleResource: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the PutRetentionRuleResourceWithHttpInfo variant

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

try
{
    // Update a retention rule
    ApiResponse<RetentionRule> response = apiInstance.PutRetentionRuleResourceWithHttpInfo(id, retentionRule, accept);
    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 RetentionRulesApi.PutRetentionRuleResourceWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
id string Unique identifier of the retention rule.
retentionRule RetentionRule
accept string? Advertises which content types, expressed as MIME types, the client is able to understand. [optional]

Return type

RetentionRule

Authorization

Basic, OAI-Secure, SSO

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 A retention rule was updated. -
401 Authentication information is missing or invalid. -
403 Not authorized to perform this operation. -
404 Retention rule not found. -
422 Unprocessable Entity – invalid payload. -

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