Update data filter

PATCH/projects/{projectId}/dataFilters/{filterId}

Base URL: https://api.tinkermode.com

Update specified data filter

Authentication

Send an Authorization header of the form ModeCloud <AUTH_CODE>.

Must contain the API key of a user or service account who has the permission to update all data filters of a project, or a Project API Key with admin permission.

Path parameters

NameTypeRequiredConstraintsDescription
projectIdintegerYesThe unique ID for a specified project.
filterIdstringYesData Filter ID

Request body

Content type: application/json

PropertyTypeRequiredConstraintsDescription
areaDeterminationRulesobjectNoThe configuration of area determination type of data filter.
Properties of areaDeterminationRules
PropertyTypeRequiredConstraintsDescription
forceOverwritebooleanNoForce overwrite the areas field in location data when it already has any areas.
searchKeyPrefixesarray<string>NoThe search key prefixes to search areas in GeoTSDB.
catalogIdstringYesData Source Catalog ID of data filter.
conversionRulesobjectNoThe configuration of conversion type of data filter.
Properties of conversionRules
PropertyTypeRequiredConstraintsDescription
differencingarray<object>NoThe rules for calculating the difference between a numeric value and its subsequent value.
Properties of differencing
PropertyTypeRequiredConstraintsDescription
resetobjectNo
Properties of reset
PropertyTypeRequiredConstraintsDescription
initialValuenumberNoIf the source or target value is null or the previous timestamp is over the reset interval, use the initial value instead.
resetIntervalstringNoThe interval at which data is considered lost. The previous value will be replaced with the initial value if the previous timestamp is over this interval. The format is Golang's duration format, such as '1h', '30m', '5s'.
resetValuenumberNoThe maximum value of the counters. If the counter reset happens, the difference is calculated from this value.
sourcestringYesThe source measurement value name. This name must be in a metric definition.
targetstringYesThe target measurement value name. This name must be in a metric definition.
entityClassstringNoThe entity class to be used for conversion. If the destination entity's entityClass doesn't match, the conversion is ignored. When this field is blank, it applies to data that has any entityClass.
excludesarray<string>NoThe metrics that should be omitted.
metricsDefinitionIdstringNoThe metrics definition ID to be used for conversion. If the destination entity's metricsDefinitionID doesn't match, the conversion is ignored. When this field is blank, it applies to data that has any metricsDefinitionId.
tagsarray<object>NoThe rules for converting tag names from measurement to metric.
Properties of tags
PropertyTypeRequiredConstraintsDescription
formulastringNoThe formula to convert measurement values to metric values. The formula must be a valid expression that can be evaluated in the context of the measurement values.
metricNamestringYesThe name of metrics.
namestringYesThe name of measurement values.
replacementarray<object>NoThe rules for replace tag values from old to new.
Properties of replacement
PropertyTypeRequiredConstraintsDescription
metricNamestringNoThe to value of the replacement rule.
namestringNoThe from value of the replacement rule.
valuesarray<object>NoThe rules for converting numeric names from measurement to metric.
Properties of values
PropertyTypeRequiredConstraintsDescription
copyToTagstringNoA tag name to copy a value from the metric. If the same tag name exists in the record, this field is ignored.
formulastringNoThe formula to convert measurement values to metric values. The formula must be a valid expression that can be evaluated in the context of the measurement values.
metricNamestringNoThe name of metrics.
namestringYesThe name of measurement values.
dataTypestringYesread-only (server-generated)Data type of the data filter. It must be one of the supported data types: metrics and locations.
filterIdstringYesread-only (server-generated)Unique Data Filter ID.
filterTypestringYesone of: conversion, area_determination, ellipsoid_to_orthometric_conversionFilter type of the data filter.
namestringNoDisplay name of data filter.
projectIdintegerYesread-only (server-generated)Project that this data filter belongs to.

Request example

{
  "catalogId": "custom1",
  "conversionRules": {
    "entityClass": "humidity_sensor",
    "excludes": [
      "debug_code"
    ],
    "metricsDefinitionId": "humidity_metrics",
    "tags": [
      {
        "metricName": "status",
        "name": "statusCode",
        "replacement": [
          {
            "new": "success",
            "old": "001"
          },
          {
            "new": "failure",
            "old": "002"
          }
        ]
      }
    ],
    "values": [
      {
        "metricName": "humidity",
        "name": "relative_humidity"
      }
    ]
  },
  "dataType": "metrics",
  "filterId": "filter2",
  "filterType": "conversion",
  "name": "Data Filter 2",
  "projectId": 1234
}

Responses

204 Successfully updated data filter.

401 Authorization is required to access this resource.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

403 Request failed because of invalid data or denied permission.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

404 The requested dataFilter does not exist or is not accessible.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

429 Request failed because of rate limit.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

500 An unexpected error has occurred.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.

503 The service is temporarily unavailable.

Content type: application/json

PropertyTypeRequiredConstraintsDescription
dataobjectNoread-only (server-generated)Any relevant data related to error.
reasonstringYesread-only (server-generated)Reason of error.