Skip to content
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

Provide public REST-API (and or documentation)... [$25 awarded] #83

Closed
stefan-niedermann opened this issue Mar 29, 2017 · 30 comments
Closed

Comments

@stefan-niedermann
Copy link
Member

stefan-niedermann commented Mar 29, 2017

... so one can write native applications that are in sync with the web interface :)


The $25 bounty on this issue has been claimed at Bountysource.

@srbaker
Copy link
Collaborator

srbaker commented Apr 13, 2017

Heya, is someone already working on this?

If not, I'll do it. This is my first work on Nextcloud stuff, though, so I'll benefit from some hand-holding.

Thanks!

@juliusknorr
Copy link
Member

@srbaker Sorry for the delay. Sure, It would be awesome if you would jump in and help us improve deck.

It would require implementing some extra API controllers similar to what the news app does: https://github.com/nextcloud/news/blob/master/lib/Controller/FeedApiController.php

Although it would be great to have some concept before starting the implementation. You can have a look at the v2 API proposal of the news app here as well: https://github.com/nextcloud/news/blob/master/docs/externalapi/External-Api.md

If you have any further questions feel free to ask or ping me on irc.

@srbaker
Copy link
Collaborator

srbaker commented Apr 24, 2017

Perfect, thanks. I'll take a look at this on the weekend. I'm very excited to be able to replace Trello with something that I can share with my family. And I really want there to be a desktop and Android app as well. :)

@stefan-niedermann
Copy link
Member Author

Android app

And that's what i am interested in to develop ;-)

@juliusknorr
Copy link
Member

@srbaker I've invited you to be a repo contributer, so you can directly push branches when developing.

@srbaker
Copy link
Collaborator

srbaker commented May 1, 2017

Perfect, thanks! I didn't get as far as I wanted this weekend, but I have several hours in the evenings this week. I'll push up the in-progress stuff once I get the first simplest endpoint working.

Cheers!

@moritz31
Copy link

moritz31 commented May 8, 2017

@srbaker @juliushaertl
If we have a REST-API it shouldn't be that complicated to add an iOs/Android application.
Have done similar to some home automation stuff

@juliusknorr
Copy link
Member

@srbaker Any news from your api implementation? Is there anything you need help with?

@srbaker
Copy link
Collaborator

srbaker commented Jun 24, 2017

Heya, sorry for the radio silence. Got a bit slowed down, but I have vacation time next week and I'm hoping to wrap up my work then.

@juliusknorr
Copy link
Member

@srbaker No problem 😉 Take your time.

@srbaker
Copy link
Collaborator

srbaker commented Jul 28, 2017

Alright, it's actually moving. Lovely vacation project.

https://github.com/srbaker/deck/tree/add-json-api

I'd like help with the following:

  1. I'm really struggling by not doing this test-first, because that's my habit. I'm using curl manually as a temporary solution: When I run make test from my deck checkout, I get:
mkdir -p build/
phpunit -c tests/phpunit.xml --coverage-clover build/php-unit.coverage.xml
PHPUnit 5.4.6 by Sebastian Bergmann and contributors.

Cannot open file "/home/srbaker/Projects/nextcloud/deck/tests/../../../tests/bootstrap.php".

Makefile:78: recipe for target 'test-unit' failed
make: *** [test-unit] Error 1
  1. I'd really like feedback on codestyle, patterns I'm missing, naming, or anything. This is my first contribution, and I want to do it well, so please comment and point me in the appropritate directions.

thanks!

@juliusknorr
Copy link
Member

I'm really struggling by not doing this test-first, because that's my habit. I'm using curl manually as a temporary solution: When I run make test from my deck checkout, I get

The unit tests require the deck directory to be inside of the apps folder of a nextcloud installation. So you need to clone nextcloud/server and then put the deck app inside apps/ for the unit tests to run. Symlinking should also work fine, in case you want to keep the repo at its original position.

I'd really like feedback on codestyle, patterns I'm missing, naming, or anything. This is my first contribution, and I want to do it well, so please comment and point me in the appropritate directions.

From a quick look I had it already looks quite good, feel free to open a WIP pull request to the deck repo already, that makes it easier to keep track of changes and comment on code sections.
Two very small things that came up when looking at it:

  • lets start with api version 1.0
  • the extra parenthesis around statements like new DataResponse() in the return statements are not required

Good work so far. Thank you for getting this started.

@srbaker
Copy link
Collaborator

srbaker commented Jul 29, 2017

