Pāriet uz saturu

Attributes

Attributes are the columns, and the query attributes, that digna profiles in a data source. Authentication, pagination and errors are described in the Overview.

Method Path Description
GET /v1/attributes List attributes
POST /v1/attributes Create an attribute
GET /v1/attributes/{attribute_id} Get an attribute
PUT /v1/attributes/{attribute_id} Update an attribute
DELETE /v1/attributes/{attribute_id} Delete an attribute

List attributes

GET /v1/attributes

Parameters

Name In Type Required Description
data_source_id query integer Yes Filter by data source ID
limit query integer No Maximum number of rows to return (default: 200, max: 5000)

Responses

Status Description Body
200 List attributes array of Attribute
400 Invalid limit ApiError
401 Not authenticated ApiError
500 Internal error ApiError

Example

curl -X GET 'https://digna.example.com/v1/attributes?data_source_id=<data_source_id>' \
  -H "Authorization: Bearer $DIGNA_API_KEY"

Create an attribute

POST /v1/attributes

Request body: CreateAttributeRequest

Responses

Status Description Body
201 Create an attribute Attribute
400 Invalid attribute definition ApiError
401 Not authenticated ApiError
403 Not authorized ApiError
404 Not found ApiError
500 Internal error ApiError

Example

curl -X POST 'https://digna.example.com/v1/attributes' \
  -H "Authorization: Bearer $DIGNA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "category": "NUMERICAL",
    "data_source_id": 1,
    "name": "<name>",
    "statistic_ids": [
      1
    ]
  }'

Get an attribute

GET /v1/attributes/{attribute_id}

Parameters

Name In Type Required Description
attribute_id path integer Yes Attribute ID

Responses

Status Description Body
200 Get an attribute Attribute
401 Not authenticated ApiError
404 Attribute not found ApiError
500 Internal error ApiError

Example

curl -X GET 'https://digna.example.com/v1/attributes/<attribute_id>' \
  -H "Authorization: Bearer $DIGNA_API_KEY"

Update an attribute

PUT /v1/attributes/{attribute_id}

Parameters

Name In Type Required Description
attribute_id path integer Yes Attribute ID

Request body: UpdateAttributeRequest

Responses

Status Description Body
200 Update an attribute Attribute
400 Invalid attribute definition ApiError
401 Not authenticated ApiError
403 Not authorized ApiError
404 Attribute not found ApiError
500 Internal error ApiError

Example

curl -X PUT 'https://digna.example.com/v1/attributes/<attribute_id>' \
  -H "Authorization: Bearer $DIGNA_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "category": "NUMERICAL",
    "name": "<name>",
    "statistic_ids": [
      1
    ]
  }'

Delete an attribute

DELETE /v1/attributes/{attribute_id}

Parameters

Name In Type Required Description
attribute_id path integer Yes Attribute ID

Responses

Status Description Body
204 Delete an attribute —
401 Not authenticated ApiError
403 Not authorized ApiError
404 Attribute not found ApiError
500 Internal error ApiError

Example

curl -X DELETE 'https://digna.example.com/v1/attributes/<attribute_id>' \
  -H "Authorization: Bearer $DIGNA_API_KEY"

Schemas

CreateAttributeRequest

Field Type Required Description
category StableAttributeCategory Yes
column string, nullable No COLUMN only: the source column to read. Defaults to name.
data_source_id integer Yes
data_type string No Stored empty for a QUERY attribute, whatever is sent.
description string, nullable No Business meaning of the attribute. Defaults to an empty string.
expression string, nullable No QUERY only: the SQL expression to read.
kind StableAttributeKind, nullable No COLUMN or QUERY. Without it, an expression makes the attribute QUERY and anything else COLUMN.
name string Yes The label, unique within the data source.
statistic_ids array of integer Yes

UpdateAttributeRequest

Field Type Required Description
category StableAttributeCategory Yes
column string, nullable No COLUMN only: the source column to read. Defaults to name.
data_type string No Stored empty for a QUERY attribute, whatever is sent.
description string, nullable No Business meaning of the attribute. Omit to keep the stored value.
expression string, nullable No QUERY only: the SQL expression to read.
kind StableAttributeKind, nullable No COLUMN or QUERY. Without it, an expression makes the attribute QUERY and anything else COLUMN.
name string Yes The label, unique within the data source.
statistic_ids array of integer Yes

ApiError

Field Type Required Description
code ApiErrorCode Yes
message string Yes

Attribute

Field Type Required Description
category StableAttributeCategory Yes
check_definitions array of AttributeCheckDefinition Yes
column string Yes The source column of a COLUMN attribute, empty for QUERY.
data_source AttributeDataSource Yes
data_type string Yes
description string Yes Business meaning of the attribute. Empty when none was given.
expression string Yes The SQL expression of a QUERY attribute, empty for COLUMN.
id integer Yes
kind StableAttributeKind Yes
name string Yes The label, unique within the data source.
project AttributeProject Yes

StableAttributeCategory

One of: NUMERICAL, CATEGORICAL, OTHER, DATE, CUSTOM.

ApiErrorCode

One of: INTERNAL_ERROR, INVALID_CREDENTIALS, NOT_FOUND, NOT_AUTHENTICATED, NOT_AUTHORIZED, INVALID_LICENSE, BAD_REQUEST.

AttributeDataSource

Field Type Required Description
id integer Yes
name string Yes

StableAttributeKind

One of: COLUMN, QUERY.

AttributeProject

Field Type Required Description
id integer Yes
name string Yes

AttributeCheckDefinition

Field Type Required Description
id integer Yes
statistic AttributeCheckDefinitionStatistic Yes

AttributeCheckDefinitionStatistic

Field Type Required Description
id integer Yes
name string Yes