-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add API Endpoint documentation #8
Comments
Yeah, totally valid feature request! And, good news: there is a REST API! But... It's a bit complicated and it's undocumented. 😂 I'll keep this issue to remind me that I need to write documentation for it. Generally, the API is maybe not shaped in a way that you think of. It's a sync-API to potentially synchronize client programs, like apps. It uses the concept of commits. As a client you send the latest commit to the API that you know of and any changes that your client holds in a queue, then the API responds with all current data and all updates and deletes after the commit you specified, saves your pending work and sends you back the latest commit. If you don't specify a commit, it will just send you the latest data and commit. I've implemented it that way for offline work, but never got to finishing the native app... If you can't wait for the documentation, take a look at these files:
Sorry for this messy state 🤷♂️ |
Hi, thank you for this work :) I was also looking for a REST Api for this app :)
Am I on the right way? :) |
@joleaf Almost 😉 Try this instead (you can probably simplify the curl command if you want): curl --location --request POST 'https://cloud.xyz.de/index.php/apps/timemanager/api/updateObjects' \
-u user:password \
--header 'Content-Type: application/json' \
--data-raw '{
"data": {
"clients": {
"created": [],
"updated": [],
"deleted": []
},
"projects": {
"created": [],
"updated": [],
"deleted": []
},
"tasks": {
"created": [],
"updated": [],
"deleted": []
},
"times": {
"created": [],
"updated": [],
"deleted": []
}
},
"lastCommit": ""
}' I think that's the only way right now. The |
@te-online thank you very much, works for me 👍 PS: Are you planning a mobile app? If not, it's maybe for me a plan for a future project :) |
@joleaf Yes, you can update, create or soft-delete records by passing them into the respective arrays. The idea is that your app saves the "commit" (a uuid v4) that it receives from the server when downloading. Then, when you request or update data the next time you include the previous commit in your request. The server will then send you a new commit and only send you the changed data from the commit you sent up until the new commit. There's a very old Swift project somewhere, but I have to go through it to see if there's some garbage in there before I can make the repository public ;-) However, the app was only designed for landscape view on iPad 🙈 But maybe you can take some inspiration. Once I publish the repo I'll post a new comment here. |
@joleaf Here's a public repo of the iOS "app": https://github.com/te-online/te-online--timemanager-ios |
@te-online Cool :) I started some dart coding with this API :) down sync and up sync already works :) |
I have a feature suggestion which would help to integrate this into time tracking. Would it be possible to add an API with endpoints to start and stop a task? With this feature it would e.g. be possible to use an RFID/NFC scanner and swipe a card which automatically starts my work day, and a second swipe stops it.
The card -> Nextcloud user mapping could happen on the client side, which means the RFID terminal would authenticate against the app API with the Nextcloud user and an app token.
The text was updated successfully, but these errors were encountered: