diff --git a/api-schema.yml b/api-schema.yml index ff1a82c7d..1a05246d8 100644 --- a/api-schema.yml +++ b/api-schema.yml @@ -130,10 +130,9 @@ paths: schema: $ref: '#/components/schemas/CreateChatCompletionResponse' description: '' - /api/participants/: + /api/participants: post: operationId: update_participant_data - description: Upsert participant data for all specified experiments in the payload summary: Update Participant Data tags: - Participants diff --git a/apps/api/urls.py b/apps/api/urls.py index 45252be31..9e01696f1 100644 --- a/apps/api/urls.py +++ b/apps/api/urls.py @@ -16,7 +16,7 @@ ] urlpatterns = [ - path("participants/", views.update_participant_data, name="update-participant-data"), + path("participants/", views.update_participant_data_old, name="update-participant-data-old"), # Duplicate update-participant-data without a trailing "/" for backwards compatibility path("participants", views.update_participant_data, name="update-participant-data"), path("openai//chat/completions", openai.chat_completions, name="openai-chat-completions"), diff --git a/apps/api/views.py b/apps/api/views.py index a4b5dff69..d60b3aa54 100644 --- a/apps/api/views.py +++ b/apps/api/views.py @@ -125,6 +125,18 @@ def get_queryset(self): @api_view(["POST"]) @permission_required("experiments.change_participantdata") def update_participant_data(request): + return _update_participant_data(request) + + +@extend_schema(exclude=True) +@api_view(["POST"]) +@permission_required("experiments.change_participantdata") +def update_participant_data_old(request): + # This endpoint is kept for backwards compatibility of the path with a trailing "/" + return _update_participant_data(request) + + +def _update_participant_data(request): """ Upsert participant data for all specified experiments in the payload """