From cae00b032b48628706da28832935f6550e65bffa Mon Sep 17 00:00:00 2001 From: simon Date: Fri, 1 Apr 2022 16:20:32 +0700 Subject: [PATCH] return better data for ping api, add to readme --- tubearchivist/api/README.md | 13 +++++++++++++ tubearchivist/api/views.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tubearchivist/api/README.md b/tubearchivist/api/README.md index 8620e3b..9852208 100644 --- a/tubearchivist/api/README.md +++ b/tubearchivist/api/README.md @@ -104,3 +104,16 @@ POST /api/download/ ## Download Queue Item View /api/download/\/ + + +## Ping View +Validate your connection with the API +GET /api/ping + +When valid returns message with user id: +```json +{ + "response": "pong", + "user": 1 +} +``` diff --git a/tubearchivist/api/views.py b/tubearchivist/api/views.py index 6d0ca3e..bf391a9 100644 --- a/tubearchivist/api/views.py +++ b/tubearchivist/api/views.py @@ -271,7 +271,7 @@ class PingView(ApiBaseView): @staticmethod def get(request): """get pong""" - data = {"pong": request.user.id} + data = {"response": "pong", "user": request.user.id} return Response(data)