AlexsLemonade / refinebio

Refine.bio harmonizes petabytes of publicly available biological data into ready-to-use datasets for cancer researchers and AI/ML scientists.
https://www.refine.bio/
Other
129 stars 20 forks source link

API Page and token generation #291

Closed dvenprasad closed 6 years ago

dvenprasad commented 6 years ago

Context

refine.bio needs a place for users to download API, know how to use the API and generate tokens (related to #265)

Problem or idea

The API page should:

Solution or next step

Collaborate with @Miserlou or @kurtwheeler to generate necessary content + copy for the page.

Miserlou commented 6 years ago

I'd suggest we simply have an API endpoints that acts something like:

GET api.refine.bio/token
===================
{
   'token': 'abcd123',
   'token_state': 'inactive',
   'terms_and_conditions': 'By using the Refine.bio service you agree to blah blah blah lawyers lawyers lawyers blah blah blah [ .. ] blah blah blah'
}

So then the user/endpoint must:

POST api.refine.bio/token/activate
BODY
{
   'token': 'abcd123',
}
====================
{
   'token': 'abcd123',
   'token_state': 'active'
}

This way we can have the web frontend be driven by the same endpoint, and we can ensure that API users received a copy of the T&C.

The activated token must be included on all requests to the smasher starter.

cgreene commented 6 years ago

In either case the user must take an action to accept the terms and conditions to download data. The proposed solution appears to meet the requirements we are working with. :+1:

On Thu, Jun 21, 2018, 2:15 PM Rich Jones notifications@github.com wrote:

I'd suggest we simply have an API endpoints that acts something like:

GET api.refine.bio/token

{ 'token': 'abcd123', 'token_state': inactive, 'terms_and_conditions': 'By using the Refine.bio service you agree to blah blah blah lawyers lawyers lawyers blah blah blah [ .. ] blah blah blah' }

So then the user/endpoint must:

POST api.refine.bio/token/activate BODY { 'token': 'abcd123', }

{ 'token': 'abcd123', 'token_state': 'active' }

This way we can have the web frontend be driven by the same endpoint, and we can ensure that API users received a copy of the T&C.

``

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AlexsLemonade/refinebio/issues/291#issuecomment-399196373, or mute the thread https://github.com/notifications/unsubscribe-auth/AAhHswQXGKmHQA4WCkAlHEol0nm_pgXZks5t--LIgaJpZM4UTx1u .

-- Casey S. Greene, Ph.D.

Assistant Professor Dept. of Systems Pharmacology and Translational Therapeutics Perelman School of Medicine University of Pennsylvania web: http://www.greenelab.com phone: 215-573-2991

Director Childhood Cancer Data Lab Alex's Lemonade Stand Foundation web: http://ccdatalab.org

kurtwheeler commented 6 years ago

I may be wrong but I'm not sure this should be on the MarimbaMiso milestone. While I think that we will in fact want to document our REST API and make it usable, along with allowing users to create API tokens to enable direct use of our API without going through the frontend, I didn't think any of that was in scope for MM.

cgreene commented 6 years ago

@kurtwheeler: We need at least the API bits relevant for generating a token so that the frontend can fill in that portion of the request when the checkbox is clicked. At that point, it seems like we might as well write some documentation of how one obtains and uses the API token (since we have to communicate that to the frontend folks anyway). At least the first bullet point from @dvenprasad seems reasonable since it is well aligned with work that we need to do before users can download data from the system.

Miserlou commented 6 years ago

Closing this as implemented, front-end implementation tracked here: https://github.com/AlexsLemonade/refinebio-frontend/issues/96