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

Consolidate API documentation and implementation #577

Open
1 of 9 tasks
pral2a opened this issue Apr 13, 2021 · 2 comments
Open
1 of 9 tasks

Consolidate API documentation and implementation #577

pral2a opened this issue Apr 13, 2021 · 2 comments
Assignees

Comments

@pral2a
Copy link
Member

pral2a commented Apr 13, 2021

Current API documentation is not working at all. Also most of the examples related to the API are not working neither. Actually, there are 3 API versions but none of them is properly documented leading to a lot of difficulties to use the API, mostly for externals.

My suggestions are:

  • Asses documentation and API version status
  • Reduce the number of end-points to be supported and maintain only one API version
    • Confirm what end-points are used by "fabcloud" mgmt scripts
    • Provide basics methods (labs, machines...) with filter capabilities focusing in Rails standards to reduce maintenance efforts
  • Create basic documentation with methods and payload examples
  • Remove unsupported old documentation or clearly indicate as legacy

-- Viktor edit:

Problems:

  • The API doc is very much outdated. https://docs.fablabs.io/
  • Do we need a specific api.fablabs endpoint?
  • Can we do with a simple .json endpoints which use Ransack query / filter / paginations
  • https://api.fablabs.io/ - says it's READ ONLY. Is it? 🤔

This now redirects to the API, why?
https://fablabs.io/labs.json redirects to -> https://api.fablabs.io/0/labs.json which loads ALL labs.

Suggestions

  • Can we do with a minimal API? Do we need the v0 / v1 / v2
  • Do we need a versioned API? Do we have the resources to maintain it?
  • Remove / minimize the outdated documentation? Do we have the resources to maintain it?
  • Use simple .json endpoints
  • https://api.fablabs.io/0/me.json <-- Needs to keep working

Related #444 #464 #76 #71 #72 #73

viktorsmari added a commit that referenced this issue Apr 19, 2021
The API docs have not been updated in 2+ years and they are almost
unusable. None of the endpoints work.

Related to #577
@viktorsmari
Copy link
Collaborator

Another thing is that the API versioning functionality is using a deprecated gem called rocket_pants

This gem is preventing us to update to Rails 6

It prevented us also to update to Rails 5, but we found a maintained fork of it, which is now also not maintained.

https://github.com/Sutto/rocket_pants <-- last update 2015
https://github.com/parse/rocket_pants <-- last update 2018 (fork of the previous, we are using this one)

@MacTwister
Copy link
Contributor

MacTwister commented Apr 20, 2021

Some input from my side as Viktor shared this with me.

  1. For the Fabacademy student scripts, we are mainly interested in the users endpoint (searching and creating user accounts).

Another thing is that the API versioning functionality is using a deprecated gem called rocket_pants

I'm not so bothered if you would like to move the API to fix controller instead of using that gem. (if you guys are sure nobody else uses those APIs). Do you have any usage analytics on API request? Then let's align on the exact changes, to prepare for the next cycle.

  1. The OAuth (Doorkeeper) stuff uses the api.fablabs.io URL, not sure where/why this comes from. I only know this when setting up Gitlab and other auth stuff to work with Fablabs.io (probably this could move to the www. domain without breaking auth flows, but needs testing).

  2. Continuing on the Auth flow, (maybe related to Changes in api namespace and serialization #444 ), the Gitlab and other platforms that login with FablabsIO, will fetch profile information after authorization, using the URL https://api.fablabs.io/0/me.json. Not sure if related to the versioning stuff, but so you know to make sure it doesn't break.

    Edit: Not using this package, but see fibasile/omniauth-fablabs an example how it's used.

  3. Seems like a good idea to switch to the basic "get" api stuff for normal users to use the .json rails/integrated stuff. Which would be cleaner for those simple tasks (eg. like students doing research or graphs), though I'd review what information you are output ing to make sure no private information is leaking on any of those end points (ie. users/xxxx.json does not leak the email).

@viktorsmari viktorsmari pinned this issue May 13, 2021
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

3 participants