kbancerz / kimai-python

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

ProjectAPI (api_projects_post) timeBudget & budget fields errors #5

Open mike1573 opened 3 years ago

mike1573 commented 3 years ago

Getting "value should not be null" errors after posting a new project via the API following the documentation.

Code:

    api_instance = kimai_python.ProjectApi(kimai_python.ApiClient(configuration))
    body = kimai_python.ProjectEditForm('Test', 'Test', None, None, None, None, 1, 'd2d6de', 1)
    api_response = api_instance.api_projects_post(body)

Error: Traceback (most recent call last): File "taskhub.py", line 362, in start() File "taskhub.py", line 217, in start api_response = proj_instance.api_projects_post('Wipro - Ingredion', 'Wipro - Ingredion', None, None, None, None, 1, 'd2d6de', 1) TypeError: api_projects_post() takes 2 positional arguments but 10 were given (kimai-env) gooncal@ip-72-167-226-99:~/kimai_api$ python taskhub.py Traceback (most recent call last): File "taskhub.py", line 362, in start() File "taskhub.py", line 217, in start api_response = proj_instance.api_projects_post(obody) File "/home/gooncal/kimai-env/lib/python3.6/site-packages/kimai_python/api/pro ject_api.py", line 748, in api_projects_post (data) = self.api_projects_post_with_http_info(body, **kwargs) # noqa: E501 File "/home/gooncal/kimai-env/lib/python3.6/site-packages/kimai_python/api/pro ject_api.py", line 818, in api_projects_post_with_http_info collection_formats=collection_formats) File "/home/gooncal/kimai-env/lib/python3.6/site-packages/kimai_python/api_cli ent.py", line 330, in call_api _preload_content, _request_timeout) File "/home/gooncal/kimai-env/lib/python3.6/site-packages/kimai_python/api_cli ent.py", line 161, in __call_api _request_timeout=_request_timeout) File "/home/gooncal/kimai-env/lib/python3.6/site-packages/kimai_python/api_cli ent.py", line 373, in request body=body) File "/home/gooncal/kimai-env/lib/python3.6/site-packages/kimai_python/rest.py ", line 275, in POST body=body) File "/home/gooncal/kimai-env/lib/python3.6/site-packages/kimai_python/rest.py ", line 228, in request raise ApiException(http_resp=r) kimai_python.rest.ApiException: (400) Reason: Bad Request HTTP response headers: HTTPHeaderDict({'Date': 'Sat, 15 Aug 2020 13:32:55 GMT', 'Server': 'Apache/2.4.18 (Ubuntu)', 'Cache-Control': 'max-age=0, must-revalidate , private', 'Expires': 'Sat, 15 Aug 2020 13:32:55 GMT', 'Set-Cookie': 'PHPSESSID =77m9g58k2kvuvr3u2cg5p0k7id; path=/; HttpOnly', 'Connection': 'close', 'Transfer -Encoding': 'chunked', 'Content-Type': 'application/json'}) HTTP response body: {"code":400,"message":"Validation Failed","errors":{"childre n":{"name":{},"comment":{},"orderNumber":{},"orderDate":{},"start":{},"end":{}," customer":{},"color":{},"budget":{"errors":["This value should not be null."]}," timeBudget":{"errors":["This value should not be null."]},"visible":{}}}}

MPW1412 commented 3 years ago

Hi,

this has been fixed in Kimai itself. Are you testing against the latest version?

https://github.com/kbancerz/kimai-python/pull/1

Best, Matthias

mike1573 commented 3 years ago

Hi, I did pull the latest version 1.9 from the git link in the website instructions a week ago.

Regards

kbancerz commented 3 years ago

Version 0.2.9 was generated for the upcoming 1.10. Please try kimai-python 0.2.7 for Kimai 1.9.

mike1573 commented 3 years ago

Working now. Thanks!