Skip to content

buoncri/kimai-python

 
 

Repository files navigation

kimai-python

JSON API for the Kimai time-tracking software: API documentation, Swagger definition file

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 0.6
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.python.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com/buoncri/kimai-python.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/buoncri/kimai-python.git)

Then import the package:

import kimai_python 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import kimai_python

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import kimai_python
from kimai_python.rest import ApiException
from pprint import pprint

# Configure API key authorization: apiToken
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'
# Configure API key authorization: apiUser
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-USER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-USER'] = 'Bearer'

# create an instance of the API class
api_instance = kimai_python.ActivityApi(kimai_python.ApiClient(configuration))
project = 'project_example' # str | Project ID to filter activities (optional)
projects = 'projects_example' # str | Comma separated list of project IDs to filter activities (optional)
visible = 'visible_example' # str | Visibility status to filter activities. Allowed values: 1=visible, 2=hidden, 3=all (default: 1) (optional)
globals = 'globals_example' # str | Use if you want to fetch only global activities. Allowed values: true (default: false) (optional)
globals_first = 'globals_first_example' # str | Deprecated parameter, value is not used any more (optional)
order_by = 'order_by_example' # str | The field by which results will be ordered. Allowed values: id, name, project (default: name) (optional)
order = 'order_example' # str | The result order. Allowed values: ASC, DESC (default: ASC) (optional)
term = 'term_example' # str | Free search term (optional)

try:
    # Returns a collection of activities
    api_response = api_instance.api_activities_get(project=project, projects=projects, visible=visible, globals=globals, globals_first=globals_first, order_by=order_by, order=order, term=term)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActivityApi->api_activities_get: %s\n" % e)

# Configure API key authorization: apiToken
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'
# Configure API key authorization: apiUser
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-USER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-USER'] = 'Bearer'

# create an instance of the API class
api_instance = kimai_python.ActivityApi(kimai_python.ApiClient(configuration))
id = 56 # int | Activity ID to fetch

try:
    # Returns one activity
    api_response = api_instance.api_activities_id_get(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActivityApi->api_activities_id_get: %s\n" % e)

# Configure API key authorization: apiToken
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'
# Configure API key authorization: apiUser
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-USER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-USER'] = 'Bearer'

# create an instance of the API class
api_instance = kimai_python.ActivityApi(kimai_python.ApiClient(configuration))
id = 56 # int | Activity record ID to set the meta-field value for
body = kimai_python.IdMetaBody() # IdMetaBody |  (optional)

try:
    # Sets the value of a meta-field for an existing activity
    api_response = api_instance.api_activities_id_meta_patch(id, body=body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActivityApi->api_activities_id_meta_patch: %s\n" % e)

# Configure API key authorization: apiToken
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'
# Configure API key authorization: apiUser
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-USER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-USER'] = 'Bearer'

# create an instance of the API class
api_instance = kimai_python.ActivityApi(kimai_python.ApiClient(configuration))
body = kimai_python.ActivityEditForm() # ActivityEditForm | 
id = 56 # int | Activity ID to update

try:
    # Update an existing activity
    api_response = api_instance.api_activities_id_patch(body, id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActivityApi->api_activities_id_patch: %s\n" % e)

# Configure API key authorization: apiToken
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'
# Configure API key authorization: apiUser
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-USER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-USER'] = 'Bearer'

# create an instance of the API class
api_instance = kimai_python.ActivityApi(kimai_python.ApiClient(configuration))
id = 56 # int | The activity whose rates will be returned

try:
    # Returns a collection of all rates for one activity
    api_response = api_instance.api_activities_id_rates_get(id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActivityApi->api_activities_id_rates_get: %s\n" % e)

# Configure API key authorization: apiToken
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'
# Configure API key authorization: apiUser
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-USER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-USER'] = 'Bearer'

# create an instance of the API class
api_instance = kimai_python.ActivityApi(kimai_python.ApiClient(configuration))
body = kimai_python.ActivityRateForm() # ActivityRateForm | 
id = 56 # int | The activity to add the rate for

try:
    # Adds a new rate to an activity
    api_response = api_instance.api_activities_id_rates_post(body, id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActivityApi->api_activities_id_rates_post: %s\n" % e)

# Configure API key authorization: apiToken
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'
# Configure API key authorization: apiUser
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-USER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-USER'] = 'Bearer'

# create an instance of the API class
api_instance = kimai_python.ActivityApi(kimai_python.ApiClient(configuration))
id = 56 # int | The activity whose rate will be removed
rate_id = 56 # int | The rate to remove

try:
    # Deletes one rate for an activity
    api_instance.api_activities_id_rates_rate_id_delete(id, rate_id)
except ApiException as e:
    print("Exception when calling ActivityApi->api_activities_id_rates_rate_id_delete: %s\n" % e)

# Configure API key authorization: apiToken
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-TOKEN'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-TOKEN'] = 'Bearer'
# Configure API key authorization: apiUser
configuration = kimai_python.Configuration()
configuration.api_key['X-AUTH-USER'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-AUTH-USER'] = 'Bearer'

# create an instance of the API class
api_instance = kimai_python.ActivityApi(kimai_python.ApiClient(configuration))
body = kimai_python.ActivityEditForm() # ActivityEditForm | 

try:
    # Creates a new activity
    api_response = api_instance.api_activities_post(body)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling ActivityApi->api_activities_post: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to //demo-plugins.kimai.org/

Class Method HTTP request Description
ActivityApi api_activities_get GET /api/activities Returns a collection of activities
ActivityApi api_activities_id_get GET /api/activities/{id} Returns one activity
ActivityApi api_activities_id_meta_patch PATCH /api/activities/{id}/meta Sets the value of a meta-field for an existing activity
ActivityApi api_activities_id_patch PATCH /api/activities/{id} Update an existing activity
ActivityApi api_activities_id_rates_get GET /api/activities/{id}/rates Returns a collection of all rates for one activity
ActivityApi api_activities_id_rates_post POST /api/activities/{id}/rates Adds a new rate to an activity
ActivityApi api_activities_id_rates_rate_id_delete DELETE /api/activities/{id}/rates/{rateId} Deletes one rate for an activity
ActivityApi api_activities_post POST /api/activities Creates a new activity
CustomerApi api_customers_get GET /api/customers Returns a collection of customers
CustomerApi api_customers_id_get GET /api/customers/{id} Returns one customer
CustomerApi api_customers_id_meta_patch PATCH /api/customers/{id}/meta Sets the value of a meta-field for an existing customer
CustomerApi api_customers_id_patch PATCH /api/customers/{id} Update an existing customer
CustomerApi api_customers_id_rates_get GET /api/customers/{id}/rates Returns a collection of all rates for one customer
CustomerApi api_customers_id_rates_post POST /api/customers/{id}/rates Adds a new rate to a customer
CustomerApi api_customers_id_rates_rate_id_delete DELETE /api/customers/{id}/rates/{rateId} Deletes one rate for an customer
CustomerApi api_customers_post POST /api/customers Creates a new customer
DefaultApi api_config_i18n_get GET /api/config/i18n Returns the user specific locale configuration
DefaultApi api_config_timesheet_get GET /api/config/timesheet Returns the timesheet configuration
DefaultApi api_ping_get GET /api/ping A testing route for the API
DefaultApi api_plugins_get GET /api/plugins Returns information about installed Plugins
DefaultApi api_version_get GET /api/version Returns information about the Kimai release
ExpenseApi api_expenses_get GET /api/expenses Returns a collection of expenses
ExpenseApi api_expenses_id_delete DELETE /api/expenses/{id} Delete an existing expense record
ExpenseApi api_expenses_id_duplicate_patch PATCH /api/expenses/{id}/duplicate Duplicates an existing expense record
ExpenseApi api_expenses_id_get GET /api/expenses/{id} Returns one expense
ExpenseApi api_expenses_id_meta_patch PATCH /api/expenses/{id}/meta Sets the value of a meta-field for an existing expense
ExpenseApi api_expenses_id_patch PATCH /api/expenses/{id} Update an existing expense
ExpenseApi api_expenses_post POST /api/expenses Creates a new expense
KioskApi api_kiosks_get GET /api/kiosks Returns a collection of UserAuthCodes objects
KioskApi api_kiosks_id_get GET /api/kiosks/{id} Returns one UserAuthCodes entity
MetaFieldApi api_metafields_get GET /api/metafields Returns a collection of meta-fields
ProjectApi api_projects_get GET /api/projects Returns a collection of projects.
ProjectApi api_projects_id_get GET /api/projects/{id} Returns one project
ProjectApi api_projects_id_meta_patch PATCH /api/projects/{id}/meta Sets the value of a meta-field for an existing project
ProjectApi api_projects_id_patch PATCH /api/projects/{id} Update an existing project
ProjectApi api_projects_id_rates_get GET /api/projects/{id}/rates Returns a collection of all rates for one project
ProjectApi api_projects_id_rates_post POST /api/projects/{id}/rates Adds a new rate to an project
ProjectApi api_projects_id_rates_rate_id_delete DELETE /api/projects/{id}/rates/{rateId} Deletes one rate for an project
ProjectApi api_projects_post POST /api/projects Creates a new project
TagApi api_tags_get GET /api/tags Fetch all existing tags
TagApi api_tags_id_delete DELETE /api/tags/{id} Delete a tag
TagApi api_tags_post POST /api/tags Creates a new tag
TaskApi api_tasks_get GET /api/tasks Returns a collection of tasks
TaskApi api_tasks_id_assign_patch PATCH /api/tasks/{id}/assign Assign a task to the current user
TaskApi api_tasks_id_close_patch PATCH /api/tasks/{id}/close Close a task for the current user
TaskApi api_tasks_id_delete DELETE /api/tasks/{id} Delete an existing task record
TaskApi api_tasks_id_get GET /api/tasks/{id} Returns one task
TaskApi api_tasks_id_log_patch PATCH /api/tasks/{id}/log Logs work for a task record
TaskApi api_tasks_id_patch PATCH /api/tasks/{id} Update an existing task
TaskApi api_tasks_id_reopen_patch PATCH /api/tasks/{id}/reopen Reopens a task for the current user
TaskApi api_tasks_id_start_patch PATCH /api/tasks/{id}/start Start a task record
TaskApi api_tasks_id_stop_patch PATCH /api/tasks/{id}/stop Stops a task record for the current user
TaskApi api_tasks_id_unassign_patch PATCH /api/tasks/{id}/unassign Unassign a task from the current user
TaskApi api_tasks_post POST /api/tasks Creates a new Task
TeamApi api_teams_get GET /api/teams Fetch all existing teams
TeamApi api_teams_id_activities_activity_id_delete DELETE /api/teams/{id}/activities/{activityId} Revokes access for an activity from a team
TeamApi api_teams_id_activities_activity_id_post POST /api/teams/{id}/activities/{activityId} Grant the team access to an activity
TeamApi api_teams_id_customers_customer_id_delete DELETE /api/teams/{id}/customers/{customerId} Revokes access for a customer from a team
TeamApi api_teams_id_customers_customer_id_post POST /api/teams/{id}/customers/{customerId} Grant the team access to a customer
TeamApi api_teams_id_delete DELETE /api/teams/{id} Delete a team
TeamApi api_teams_id_get GET /api/teams/{id} Returns one team
TeamApi api_teams_id_members_user_id_delete DELETE /api/teams/{id}/members/{userId} Removes a member from the team
TeamApi api_teams_id_members_user_id_post POST /api/teams/{id}/members/{userId} Add a new member to a team
TeamApi api_teams_id_patch PATCH /api/teams/{id} Update an existing team
TeamApi api_teams_id_projects_project_id_delete DELETE /api/teams/{id}/projects/{projectId} Revokes access for a project from a team
TeamApi api_teams_id_projects_project_id_post POST /api/teams/{id}/projects/{projectId} Grant the team access to a project
TeamApi api_teams_post POST /api/teams Creates a new team
TimesheetApi api_timesheets_active_get GET /api/timesheets/active Returns the collection of active timesheet records
TimesheetApi api_timesheets_get GET /api/timesheets Returns a collection of timesheet records
TimesheetApi api_timesheets_id_delete DELETE /api/timesheets/{id} Delete an existing timesheet record
TimesheetApi api_timesheets_id_duplicate_patch PATCH /api/timesheets/{id}/duplicate Duplicates an existing timesheet record
TimesheetApi api_timesheets_id_export_patch PATCH /api/timesheets/{id}/export Switch the export state of a timesheet record to (un-)lock it
TimesheetApi api_timesheets_id_get GET /api/timesheets/{id} Returns one timesheet record
TimesheetApi api_timesheets_id_meta_patch PATCH /api/timesheets/{id}/meta Sets the value of a meta-field for an existing timesheet.
TimesheetApi api_timesheets_id_patch PATCH /api/timesheets/{id} Update an existing timesheet record
TimesheetApi api_timesheets_id_restart_patch PATCH /api/timesheets/{id}/restart Restarts a previously stopped timesheet record for the current user
TimesheetApi api_timesheets_id_stop_patch PATCH /api/timesheets/{id}/stop Stops an active timesheet record
TimesheetApi api_timesheets_post POST /api/timesheets Creates a new timesheet record
TimesheetApi api_timesheets_recent_get GET /api/timesheets/recent Returns the collection of recent user activities
UserApi api_users_get GET /api/users Returns the collection of all registered users
UserApi api_users_id_get GET /api/users/{id} Return one user entity
UserApi api_users_id_patch PATCH /api/users/{id} Update an existing user
UserApi api_users_me_get GET /api/users/me Return the current user entity
UserApi api_users_post POST /api/users Creates a new user

Documentation For Models

Documentation For Authorization

apiToken

  • Type: API key
  • API key parameter name: X-AUTH-TOKEN
  • Location: HTTP header

apiUser

  • Type: API key
  • API key parameter name: X-AUTH-USER
  • Location: HTTP header

Author

About

Kimai REST Client for Python

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.8%
  • Shell 0.2%