Thanks for your quick response. I'll spend some more time on this tonight and tomorrow evening, and get the basics in place. Cheers!

@srbaker srbaker mentioned this issue Jul 29, 2017
@StillOnMyWay
Copy link

Any update on this one?

@sylvainar
Copy link

I'm starting a React Native mobile application as a side-project / learning exercise plugged on fake data, looking forward to this ! 😄

@srbaker
Copy link
Collaborator

srbaker commented Oct 23, 2017

A bit slow moving over here, but I've got some time set aside for it shortly.

@juliusknorr juliusknorr added this to the Backlog milestone Dec 8, 2017
@euZebe
Copy link

euZebe commented Jan 11, 2018

@sylvainar any news about your React Native mobile app ? I would be glad to give a hand on that project if needed.

@putt1ck
Copy link

putt1ck commented Apr 4, 2018

Is there any movement on this (or any way we can help out)?

@juliusknorr
Copy link
Member

@srbaker Maybe you can give us an update if you are still on implementing it. Otherwise maybe @putt1ck could pick up the work already done and continue with that. 😉

@srbaker
Copy link
Collaborator

srbaker commented Apr 9, 2018

Heya, I do have some in-flight work, but I am in the middle of switching laptops. I realize I'm slow as fuck, but I can spend some time tomorrow evening on this, and a few other evenings this week.

@juliusknorr
Copy link
Member

@srbaker Take your time. If you need any help, maybe you can just ping @putt1ck for that.

@putt1ck
Copy link

putt1ck commented Apr 13, 2018

@srbaker let us know if there's anything we could do to help

@juliusknorr juliusknorr changed the title Provide public REST-API (and or documentation)... Provide public REST-API (and or documentation)... [$15] May 11, 2018
@putt1ck
Copy link

putt1ck commented May 17, 2018

Any news? We've got a client project in the pipeline that we'd love to build around NC but we'd need a way to write emails to Deck for it to fly.

@juliusknorr juliusknorr changed the title Provide public REST-API (and or documentation)... [$15] Provide public REST-API (and or documentation)... [$25] Jun 11, 2018
@juliusknorr juliusknorr mentioned this issue Jun 18, 2018
@NebriBlackwing
Copy link
Member

I'll happily take a look at this, a json api would definitely benefit the app :)

@NebriBlackwing NebriBlackwing self-assigned this Jul 12, 2018
@NebriBlackwing
Copy link
Member

NebriBlackwing commented Jul 12, 2018

@juliushaertl If you don't mind take a quick peak at commit: b2843c8

I'm trying to spit back post data into a DataResponse just to verify my understanding, however when I test it, only the boardId is getting populated, everything else is getting returned as null. In fact if I send up an empty post body, boardId is still getting populated to 1! Seems like it's grabbing the url segments rather than the post.

Most MVC frameworks I've worked with, usually need some kind of denotation that the method in question is a POST, I haven't seen that in nextcloud apps yet. Below is a screenshot from rest client.

UPDATE: turns out the problem was in the rest client that I was trying to use. Switching out that rest client for another and now it's generating the request correctly. API is doing it's thing fine in that initial test :).

This was referenced Jul 12, 2018
@juliusknorr
Copy link
Member

I'm trying to spit back post data into a DataResponse just to verify my understanding, however when I test it, only the boardId is getting populated, everything else is getting returned as null. In fact if I send up an empty post body, boardId is still getting populated to 1! Seems like it's grabbing the url segments rather than the post.

You can access the values directly by using $this->request->post['boardId'] or $this->request->urlParams['boardId']

UPDATE: turns out the problem was in the rest client that I was trying to use. Switching out that rest client for another and now it's generating the request correctly. API is doing it's thing fine in that initial test :).

Ah ok, great to hear that.

@NebriBlackwing
Copy link
Member

@nextcloud/deck just to be sure nothing gets missed, can I get a list of endpoints that we want to support for the api?
We are very close now 👍

@schiessle
Copy link
Member

I know that there is already a pull request with a lot of code. I just found kanboard.org which already provides a API with existing Android clients (didn't checked other platforms) so I wonder if it would make sense to copy the API. This way we would be compatible with existing apps.

@NebriBlackwing
Copy link
Member

The API code is finished, we're just getting through validation checks. Also REST provides a common interface that easily allows data exchange with other applications, so we're already compatible with existing applications.

@juliusknorr juliusknorr changed the title Provide public REST-API (and or documentation)... [$25] Provide public REST-API (and or documentation)... [$25 awarded] Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests