ropensci / unconf14

Repo to brainstorm ideas (unconference style) for the rOpenSci hackathon.
28 stars 3 forks source link

Best practices for developing API packages #23

Closed hadley closed 10 years ago

hadley commented 10 years ago

There's a lot of stuff in my head that isn't written down anywhere.

sckott commented 10 years ago

Awesome. It will be great to get these things down on paper (or markdown).

emhart commented 10 years ago

Or get them down for a paper. Lots of best practices things are published. Might be too niche. But you never know. On Mar 17, 2014 8:48 PM, "Scott Chamberlain" notifications@github.com wrote:

Awesome. It will be great to get these things down on paper (or markdown).

Reply to this email directly or view it on GitHubhttps://github.com/ropensci/hackathon/issues/23#issuecomment-37894718 .

karthik commented 10 years ago

For now I think getting them down would be great. A paper is somewhat secondary (how many API developers will read it, especially if it ends up pay walled). If we're hoping to improve data access in the science space, we should just aim to get this out as wide as possible.

hadley commented 10 years ago

To this end, can you recommend a simple API package that's still reasonably complicated (handles auth etc) - that would help me brainstorm.

cboettig commented 10 years ago

well RMendeley could use a complete rewrite; since they've moved to OAuth2.0 and which makes the current package with it's clunky RCurl implementation irrelevant ;-) http://dev.mendeley.com/

On Tue, Mar 18, 2014 at 2:02 PM, Hadley Wickham notifications@github.comwrote:

To this end, can you recommend a simple API package that's still reasonably complicated (handles auth etc) - that would help me brainstorm.

Reply to this email directly or view it on GitHubhttps://github.com/ropensci/hackathon/issues/23#issuecomment-37987734 .

Carl Boettiger UC Santa Cruz http://carlboettiger.info/

hadley commented 10 years ago

That has a lot of functions. Anything a little smaller?

karthik commented 10 years ago

well RMendeley could use a complete rewrite; since they've moved to OAuth2.0 and which makes the current package with it's clunky RCurl implementation irrelevant ;-) http://dev.mendeley.com/

@cboettig That repo is such a sore point for me because 180 commits and two months of work in and ROAuth was never released to CRAN. Now the API has changed. bleh. We should get that repo upgraded to httr at some point although it doesn't feel like a priority for the hackathon.

image

@hadley How about the Google Drive API for an example?

hadley commented 10 years ago

@karthik I think that's even more complicated than mendeley! I want something with like 10 api calls.

jeroen commented 10 years ago

I need to implement an R client for the OpenCPU API as well. It's probably not a good use case, but would love to get some thoughts on best practices for API clients before I start with this.

sckott commented 10 years ago

@hadley What about rnoaa https://github.com/ropensci/rnoaa - It's an interface to NOAA climate data. Has auth - just api keys.

@emhart @karthik @cboettig you may have a better example though

hadley commented 10 years ago

@sckott rnoaa looks good!

mfenner commented 10 years ago

FWIW, I just spent a painful day and a half implementing the new Mendeley OAuth2 authentication in a Ruby application: https://github.com/articlemetrics/alm/blob/develop/app/models/sources/mendeley.rb (look for get_access_token). The fun part is that their application tokens (i.e. not tied to user accounts) expire every 60 minutes.

hadley commented 10 years ago

It's pretty common for access tokens to expire frequently - google does this too. httr will automatically refresh for you.

Ironholds commented 10 years ago

I'd love to watch/talk about/participate in this; sounds fun.

karthik commented 10 years ago

Hi @Ironholds Would you like to hack with us remotely? If so please drop me an email so I can invite you to our chat room. Makes for easier discussion and participation.

Ironholds commented 10 years ago

Sure; I'm Dario's coworker, so as I understand it I might actually be attending ;). Is the API discussion likely to be on the agenda?

karthik commented 10 years ago

Indeed. Dario mentioned you might join us. Are you in SF this week?

Ironholds commented 10 years ago

Indeedy!

karthik commented 10 years ago

ok, please email me so we can discuss this outside of this issue (email in my profile)

cboettig commented 10 years ago

This sounds potentially part of issue #19 (in that there is an obvious sustainability challenge in the way one chooses to write API packages). I've described both under the "Sustainable Software" in the hackathon wiki's Projects page, but feel free to seperate them if folks would rather tackle these parts seperately.

hadley commented 10 years ago

In progress: https://github.com/hadley/httr/blob/master/vignettes/api-packages.Rmd. It's very rough but I'll keep working on it. Please submit pull requests :smile:

sckott commented 10 years ago

awesome, thanks @hadley

karthik commented 10 years ago

:sparkles: wow.