From 6525e6d90f15fed7d87f591f38f5578ce403dc1b Mon Sep 17 00:00:00 2001 From: Dave Miller Date: Fri, 26 Sep 2025 15:25:17 -0400 Subject: [PATCH] Bug 1920627: Give API key examples in API docs (#202) --- docs/en/rst/api/core/v1/general.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/docs/en/rst/api/core/v1/general.rst b/docs/en/rst/api/core/v1/general.rst index 06ef5b2fbc..7118c4f585 100644 --- a/docs/en/rst/api/core/v1/general.rst +++ b/docs/en/rst/api/core/v1/general.rst @@ -113,6 +113,27 @@ any call, and you will be logged in as that user if the key is correct and has not been revoked. You can set up an API key by using the 'API Key' tab in the Preferences pages. +Examples: + +If using a GET request, make it a query param: + + :samp:`https://mysite/rest/bug/1?api_key={MY_API_KEY}` + +If using a POST or PUT request, put it in your JSON payload: + +.. code-block:: js + + { + "api_key": "MY_API_KEY", + "status": "RESOLVED", + "resolution": "FIXED" + } + +Note that it's generally not a good idea to put API keys in the query params, +as that allows it to be recorded in server logs. API calls that would normally +be sent as a GET request can also be sent as a POST request with the api_key +being the only content in your JSON payload. + **Login and Password** You can specify ``Bugzilla_login`` and ``Bugzilla_password`` or simply -- 2.47.3