Define API schema for SDK evaluation data collection#6679
Draft
Define API schema for SDK evaluation data collection#6679
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
- Created SDKEvaluationDataSerializer with all required fields - Added SDKEvaluationDataView for handling batch evaluation data - Registered new endpoint at /api/v2/analytics/evaluations/ - Added comprehensive unit tests covering valid/invalid cases Co-authored-by: emyller <22429+emyller@users.noreply.github.com>
Changed expected status codes from 401 to 403 for authentication failures, which is the correct behaviour in this API Co-authored-by: emyller <22429+emyller@users.noreply.github.com>
- Remove unused imports from test file - Add type annotation for empty evaluations list Co-authored-by: emyller <22429+emyller@users.noreply.github.com>
- Document environment kwarg in save() method - Fix type annotation for empty list to be more accurate Co-authored-by: emyller <22429+emyller@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Define API schema for flagsmith SDK evaluation data
Define API schema for SDK evaluation data collection
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs/if required so people know about the feature.Changes
Implements alpha API endpoint for SDKs to send batch evaluation data to analytics backend.
New endpoint:
POST /api/v2/analytics/evaluations/Authentication: Environment key via
X-Environment-KeyheaderResponse:
202 Accepted(async processing)Schema (
SDKEvaluationDataSerializer)Accepts batch array with per-evaluation fields:
feature_name(string, required)enabled(boolean, required)value(JSON, optional) - feature value at evaluation timeevaluation_timestamp(datetime, required)identity_identifier(string, optional)identity_traits(array, optional) -[{trait_key, trait_value}]segment_names(array, optional) - segment membership at evaluationValidation filters evaluations for non-existent features in the environment.
Example request:
{ "evaluations": [ { "feature_name": "new_dashboard", "enabled": true, "value": "variant_a", "evaluation_timestamp": "2026-02-10T11:00:00Z", "identity_identifier": "user_123", "identity_traits": [ {"trait_key": "email", "trait_value": "user@example.com"} ], "segment_names": ["premium_users"] } ] }Note: Alpha release. Schema may break in future versions. Storage implementation (Postgres/InfluxDB) pending - currently no-op.
Files changed
api/api/urls/v2.py- URL routingapi/app_analytics/serializers.py-SDKEvaluationDataSerializer,SDKTraitSerializer,SDKEvaluationDataDetailapi/app_analytics/views.py-SDKEvaluationDataViewHow did you test this code?
Unit tests covering valid/invalid requests, authentication, validation, and edge cases (9 tests, all passing).
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.