Open Bug 1408625 Opened 2 years ago Updated 2 years ago

[API] Query for a project of a particular locale

Categories

(Webtools :: Pontoon, defect, P3)

defect

Tracking

(Not tracked)

People

(Reporter: roosan.gm, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:57.0) Gecko/20100101 Firefox/57.0
Build ID: 20171009192146

Steps to reproduce:

Trying to make api call to query a project of a particular locale.


Actual results:

It's not possible to query it right now.


Expected results:

I was expecting detail of a particular project of a particular locale.
Thanks for the report, Roosan!

Please note that we're still planning the Roadmap of the Pontoon API roll out:
https://wiki.mozilla.org/L10n:Pontoon/API#Roadmap

What data would you like to get from such query? I suspect aggregated stats and a list of Resources to Translate?
https://pontoon.mozilla.org/fr/mozillaorg/

We have this covered in the Milestone 2 which is scheduled for 2017 Q4. I'm CCing stas who leads the API effort, and probaby has ideas how he wants to track the next milestone in Bugzilla.
Hi Matjaz,
The data would be same as querying individual project (irrespective of locale which is possible now) but with this query will get a detail of individual project for a particular locale.
I asked Roosan to file this bug when he emailed me last week. Thanks again, Roosan!

Right now it's only possible to get _all_ locales for a particular project or _all_ projects for a particular locale. We expose the aggregated statistics for each item on the respective list. We could add a way to query for the same data but for a particular project _and_ a particular locale only.

I see two ways in which this could be accompilshed:

1) Add a new `localization(code, slug)` root-level field which allows to query ProjectLocale objects directly:

    {
        localization(code: "ne-NP", slug: "firefox") {
            missingStrings
        }
    }

2) Add a `localization(code)` field to the Project shape and a `localization(slug)` field to the Locale shape, similar to the current  `localizations` field which returns a list:

    {
        locale(code: "ne-NP") {
            localization(slug: "firefox") {
                missingStrings
            }
        }
    }

    {
        project(slug: "firefox") {
            localization(code: "ne-NP") {
                missingStrings
            }
        }
    }

My recommendation would be to go with the second approach: extending shapes is more versatile because it allows us to use the feature everywhere where the shape is used. For instance, we could list all locales with data about only some projects:

    query mobileLocales {
        locales {
            name
            android: localization(slug: "firefox-for-android") {
                missingStrings
            }
            ios: localization(slug: "firefox-for-ios") {
                missingStrings
            }
        }
    }
Blocks: pontoon-api
Summary: As a developer, I should be able to query for a project of a particular locale in Pontoon API. → [API] Query for a project of a particular locale
This bug seems still unconfirmed. Any news ?
Fixed. :)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Blocks: pontoon-api-m2
No longer blocks: pontoon-api
Priority: -- → P2
Hi :stas and :mathjazz,
I could look at this bug in the meantime if you won't mind.
Sure, go ahead. Note that stas is on a PTO until the end of the week, so it might take some time before he can respond.
Priority: P2 → P3
You need to log in before you can comment on or make changes to this bug.