Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support transient identities and traits in Core API #4279

Closed
khvn26 opened this issue Jul 3, 2024 · 0 comments · Fixed by #4325
Closed

Support transient identities and traits in Core API #4279

khvn26 opened this issue Jul 3, 2024 · 0 comments · Fixed by #4325
Assignees
Labels
api Issue related to the REST API

Comments

@khvn26
Copy link
Member

khvn26 commented Jul 3, 2024

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant