diff --git a/examples/cert_auth.py b/examples/cert_auth.py index fea7307..6c2f9c2 100644 --- a/examples/cert_auth.py +++ b/examples/cert_auth.py @@ -18,7 +18,7 @@ auth_method="certificate", verify_ssl=True) # Calls the API -api_desc_post = client.get("about/api/description", "extended=false&method=POST") +api_desc_post = client.get(endpoint="about/api/description", params="extended=false&method=POST") if api_desc_post: print(api_desc_post) else: diff --git a/qrs_api_client/client.py b/qrs_api_client/client.py index 8c74b5d..f77e254 100644 --- a/qrs_api_client/client.py +++ b/qrs_api_client/client.py @@ -68,31 +68,32 @@ def _request(self, method: str, endpoint: str, **kwargs) -> dict: print(f"API request error: {e}") return None - def get(self, endpoint: str, params=None) -> dict: + def get(self, endpoint: str, params: str = None) -> dict: """ Executes a GET request to the QRS API. Args: endpoint (str): The API endpoint to call. - params (dict, optional): Query parameters to include in the request. + params (str, optional): Query parameters to include in the request. Returns: dict: JSON response as a dictionary or None if an error occurs. """ return self._request("GET", endpoint, params=params) - def post(self, endpoint: str, data=None) -> dict: + def post(self, endpoint: str, params: str = None, data=None) -> dict: """ Executes a POST request to the QRS API. Args: endpoint (str): The API endpoint to call. + params (str, optional): Query parameters to include in the request. data (dict or str, optional): The JSON payload to include in the request body. Returns: dict: JSON response as a dictionary or None if an error occurs. """ - return self._request("POST", endpoint, data=data) + return self._request("POST", endpoint, params=params, data=data) def delete(self, endpoint: str) -> dict: """ @@ -155,4 +156,4 @@ def create_reload_task(self, app_id, task_name, custom_properties=None, tags: li payload = json.dumps(reload_task_bundle) # Execute API call - return self.post("reloadtask/create", data=payload) + return self.post(endpoint="reloadtask/create", data=payload)