Skip to content

Support transient identities and traits in Core API #4279

@khvn26

Description

@khvn26

Part of #4278.

Evolve the API schemas as per the following:

GET /api/v1/identities (docs):

{
    "get": {
        "operationId": "identify_user",
        "description": "",
        "parameters": [
            {
                "name": "identifier",
                "in": "query",
                "required": true,
                "type": "string",
                "minLength": 1
+            },
+            {
+                "name": "transient",
+                "in": "query",
+                "required": false,
+                "type": "boolean"
            }
        ],
        "responses": {
            "200": {
                "description": "",
                "schema": {
                    "$ref": "#/definitions/SDKIdentitiesResponse"
                }
            }
        },
        "tags": [
            "api"
        ]
    }

POST /api/v1/identities (docs):

#/definitions/IdentifyWithTraits

{
    "required": [
        "identifier"
    ],
    "type": "object",
    "properties": {
        "identifier": {
            "title": "Identifier",
            "type": "string",
            "minLength": 1
        },
        "traits": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/TraitSerializerBasic"
            }
        },
        "flags": {
            "type": "array",
            "items": {
                "$ref": "#/definitions/SDKFeatureState"
            },
            "readOnly": true
+        },
+        "transient": {
+            "type": "boolean",
+            "x-nullable": true
        }
    }
}

#/definitions/TraitSerializerBasic

{
    "required": [
        "trait_key",
        "trait_value"
    ],
    "type": "object",
    "properties": {
        "id": {
            "title": "ID",
            "type": "integer",
            "readOnly": true
        },
        "trait_key": {
            "title": "Trait key",
            "type": "string",
            "maxLength": 200,
            "minLength": 1
        },
        "trait_value": {
            "title": "Trait value",
            "type": "string",
            "x-nullable": true
+        },
+        "transient": {
+            "type": "boolean",
+            "x-nullable": true
        }
    }
}

When endpoint gets called:

  • If identity is marked as transient, return the evaluated flags, but don't persist it.
  • If a trait is marked as transient, use it when evaluating flags, but don't persist it.

Metadata

Metadata

Assignees

Labels

apiIssue related to the REST API

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions