kbancerz / kimai-python

Kimai REST Client for Python
MIT License
7 stars 6 forks source link

kimai-python

JSON API for the Kimai 2 time-tracking software. Read more about its usage in the API documentation and then download a Swagger file for import e.g. in Postman. Be aware: it is not yet considered stable and BC breaks might happen.

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

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/kbancerz/kimai-python.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/kbancerz/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)

Documentation for API Endpoints

All URIs are relative to http://localhost

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 instance specific timesheet configuration
DefaultApi api_ping_get GET /api/ping A testing route for the API
DefaultApi api_version_get GET /api/version Returns information about the Kimai release
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
TeamApi api_teams_get GET /api/teams Fetch all existing teams
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

apiUser

Author