From a81667a6db6b38c9d2a05215dd673e8727375ef3 Mon Sep 17 00:00:00 2001 From: Chris Smit Date: Fri, 17 Jan 2025 09:29:34 +0200 Subject: [PATCH 1/2] Remove trailing slashes --- api-schema.yml | 2 +- apps/api/urls.py | 8 ++++---- apps/channels/urls.py | 3 +-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/api-schema.yml b/api-schema.yml index e75a6d000..ff1a82c7d 100644 --- a/api-schema.yml +++ b/api-schema.yml @@ -264,7 +264,7 @@ paths: schema: $ref: '#/components/schemas/ExperimentSessionWithMessages' description: '' - /api/trigger_bot/: + /api/trigger_bot: post: operationId: trigger_bot_message description: Trigger the bot to send a message to the user diff --git a/apps/api/urls.py b/apps/api/urls.py index cd6dded8c..2742b007c 100644 --- a/apps/api/urls.py +++ b/apps/api/urls.py @@ -10,9 +10,9 @@ router.register(r"sessions", views.ExperimentSessionViewSet, basename="session") connect_patterns = [ - path("generate_key/", views.generate_key, name="generate_key"), - path("callback/", views.callback, name="callback"), - path("consent/", views.consent, name="consent"), + path("generate_key", views.generate_key, name="generate_key"), + path("callback", views.callback, name="callback"), + path("consent", views.consent, name="consent"), ] urlpatterns = [ @@ -20,6 +20,6 @@ path("openai//chat/completions", openai.chat_completions, name="openai-chat-completions"), path("files//content", views.file_content_view, name="file-content"), path("commcare_connect/", include((connect_patterns, "commcare-connect"))), - path("trigger_bot/", views.trigger_bot_message, name="trigger_bot"), + path("trigger_bot", views.trigger_bot_message, name="trigger_bot"), path("", include(router.urls)), ] diff --git a/apps/channels/urls.py b/apps/channels/urls.py index c641fb06e..1f70a9369 100644 --- a/apps/channels/urls.py +++ b/apps/channels/urls.py @@ -16,6 +16,5 @@ ), path("whatsapp/turn//incoming_message", views.new_turn_message, name="new_turn_message"), path("api//incoming_message", views.new_api_message, name="new_api_message"), - # TODO: Remove trailing / and update endpoint at ConnectID - path("commcare_connect/incoming_message/", views.new_connect_message, name="new_connect_message"), + path("commcare_connect/incoming_message", views.new_connect_message, name="new_connect_message"), ] From f1cfcb87923f3945616341dbc7153e17c1fbf15c Mon Sep 17 00:00:00 2001 From: Chris Smit Date: Fri, 17 Jan 2025 09:52:39 +0200 Subject: [PATCH 2/2] Duplicate update participant data without a trailing slash --- apps/api/urls.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/api/urls.py b/apps/api/urls.py index 2742b007c..45252be31 100644 --- a/apps/api/urls.py +++ b/apps/api/urls.py @@ -17,6 +17,8 @@ urlpatterns = [ path("participants/", views.update_participant_data, name="update-participant-data"), + # 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"), path("files//content", views.file_content_view, name="file-content"), path("commcare_connect/", include((connect_patterns, "commcare-connect"))),