Closed Bug 1302053 Opened 5 years ago Closed 4 years ago
Expose project status and information through API
WebStatus exposes information through a very simple API: * Default output is JSON, but can be set to plain text. * You can query a product ID, and get the list of supported locales (default), the list of complete locales, or the list of incomplete locales. Example: https://l10n.mozilla-community.org/webstatus/api/?product=outofdate-notifications-system-addon&type=complete&txt It would be really useful being able to retrieve information from Pontoon via API. Interesting queries: * Stats for a locale: supported projects, status of each project. * Stats for a project: supported locales, incomplete locales, complete locales.
Hi :flod, I talked with :mathjazz, for the full resolution of this ticket we should create an API for the rest of available resources e.g: * entities ** translations * contributors ** their timelines (?) As a part of this bug it is required to create a documentation and research how we can transit our current codebase into rest(ful/ish) api.
:flod,mathjazz I wonder if We could use GraphQL here as a query language (https://medium.com/@ottovw/rest-api-downfalls-and-dawn-of-graphql-dd00991a0eb8#.wtygnkbda). The GQL would nicely express things like entities (and their filters) and allow bigger flexibility for clients. What do you think? Or do you prefer a simple REST interface? I don't know what's the preferred solution in Mozilla organization.
I think that in the pontelmo universe, this is more of a elmo-side bug than a pontoon one. I'm personally sympathetic to GraphQL. I haven't totally dug into how easy it is to consume the results, though. I wonder to which extent this is a dupe of bug 1332181 now, as that has more detailed information?
I'm not familiar with GraphQL. Having said that, I wonder about the size of the response, if we end up exposing this much information in one call (unless I'm completely misreading that article). The way I see it, this might be more a blocker for bug 1332181 than a dupe: centralized schedule needs this information (it will probably get it internally, not via API), but it's not necessarily the only one. The latter is also a point to consider when picking REST vs GraphQL vs something else.
(In reply to Francesco Lodolo [:flod] from comment #4) > The way I see it, this might be more a blocker for bug 1332181 than a dupe: > centralized schedule needs this information Pike made a good point on IRC: if bug 1332181 is about identifying the data, and creating ways to manage/expose them in Pontoon, this bug is about exposing this data to the outside world. I still don't think they're dupes, but this is not a blocker, more the other way around (we need the data before building the API).
The other advantage of the API is that it can communicate data to the Open Innovation team's centralized community dashboards, especially once we implement quality metrics for individual localizers, communities, and projects.
I submitted a PR which adds GraphQL to Pontoon. I requested reviews on Github. We chose to go ahead with GraphQL after researching other options (see https://wiki.mozilla.org/L10n:Pontoon/API for the summary) and after a discussion in https://groups.google.com/forum/#!topic/mozilla.tools.l10n/R1S7Pk-c6uU. Thanks for everyone involved!
Commit pushed to master at https://github.com/mozilla/pontoon https://github.com/mozilla/pontoon/commit/bb919ea7527e257d35532a113d06be8365b5a1ff Add GraphQL (#630) Add the /graphql API endpoint to Pontoon. The main driver is the use case from bug 1302053: - Stats for a locale: supported projects, status of each project. - Stats for a project: supported locales, incomplete locales, complete locales. Research: https://wiki.mozilla.org/L10n:Pontoon/API Discussion: https://groups.google.com/forum/#!topic/mozilla.tools.l10n/R1S7Pk-c6uU.
Thanks for the help getting this merged and for the reviews!
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Commit pushed to master at https://github.com/mozilla/pontoon https://github.com/mozilla/pontoon/commit/3ebe2f43b96adb1184dca5bada17092f0059ebc5 Bug 1302053 - Fix CORS access for the api. (#723)
You need to log in before you can comment on or make changes to this bug.