Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/Clockify/Clockify_Delete_client.ipynb
2973 views
Kernel: Python 3

Clockify.png

Clockify - Delete client

Give Feedback | Bug report

Tags: #clockify #client #create #api #rest #documentation

Last update: 2023-05-16 (Created: 2023-05-16)

Description: This notebook will show how to delete an existing client using Clockify API from a specific workspace.

Input

Import libraries

import requests import naas

Setup Variables

  • api_key: Get your API key

  • workspace_id: ID of the workspace

  • client_id: ID of the client to be deleted

api_key = naas.secret.get("CLOCKIFY_API_KEY") or "YOUR_API_KEY" workspace_id = "626f9e3b36c2670314c0386e" #"<WORKSPACE_ID>" client_id = "6463403ef0dac8169xxxxxx"

Model

Delete client

This function will delete an existing client using Clockify API.

def delete_client(workspace_id, api_key, client_id): url = f"https://api.clockify.me/api/workspaces/{workspace_id}/clients/{client_id}" headers = { "X-Api-Key": api_key, "Content-Type": "application/json" } response = requests.delete(url, headers=headers) return response

Output

Display result

response = delete_client(workspace_id, api_key, client_id) if response.status_code == 200: print(f"✅ Client '{client_id}' deleted from workspace") else: print(f"❌ Error while deleted client '{client_id}'") response.json()