Basket Synchronisation

This documents what data we synchronize with Basket and how.

Triggers

Every time a field that we’re meant to synchronize on an object changes, a full sync of the object is triggered.

A consequence of this is, since the relation between an addon and an user is part of the add-on object, when a new user is added as an author, or an existing author is removed from an add-on, that triggers a full sync of the add-on, including user account information for all its authors.

Objects

We’re synchronizing 2 types of objects:

  • User Accounts

  • Add-ons

User Accounts

Note

Newsletter opt-in information is not stored by AMO, and therefore not synchronized with the rest. It’s sent to basket separately directly whenever it changes, through basket’s Newsletter API subscribe and unsubscribe endpoints.

POST https://basket.mozilla.org/amo-sync/userprofile/
Request JSON Object:
  • id (int) – The numeric user id.

  • deleted (boolean) – Is the account deleted.

  • display_name (string|null) – The name chosen by the user.

  • homepage (string|null) – The user’s website.

  • fxa_id|null (string) – The user FxA Identifier

  • last_login (string|null) – The date of the last successful log in to the website.

  • location (string|null) – The location of the user.

Add-ons

POST https://basket.mozilla.org/amo-sync/addon/
Request JSON Object:
  • id (int) – The add-on id on AMO.

  • authors (array) – Array holding information about the authors for the add-on.

  • guid (string) – The add-on extension identifier.

  • name (string) – The add-on name (in add-on’s default locale)

  • default_locale (string) – The add-on default locale for translations.

  • slug (string) – The add-on slug.

  • type (string) – The add-on type.

  • status (string) – The add-on status.

  • is_disabled (boolean) – Whether the add-on is disabled or not.

  • latest_unlisted_version (object|null) – Object holding the latest unlisted version of the add-on. Only the 'id, compatibility, is_strict_compatibility_enabled and version fields are present.

  • current_version (object) – Object holding the current version of the add-on. Only the 'id, compatibility, is_strict_compatibility_enabled and version fields are present.

  • last_updated (string) – The date of the last time the add-on was updated by its developer(s).

  • ratings (object) – Object holding ratings summary information about the add-on.

  • ratings.count (int) – The total number of user ratings for the add-on.

  • ratings.text_count (int) – The number of user ratings with review text for the add-on.

  • ratings.average (float) – The average user rating for the add-on.

  • ratings.bayesian_average (float) – The bayesian average user rating for the add-on.

  • categories (object) – Object holding the categories the add-on belongs to.

  • categories[app_name] (array) – Array holding the category slugs the add-on belongs to for a given add-on application, referenced by its app_name. (Combine with the add-on type to determine the name of the category).

  • average_daily_users (int) – The average number of users for the add-on.

  • is_recommended (boolean) – Whether the add-on is recommended by Mozilla or not.

Example data

Here is an example of the full json that would be sent for an add-on:

{
    "authors": [
        {
            "id": 11263,
            "deleted": false,
            "display_name": "qwerty",
            "fxa_id": "1209e9bf1eeb59d0934579b6db0ccad1",
            "homepage": "",
            "last_login": "2019-08-06T10:39:44Z",
            "location": ""
        }
    ],
    "average_daily_users": 0,
    "categories": {
        "firefox": [
            "games-entertainment"
        ]
    },
    "current_version": {
        "id": 35900,
        "compatibility": {
            "firefox": {
                "min": "48.0",
                "max": "*"
            }
        },
        "is_strict_compatibility_enabled": false,
        "version": "2.0"
    },
    "default_locale": "en-US",
    "guid": "{85ee4a2a-51b6-4f5e-a99c-6d9abcf6782d}",
    "id": 35896,
    "is_disabled": false,
    "is_recommended": false,
    "last_updated": "2019-06-26T11:38:13Z",
    "latest_unlisted_version": {
        "id": 35899,
        "compatibility": {
            "firefox": {
                "min": "48.0",
                "max": "*"
            }
        },
        "is_strict_compatibility_enabled": false,
        "version": "1.0"
    },
    "name": "Ibird Jelewt Boartrica",
    "ratings": {
        "average": 4.1,
        "bayesian_average": 4.2,
        "count": 43,
        "text_count": 40
    },
    "slug": "ibird-jelewt-boartrica",
    "status": "nominated",
    "type": "extension"
}

Here is an example of the full json that would be sent for an user:

{
    "id": 11263,
    "deleted": false,
    "display_name": "serses",
    "email": "mozilla@virgule.net",
    "homepage": "",
    "last_login": "2019-08-06T10:39:44Z",
    "location": ""
}