API REST de Weblate

The API is accessible on the /api/ URL and it is based on Django REST framework. You can use it directly or by Client Weblate.

The API is also documented using OpenAPI 3.1 on the /api/schema/ URL, you can browse at /api/docs/.

Note

OpenAPI is available as a feature preview. The documentation is most likely incomplete at this point and subject to change. Please consult the documentation below for more detailed information on the API.

Authentification et paramètres génériques

The read-only API is available without authentication unless REQUIRE_LOGIN is turned on. Unauthenticated requests are heavily throttled (by default to 100 requests per day), so it is recommended to use authentication.

The authentication uses a token, which you can get in your profile. Use it in the Authorization header:

ANY /

Generic request behaviour for the API, the headers, status codes and parameters here apply to all endpoints as well.

Paramètres de requête:
  • format – Response format (overrides Accept). Possible values depends on REST framework setup, by default json, csv and api are supported. The latter provides web browser interface for API.

  • page – Returns given page of paginated results (use next and previous fields in response to automate the navigation).

  • page_size – Return the given number of items per request. The default is 50 and the maximum is 1000. For the units endpoints the default is 100 with a maximum of 10000. The default value is also configurable using the PAGE_SIZE setting.

En-têtes de requête:
  • Accept – the response content type depends on Accept header

  • Authorization – optional token to authenticate as Authorization: Token YOUR-TOKEN

En-têtes de réponse:
Response JSON Object:
  • detail (string) – verbose description of the result (for HTTP status codes other than 200 OK)

  • count (int) – total item count for object lists

  • next (string) – next page URL for object lists

  • previous (string) – previous page URL for object lists

  • results (array) – results for object lists

  • url (string) – URL to access this resource using the API

  • web_url (string) – URL to access this resource using web browser

Codes d’état:

Jetons d’authentification

Modifié dans la version 4.10: Project scoped tokens were introduced in the 4.10 release.

Each user has a personal access token which can be obtained in the user profile. Newly generated user tokens have the wlu_ prefix.

It is possible to create project scoped tokens for API access to given project only. These tokens can be identified by the wlp_ prefix.

Exemples d’authentification

Exemple de requête :

GET /api/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Authorization: Token YOUR-TOKEN

Exemple de réponse :

HTTP/1.0 200 OK
Date: Fri, 25 Mar 2016 09:46:12 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, HEAD, OPTIONS

{
    "projects":"http://example.com/api/projects/",
    "components":"http://example.com/api/components/",
    "translations":"http://example.com/api/translations/",
    "languages":"http://example.com/api/languages/"
}

Exemple CURL :

curl \
    -H "Authorization: Token TOKEN" \
    https://example.com/api/

Passing Parameters Examples

Pour la méthode POST le paramètre peut être spécifié soit sous la forme d’un envoi de formulaire (application/x-www-form-urlencoded) ou en tant que JSON (application/json).

Exemple de requête de formulaire :

POST /api/projects/hello/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Authorization: Token TOKEN

operation=pull

Exemple de requête JSON :

POST /api/projects/hello/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{"operation":"pull"}

Exemple CURL :

curl \
    -d operation=pull \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/components/hello/weblate/repository/

Exemple CURL JSON :

curl \
    --data-binary '{"operation":"pull"}' \
    -H "Content-Type: application/json" \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/components/hello/weblate/repository/

Composants et catégories

To access a component which is nested inside a Catégorie, you need to URL encode the category name into a component name separated with a slash. For example usage placed in a docs category needs to be used as docs%252Fusage. Full URL in this case would be for example https://example.com/api/components/hello/docs%252Fusage/repository/.

API rate limiting

The API requests are rate limited; the default configuration limits it to 100 requests per day for anonymous users and 5000 requests per hour for authenticated users.

Rate limiting can be adjusted in the settings.py; see Throttling in Django REST framework documentation for more details how to configure it.

In the Docker container this can be configured using WEBLATE_API_RATELIMIT_ANON and WEBLATE_API_RATELIMIT_USER.

The status of rate limiting is reported in following headers:

X-RateLimit-Limit

Nombre de requêtes autorisées à être exécuter

X-RateLimit-Remaining

Nombre restant de requêtes exécutables

X-RateLimit-Reset

Nombre de secondes restantes avant que la fenêtre de limitation du taux ne se réinitialise

Modifié dans la version 4.1: Ajout des entêtes d’état de limitation du taux.

Error responses

Modifié dans la version 5.10: Error responses were endpoint specific before this release.

Weblate error responses are formatted based on Error Response Format.

Point d’accès de l’API

GET /api/

Point d’accès racine de l’API.

Exemple de requête :

GET /api/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Authorization: Token YOUR-TOKEN

Exemple de réponse :

HTTP/1.0 200 OK
Date: Fri, 25 Mar 2016 09:46:12 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, HEAD, OPTIONS

{
    "projects":"http://example.com/api/projects/",
    "components":"http://example.com/api/components/",
    "translations":"http://example.com/api/translations/",
    "languages":"http://example.com/api/languages/"
}

Utilisateurs

Ajouté dans la version 4.0.

GET /api/users/

Renvoie une liste d’utilisateurs si vous avez les droits pour voir et gérer les utilisateurs. Sinon, vous verrez uniquement vos propres détails.

Paramètres de requête:
  • username (string) – Username to search for

  • id (int) – User ID to search for

Voir aussi

Les attributs des objets des utilisateurs sont documentés sur  GET /api/users/(str:username)/.

POST /api/users/

Crée un nouvel utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur

  • full_name (string) – Nom complet de l’utilisateur

  • email (string) – Courriel utilisateur

  • is_superuser (boolean) – L’utilisateur est-il un super-utilisateur ? (optionnel)

  • is_active (boolean) – L’utilisateur est-il actif ? (facultatif)

  • is_bot (boolean) – L’utilisateur est-il un robot ? (facultatif) (utilisé pour les jetons dédiés projet)

GET /api/users/(str: username)/

Renvoie les informations concernant les utilisateurs.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

Response JSON Object:
  • username (string) – nom utilisateur d’un utilisateur

  • full_name (string) – nom complet d’un utilisateur

  • email (string) – courriel d’un utilisateur

  • is_superuser (boolean) – indique si l’utilisateur est un super-utilisateur

  • is_active (boolean) – indique si l’utilisateur est actif

  • is_bot (boolean) – indique si l’utilisateur est un robot (utilisé pour les jetons ciblés projet)

  • date_joined (string) – date à laquelle l’utilisateur a été créé

  • last_login (string) – dernière date à laquelle l’utilisateur s’est connecté

  • groups (array) – lien vers les groupes associés ; voir GET /api/groups/(int:id)/

  • languages (array) – link to translated languages; see GET /api/languages/(string:language)/

Exemple de données JSON :

{
    "email": "user@example.com",
    "full_name": "Example User",
    "username": "exampleusername",
    "groups": [
        "http://example.com/api/groups/2/",
        "http://example.com/api/groups/3/"
    ],
    "languages": [
        "http://example.com/api/languages/cs/",
    ],
    "is_superuser": true,
    "is_active": true,
    "is_bot": false,
    "date_joined": "2020-03-29T18:42:42.617681Z",
    "url": "http://example.com/api/users/exampleusername/",
    "contributions_url": "http://example.com/api/users/exampleusername/contributions/"
    "statistics_url": "http://example.com/api/users/exampleusername/statistics/"
}
PUT /api/users/(str: username)/

Modifie les paramètres utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

Response JSON Object:
  • username (string) – nom utilisateur d’un utilisateur

  • full_name (string) – nom complet d’un utilisateur

  • email (string) – courriel d’un utilisateur

  • is_superuser (boolean) – indique si l’utilisateur est un super-utilisateur

  • is_active (boolean) – indique si l’utilisateur est actif

  • is_bot (boolean) – indique si l’utilisateur est un robot (utilisé pour les jetons ciblés projet)

  • date_joined (string) – date à laquelle l’utilisateur a été créé

PATCH /api/users/(str: username)/

Modifie les paramètres utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

Response JSON Object:
  • username (string) – nom utilisateur d’un utilisateur

  • full_name (string) – nom complet d’un utilisateur

  • email (string) – courriel d’un utilisateur

  • is_superuser (boolean) – indique si l’utilisateur est un super-utilisateur

  • is_active (boolean) – indique si l’utilisateur est actif

  • is_bot (boolean) – indique si l’utilisateur est un robot (utilisé pour les jetons ciblés projet)

  • date_joined (string) – date à laquelle l’utilisateur a été créé

DELETE /api/users/(str: username)/

Efface toutes les informations utilisateur et marque celui-ci inactif.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

POST /api/users/(str: username)/groups/

Associer des groupes à un utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

Paramètres de formulaire:
  • string group_id – The unique group ID

DELETE /api/users/(str: username)/groups/

Ajouté dans la version 4.13.1.

Retirer l’utilisateur d’un groupe.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

Paramètres de formulaire:
  • string group_id – The unique group ID

GET /api/users/(str: username)/statistics/

Lister les statistiques d’un utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

Response JSON Object:
  • translated (int) – Nombre de traductions par utilisateur

  • suggested (int) – Nombre de suggestions par utilisateur

  • uploaded (int) – Nombre de téléversements par utilisateur

  • commented (int) – Nombre de commentaires par utilisateur

  • languages (int) – Nombre de langues que l’utilisateur peut traduire

GET /api/users/(str: username)/contributions/

List translations with contributions from a user.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

Response JSON Object:
GET /api/users/(str: username)/notifications/

Lister les abonnements d’un utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

POST /api/users/(str: username)/notifications/

Associer des abonnements à un utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

Demander l’objet JSON:
  • notification (string) – Nom de la notification enregistrée

  • scope (int) – Objet de la notification à partir des choix disponibles

  • frequency (int) – Choix de la fréquence pour les notifications

GET /api/users/(str: username)/notifications/(int: subscription_id)/

Obtenir une souscription associée à un utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

  • subscription_id (int) – ID de notification enregistré

PUT /api/users/(str: username)/notifications/(int: subscription_id)/

Modifier une souscription associée à un utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

  • subscription_id (int) – ID de notification enregistré

Demander l’objet JSON:
  • notification (string) – Nom de la notification enregistrée

  • scope (int) – Objet de la notification à partir des choix disponibles

  • frequency (int) – Choix de la fréquence pour les notifications

PATCH /api/users/(str: username)/notifications/(int: subscription_id)/

Modifier une souscription associée à un utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

  • subscription_id (int) – ID de notification enregistré

Demander l’objet JSON:
  • notification (string) – Nom de la notification enregistrée

  • scope (int) – Objet de la notification à partir des choix disponibles

  • frequency (int) – Choix de la fréquence pour les notifications

DELETE /api/users/(str: username)/notifications/(int: subscription_id)/

Supprimer une souscription associée à un utilisateur.

Paramètres:
  • username (string) – Nom d’utilisateur de l’utilisateur

  • subscription_id – Nom de la notification enregistrée

  • subscription_id – entier

Groupes

Ajouté dans la version 4.0.

GET /api/groups/

Returns a list of groups if you have permissions to see manage groups. If not, then you get to see only the groups the user is a part of.

Voir aussi

Group object attributes are documented at GET /api/groups/(int:id)/.

POST /api/groups/

Creates a new group.

Paramètres:
GET /api/groups/(int: id)/

Returns information about the group.

Paramètres:
  • id (int) – ID du groupe

Response JSON Object:

Exemple de données JSON :

{
    "name": "Guests",
    "defining_project": null,
    "project_selection": 3,
    "language_selection": 1,
    "url": "http://example.com/api/groups/1/",
    "roles": [
        "http://example.com/api/roles/1/",
        "http://example.com/api/roles/2/"
    ],
    "languages": [
        "http://example.com/api/languages/en/",
        "http://example.com/api/languages/cs/",
    ],
    "projects": [
        "http://example.com/api/projects/demo1/",
        "http://example.com/api/projects/demo/"
    ],
    "componentlist": "http://example.com/api/component-lists/new/",
    "components": [
        "http://example.com/api/components/demo/weblate/"
    ],
    "admins": [
        "http://example.com/api/users/exampleusername/"
    ]
}
PUT /api/groups/(int: id)/

Changes the group parameters.

Paramètres:
  • id (int) – ID du groupe

Response JSON Object:
  • name (string) – name of a group

  • project_selection (int) – integer corresponding to group of projects

  • language_selection (int) – integer corresponding to group of languages

PATCH /api/groups/(int: id)/

Changes the group parameters.

Paramètres:
  • id (int) – ID du groupe

Response JSON Object:
  • name (string) – name of a group

  • project_selection (int) – integer corresponding to group of projects

  • language_selection (int) – integer corresponding to group of languages

DELETE /api/groups/(int: id)/

Deletes the group.

Paramètres:
  • id (int) – ID du groupe

POST /api/groups/(int: id)/roles/

Associate roles with a group.

Paramètres:
  • id (int) – ID du groupe

Paramètres de formulaire:
  • string role_id – The unique role ID

DELETE /api/groups/(int: id)/roles/(int: role_id)

Delete role from a group.

Paramètres:
  • id (int) – ID du groupe

  • role_id (int) – The unique role ID

POST /api/groups/(int: id)/components/

Associate components with a group.

Paramètres:
  • id (int) – ID du groupe

Paramètres de formulaire:
  • string component_id – The unique component ID

DELETE /api/groups/(int: id)/components/(int: component_id)

Delete component from a group.

Paramètres:
  • id (int) – ID du groupe

  • component_id (int) – The unique component ID

POST /api/groups/(int: id)/projects/

Associate projects with a group.

Paramètres:
  • id (int) – ID du groupe

Paramètres de formulaire:
  • string project_id – The unique project ID

DELETE /api/groups/(int: id)/projects/(int: project_id)

Delete project from a group.

Paramètres:
  • id (int) – ID du groupe

  • project_id (int) – The unique project ID

POST /api/groups/(int: id)/languages/

Associate languages with a group.

Paramètres:
  • id (int) – ID du groupe

Paramètres de formulaire:
  • string language_code – The unique language code

DELETE /api/groups/(int: id)/languages/(string: language_code)

Delete language from a group.

Paramètres:
  • id (int) – ID du groupe

  • language_code (string) – The unique language code

POST /api/groups/(int: id)/componentlists/

Associate componentlists with a group.

Paramètres:
  • id (int) – ID du groupe

Paramètres de formulaire:
  • string component_list_id – The unique componentlist ID

DELETE /api/groups/(int: id)/componentlists/(int: component_list_id)

Delete componentlist from a group.

Paramètres:
  • id (int) – ID du groupe

  • component_list_id (int) – The unique componentlist ID

POST /api/groups/(int: id)/admins/

Ajouté dans la version 5.5.

Ajouter l’utilisateur aux administrateurs de groupes.

Paramètres:
  • id (int) – ID du groupe

Paramètres de formulaire:
  • string user_id – The user’s ID

DELETE /api/groups/(int: id)/admins/(int: user_id)

Ajouté dans la version 5.5.

Supprimer l’utilisateur des administrateurs de groupes.

Paramètres:
  • id (int) – ID du groupe

  • user_id (integer) – The user’s ID

Rôles

GET /api/roles/

Returns a list of all roles associated with user. If user is superuser, then list of all existing roles is returned.

Voir aussi

Roles object attributes are documented at GET /api/roles/(int:id)/.

POST /api/roles/

Creates a new role.

Paramètres:
  • name (string) – Nom du rôle

  • permissions (array) – List of codenames of permissions

GET /api/roles/(int: id)/

Returns information about the role.

Paramètres:
  • id (int) – ID du rôle

Response JSON Object:
  • name (string) – Nom du rôle

  • permissions (array) – list of codenames of permissions

Exemple de données JSON :

{
    "name": "Access repository",
    "permissions": [
        "vcs.access",
        "vcs.view"
    ],
    "url": "http://example.com/api/roles/1/",
}
PUT /api/roles/(int: id)/

Changes the role parameters.

Paramètres:
  • id (int) – ID du rôle

Response JSON Object:
  • name (string) – Nom du rôle

  • permissions (array) – list of codenames of permissions

PATCH /api/roles/(int: id)/

Changes the role parameters.

Paramètres:
  • id (int) – ID du rôle

Response JSON Object:
  • name (string) – Nom du rôle

  • permissions (array) – list of codenames of permissions

DELETE /api/roles/(int: id)/

Deletes the role.

Paramètres:
  • id (int) – ID du rôle

Langues

GET /api/languages/

Returns a list of all languages.

Voir aussi

Language object attributes are documented at GET /api/languages/(string:language)/.

POST /api/languages/

Creates a new language.

Paramètres:
  • code (string) – Nom de la langue

  • name (string) – Nom de la langue

  • direction (string) – Orientation du texte

  • population (int) – Nombre de locuteurs

  • plural (object) – Language plural formula and number

GET /api/languages/(string: language)/

Returns information about the language.

Paramètres:
  • language (string) – Code langue

Response JSON Object:
  • code (string) – Code langue

  • direction (string) – Orientation du texte

  • plural (object) – Object of language plural information

  • aliases (array) – Array of aliases for language

Demander l’objet JSON:
  • population (int) – Nombre de locuteurs

Exemple de données JSON :

{
    "code": "en",
    "direction": "ltr",
    "name": "English",
    "population": 159034349015,
    "plural": {
        "id": 75,
        "source": 0,
        "number": 2,
        "formula": "n != 1",
        "type": 1
    },
    "aliases": [
        "english",
        "en_en",
        "base",
        "source",
        "eng"
    ],
    "url": "http://example.com/api/languages/en/",
    "web_url": "http://example.com/languages/en/",
    "statistics_url": "http://example.com/api/languages/en/statistics/"
}
PUT /api/languages/(string: language)/

Changes the language parameters.

Paramètres:
  • language (string) – Code de la langue

Demander l’objet JSON:
  • name (string) – Nom de la langue

  • direction (string) – Orientation du texte

  • population (int) – Nombre de locuteurs

  • plural (object) – Language plural details

PATCH /api/languages/(string: language)/

Changes the language parameters.

Paramètres:
  • language (string) – Code de la langue

Demander l’objet JSON:
  • name (string) – Nom de la langue

  • direction (string) – Orientation du texte

  • population (int) – Nombre de locuteurs

  • plural (object) – Language plural details

DELETE /api/languages/(string: language)/

Deletes the language.

Paramètres:
  • language (string) – Code de la langue

GET /api/languages/(string: language)/statistics/

Returns statistics for a language.

Paramètres:
  • language (string) – Code langue

Voir aussi

Returned attributes are described in Statistiques.

Projets

GET /api/projects/

Returns a list of all projects.

Voir aussi

Project object attributes are documented at GET /api/projects/(string:project)/.

POST /api/projects/

Creates a new project.

Paramètres:
  • name (string) – Nom du projet

  • slug (string) – Identifiant du projet

  • web (string) – Site Web du projet

GET /api/projects/(string: project)/

Returns information about the project.

Paramètres:
  • project (string) – URL abrégée du projet

Response JSON Object:

Exemple de données JSON :

{
    "name": "Hello",
    "slug": "hello",
    "url": "http://example.com/api/projects/hello/",
    "web": "https://weblate.org/",
    "web_url": "http://example.com/projects/hello/"
}
PATCH /api/projects/(string: project)/

Ajouté dans la version 4.3.

Edit a project by a PATCH request.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

PUT /api/projects/(string: project)/

Ajouté dans la version 4.3.

Edit a project by a PUT request.

Paramètres:
  • project (string) – URL abrégée du projet

DELETE /api/projects/(string: project)/

Deletes a project.

Paramètres:
  • project (string) – URL abrégée du projet

GET /api/projects/(string: project)/changes/

Returns a list of project changes. This is essentially a project scoped GET /api/changes/ accepting same params.

Paramètres:
  • project (string) – URL abrégée du projet

Response JSON Object:
GET /api/projects/(string: project)/file/

Ajouté dans la version 5.5.

Downloads all available translations associated with the project as an archive file using the requested format and language.

Paramètres:
  • project (string) – URL abrégée du projet

Paramètres de requête:
  • format (string) – The archive format to use; If not specified, defaults to zip; Supported formats: zip and zip:CONVERSION where CONVERSION is one of converters listed at Téléchargement des traductions.

  • language_code (string) – The language code to download; If not specified, all languages are included.

GET /api/projects/(string: project)/repository/

Returns information about the VCS repository status. This endpoint contains only an overall summary for all repositories for the project. To get more detailed status use GET /api/components/(string:project)/(string:component)/repository/.

Paramètres:
  • project (string) – URL abrégée du projet

Response JSON Object:
  • needs_commit (boolean) – whether there are any pending changes to commit

  • needs_merge (boolean) – whether there are any upstream changes to merge

  • needs_push (boolean) – whether there are any local changes to push

Exemple de données JSON :

{
    "needs_commit": true,
    "needs_merge": false,
    "needs_push": true
}
POST /api/projects/(string: project)/repository/

Performs given operation on the VCS repository.

Paramètres:
  • project (string) – URL abrégée du projet

Demander l’objet JSON:
  • operation (string) – Operation to perform: one of push, pull, commit, reset, cleanup, file-sync, file-scan

Response JSON Object:
  • result (boolean) – result of the operation

Exemple CURL :

curl \
    -d operation=pull \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/projects/hello/repository/

Exemple de requête JSON :

POST /api/projects/hello/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{"operation":"pull"}

JSON response example:

HTTP/1.0 200 OK
Date: Tue, 12 Apr 2016 09:32:50 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, POST, HEAD, OPTIONS

{"result":true}
GET /api/projects/(string: project)/components/

Returns a list of translation components in the given project.

Paramètres:
  • project (string) – URL abrégée du projet

Response JSON Object:
POST /api/projects/(string: project)/components/

Modifié dans la version 4.3: The zipfile and docfile parameters are now accepted for VCS-less components, see Fichiers locaux.

Modifié dans la version 4.6: The cloned repositories are now automatically shared within a project using URLs internes de Weblate. Use disable_autoshare to turn off this.

Creates translation components in the given project.

Indication

Use URLs internes de Weblate when creating multiple components from a single VCS repository.

Note

Most of the component creation happens in the background. Check the task_url attribute of created component and follow the progress there.

Paramètres:
  • project (string) – URL abrégée du projet

Paramètres de formulaire:
  • file zipfile – ZIP file to upload into Weblate for translations initialization

  • file docfile – Document à traduire

  • boolean disable_autoshare – Disables automatic repository sharing via URLs internes de Weblate.

Demander l’objet JSON:
Response JSON Object:

JSON can not be used when uploading the files using the zipfile and docfile parameters. The data has to be uploaded as multipart/form-data.

CURL form request example:

curl \
    --form docfile=@strings.html \
    --form name=Weblate \
    --form slug=weblate \
    --form file_format=html \
    --form new_lang=add \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/projects/hello/components/

CURL JSON request example:

curl \
    --data-binary '{
        "branch": "main",
        "file_format": "po",
        "file_format_params": {
            "po_line_wrap": 65535,
            "po_no_location": true
        },
        "filemask": "po/*.po",
        "name": "Weblate",
        "slug": "weblate",
        "repo": "https://github.com/WeblateOrg/hello.git",
        "template": "",
        "new_base": "po/hello.pot",
        "vcs": "git"
    }' \
    -H "Content-Type: application/json" \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/projects/hello/components/

JSON request to create a new component from Git:

POST /api/projects/hello/components/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{
    "branch": "main",
    "file_format": "po",
    "file_format_params": {
        "po_line_wrap": 65535,
        "po_no_location": true
    },
    "filemask": "po/*.po",
    "name": "Weblate",
    "slug": "weblate",
    "repo": "https://github.com/WeblateOrg/hello.git",
    "template": "",
    "new_base": "po/hello.pot",
    "vcs": "git"
}

JSON request to create a new component from another one:

POST /api/projects/hello/components/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{
    "file_format": "po",
    "filemask": "po/*.po",
    "name": "Weblate",
    "slug": "weblate",
    "repo": "weblate://weblate/hello",
    "template": "",
    "new_base": "po/hello.pot",
    "vcs": "git"
}

JSON response example:

HTTP/1.0 200 OK
Date: Tue, 12 Apr 2016 09:32:50 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, POST, HEAD, OPTIONS

{
    "branch": "main",
    "file_format": "po",
    "file_format_params": {
        "po_line_wrap": 65535,
        "po_no_location": true
    },
    "filemask": "po/*.po",
    "git_export": "",
    "license": "",
    "license_url": "",
    "name": "Weblate",
    "slug": "weblate",
    "project": {
        "name": "Hello",
        "slug": "hello",
        "source_language": {
            "code": "en",
            "direction": "ltr",
             "population": 159034349015,
            "name": "English",
            "url": "http://example.com/api/languages/en/",
            "web_url": "http://example.com/languages/en/"
        },
        "url": "http://example.com/api/projects/hello/",
        "web": "https://weblate.org/",
        "web_url": "http://example.com/projects/hello/"
    },
    "repo": "file:///home/nijel/work/weblate-hello",
    "template": "",
    "new_base": "",
    "url": "http://example.com/api/components/hello/weblate/",
    "vcs": "git",
    "web_url": "http://example.com/projects/hello/weblate/"
}
GET /api/projects/(string: project)/languages/

Returns paginated statistics for all languages within a project.

Paramètres:
  • project (string) – URL abrégée du projet

Response JSON Object:
  • results (array) – array of translation statistics objects

  • language (string) – Nom de la langue

  • code (string) – Code de la langue

  • total (int) – total number of strings

  • translated (int) – nombre de chaînes traduites

  • translated_percent (float) – pourcentage de chaînes traduites

  • total_words (int) – total number of words

  • translated_words (int) – number of translated words

  • words_percent (float) – percentage of translated words

GET /api/projects/(string: project)/statistics/

Returns statistics for a project.

Paramètres:
  • project (string) – URL abrégée du projet

Voir aussi

Returned attributes are described in Statistiques.

GET /api/projects/(string: project)/categories/

Ajouté dans la version 5.0: Returns categories for a project. See GET /api/categories/(int:id)/ for field definitions.

param project:

URL abrégée du projet

type project:

chaîne

GET /api/projects/(string: project)/labels/

Ajouté dans la version 5.3: Returns labels for a project.

param project:

URL abrégée du projet

type project:

chaîne

>json int id:

ID of the label

>json string name:

name of the label

>json string color:

color of the label

POST /api/projects/(string: project)/labels/

Ajouté dans la version 5.3: Creates a label for a project.

param project:

URL abrégée du projet

type project:

chaîne

<json string name:

name of the label

<json string color:

color of the label

DELETE /api/projects/(string: project)/labels/(int: label_id)/

Ajouté dans la version 5.14: Deletes a label from a project.

param project:

URL abrégée du projet

type project:

chaîne

param label_id:

ID of the label to delete

type label_id:

integer

GET /api/projects/(string: project)/credits/

Returns contributor credits for a project.

Ajouté dans la version 5.7.

Paramètres:
  • project (string) – URL abrégée du projet

  • start (date) – Lower-bound ISO 8601 timestamp (mandatory)

  • end (date) – Upper-bound ISO 8601 timestamp (mandatory)

  • lang (source_language) – Language code to search for

Response JSON Object:
  • email (string) – Email of the contributor

  • full_name (string) – Full name of the contributor

  • change_count (string) – Number of changes done in the time range

GET /api/projects/{string:project}/machinery_settings/

Ajouté dans la version 5.9.

Returns automatic suggestion settings for a project, consisting of the configurations defined for each translation service installed.

Paramètres:
  • project (string) – URL abrégée du projet

Response JSON Object:
  • suggestion_settings (object) – Configuration for all installed services.

POST /api/projects/{string:project}/machinery_settings/

Ajouté dans la version 5.9.

Create or update the service configuration for a project.

Paramètres:
  • project (string) – URL abrégée du projet

Paramètres de formulaire:
  • string service – Service name

  • string configuration – Service configuration in JSON

GET /api/projects/(string: project)/languages/(string: language_code)/file/

Modifié dans la version 5.15.1: Added ability to download ZIP file of all components translations in a project for 1 specific language.

Download a ZIP file of all translation files for a specified language_code across all components for a given project rather than downloading individual translated files and manually zipping them, with the archive named {project-slug}-{language-code}.zip and organized by component paths (e.g., component-slug/po/lang.po).

Paramètres:
  • project (string) – URL abrégée du projet

  • language_code (string) – Code langue

Paramètres de requête:
  • filter (string) – Optional case-insensitive substring to filter components by slug (e.g., ?filter=core will match components with “core” anywhere in their slug); only components whose slugs contain the substring will be included in the download.

  • format (string) – The archive format to use; If not specified, defaults to zip; Supported formats: zip and zip:CONVERSION where CONVERSION is one of converters listed at Téléchargement des traductions.

Note

Possible responses:

  • 200 OK with the ZIP file of translations for the specified language across all components in the project. If no components have translations for the specified language, an empty ZIP file will be returned.

  • 403 Forbidden if the user does not have permission to the project.

  • 404 Not Found if the project slug does not exist.

Composants

Indication

Utiliser POST /api/projects/(string:project)/components/ pour créer des composants.

GET /api/components/

Returns a list of translation components.

Voir aussi

Component object attributes are documented at GET /api/components/(string:project)/(string:component)/.

GET /api/components/(string: project)/(string: component)/

Returns information about the translation component.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Response JSON Object:

Exemple de données JSON :

{
    "branch": "main",
    "file_format": "po",
    "file_format_params": {
        "po_line_wrap": 65535,
        "po_no_location": true
    },
    "filemask": "po/*.po",
    "git_export": "",
    "license": "",
    "license_url": "",
    "name": "Weblate",
    "slug": "weblate",
    "project": {
        "name": "Hello",
        "slug": "hello",
        "source_language": {
            "code": "en",
            "direction": "ltr",
             "population": 159034349015,
            "name": "English",
            "url": "http://example.com/api/languages/en/",
            "web_url": "http://example.com/languages/en/"
        },
        "url": "http://example.com/api/projects/hello/",
        "web": "https://weblate.org/",
        "web_url": "http://example.com/projects/hello/"
    },
    "source_language": {
        "code": "en",
        "direction": "ltr",
        "population": 159034349015,
        "name": "English",
        "url": "http://example.com/api/languages/en/",
        "web_url": "http://example.com/languages/en/"
    },
    "repo": "file:///home/nijel/work/weblate-hello",
    "template": "",
    "new_base": "",
    "url": "http://example.com/api/components/hello/weblate/",
    "vcs": "git",
    "web_url": "http://example.com/projects/hello/weblate/"
}
PATCH /api/components/(string: project)/(string: component)/

Modifier un composant à l’aide d’une requête PATCH .

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • source_language (string) – Code de langue de la source du projet (optionnel)

Demander l’objet JSON:
  • name (string) – nom du composant

  • slug (string) – slug of component

  • repo (string) – VCS repository URL

Exemple CURL :

curl \
    --data-binary '{"name": "new name"}' \
    -H "Content-Type: application/json" \
    -H "Authorization: Token TOKEN" \
    PATCH http://example.com/api/projects/hello/components/

Exemple de requête JSON :

PATCH /api/projects/hello/components/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{
    "name": "new name"
}

JSON response example:

HTTP/1.0 200 OK
Date: Tue, 12 Apr 2016 09:32:50 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, POST, HEAD, OPTIONS

{
    "branch": "main",
    "file_format": "po",
    "file_format_params": {
        "po_line_wrap": 65535,
        "po_no_location": true
    },
    "filemask": "po/*.po",
    "git_export": "",
    "license": "",
    "license_url": "",
    "name": "new name",
    "slug": "weblate",
    "project": {
        "name": "Hello",
        "slug": "hello",
        "source_language": {
            "code": "en",
            "direction": "ltr",
            "population": 159034349015,
            "name": "English",
            "url": "http://example.com/api/languages/en/",
            "web_url": "http://example.com/languages/en/"
        },
        "url": "http://example.com/api/projects/hello/",
        "web": "https://weblate.org/",
        "web_url": "http://example.com/projects/hello/"
    },
    "repo": "file:///home/nijel/work/weblate-hello",
    "template": "",
    "new_base": "",
    "url": "http://example.com/api/components/hello/weblate/",
    "vcs": "git",
    "web_url": "http://example.com/projects/hello/weblate/"
}
PUT /api/components/(string: project)/(string: component)/

Edit a component by a PUT request.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Demander l’objet JSON:
  • branch (string) – VCS repository branch

  • file_format (string) – file format of translations

  • file_format_params (object) – parameters related to the file

  • filemask (string) – mask of translation files in the repository

  • name (string) – nom du composant

  • slug (string) – slug of component

  • repo (string) – VCS repository URL

  • template (string) – base file for monolingual translations

  • new_base (string) – base file for adding new translations

  • vcs (string) – système de contrôle des versions

DELETE /api/components/(string: project)/(string: component)/

Supprime un composant.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

GET /api/components/(string: project)/(string: component)/changes/

Returns a list of component changes. This is essentially a component scoped GET /api/changes/ accepting same params.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Response JSON Object:
GET /api/components/(string: project)/(string: component)/file/

Ajouté dans la version 4.9.

Downloads all available translations associated with the component as an archive file using the requested format.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Paramètres de requête:
  • format (string) – The archive format to use; If not specified, defaults to zip; Supported formats: zip and zip:CONVERSION where CONVERSION is one of converters listed at Téléchargement des traductions.

GET /api/components/(string: project)/(string: component)/screenshots/

Returns a list of component screenshots.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Response JSON Object:
GET /api/components/(string: project)/(string: component)/lock/

Returns component lock status.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Response JSON Object:
  • locked (boolean) – whether component is locked for updates

Exemple de données JSON :

{
    "locked": false
}
POST /api/components/(string: project)/(string: component)/lock/

Sets component lock status.

Response is same as GET /api/components/(string:project)/(string:component)/lock/.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Demander l’objet JSON:
  • lock – Booléen indiquant s’il faut verrouiller ou pas.

Exemple CURL :

curl \
    -d lock=true \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/components/hello/weblate/repository/

Exemple de requête JSON :

POST /api/components/hello/weblate/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{"lock": true}

JSON response example:

HTTP/1.0 200 OK
Date: Tue, 12 Apr 2016 09:32:50 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, POST, HEAD, OPTIONS

{"locked":true}
GET /api/components/(string: project)/(string: component)/repository/

Returns information about the VCS repository status.

The response is same as for GET /api/projects/(string:project)/repository/.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Response JSON Object:
  • needs_commit (boolean) – whether there are any pending changes to commit

  • needs_merge (boolean) – whether there are any upstream changes to merge

  • needs_push (boolean) – whether there are any local changes to push

  • remote_commit (string) – Remote commit information

  • status (string) – VCS repository status as reported by VCS

  • merge_failure – Text describing merge failure or null if there is none

POST /api/components/(string: project)/(string: component)/repository/

Performs the given operation on a VCS repository.

See POST /api/projects/(string:project)/repository/ for documentation.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Demander l’objet JSON:
  • operation (string) – Operation to perform: one of push, pull, commit, reset, cleanup

Response JSON Object:
  • result (boolean) – result of the operation

Exemple CURL :

curl \
    -d operation=pull \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/components/hello/weblate/repository/

Exemple de requête JSON :

POST /api/components/hello/weblate/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{"operation":"pull"}

JSON response example:

HTTP/1.0 200 OK
Date: Tue, 12 Apr 2016 09:32:50 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, POST, HEAD, OPTIONS

{"result":true}
GET /api/components/(string: project)/(string: component)/monolingual_base/

Downloads base file for monolingual translations.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

GET /api/components/(string: project)/(string: component)/new_template/

Downloads template file for new translations.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

GET /api/components/(string: project)/(string: component)/translations/

Returns a list of translation objects in the given component.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Response JSON Object:
POST /api/components/(string: project)/(string: component)/translations/

Creates new translation in the given component.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Demander l’objet JSON:
Response JSON Object:
  • result (object) – création d’un nouvel objet de traduction

Exemple CURL :

curl \
    -d language_code=cs \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/projects/hello/components/

Exemple de requête JSON :

POST /api/projects/hello/components/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{"language_code": "cs"}

JSON response example:

HTTP/1.0 200 OK
Date: Tue, 12 Apr 2016 09:32:50 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, POST, HEAD, OPTIONS

{
    "failing_checks": 0,
    "failing_checks_percent": 0,
    "failing_checks_words": 0,
    "filename": "po/cs.po",
    "fuzzy": 0,
    "fuzzy_percent": 0.0,
    "fuzzy_words": 0,
    "have_comment": 0,
    "have_suggestion": 0,
    "is_template": false,
    "is_source": false,
    "language": {
        "code": "cs",
        "direction": "ltr",
        "population": 1303174280
        "name": "Czech",
        "url": "http://example.com/api/languages/cs/",
        "web_url": "http://example.com/languages/cs/"
    },
    "language_code": "cs",
    "id": 125,
    "last_author": null,
    "last_change": null,
    "share_url": "http://example.com/engage/hello/cs/",
    "total": 4,
    "total_words": 15,
    "translate_url": "http://example.com/translate/hello/weblate/cs/",
    "translated": 0,
    "translated_percent": 0.0,
    "translated_words": 0,
    "url": "http://example.com/api/translations/hello/weblate/cs/",
    "web_url": "http://example.com/projects/hello/weblate/cs/"
}
GET /api/components/(string: project)/(string: component)/statistics/

Returns paginated statistics for all translations within component.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Voir aussi

Returned attributes are described in Statistiques.

Renvoie les projets liés à un composant.

Ajouté dans la version 4.5.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Response JSON Object:
POST /api/components/(string: project)/(string: component)/links/

Associer un projet à un composant.

Ajouté dans la version 4.5.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

Paramètres de formulaire:
  • string project_slug – Identifiant du projet

Supprimer l’association d’un projet à un composant.

Ajouté dans la version 4.5.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • project_slug (string) – L’identifiant du projet à supprimer

GET /api/components/(string: project)/(string: component)/credits/

Returns contributor credits for a project.

Ajouté dans la version 5.7.

Paramètres:
  • project (string) – URL abrégée du projet

  • start (date) – Lower-bound ISO 8601 timestamp (mandatory)

  • end (date) – Upper-bound ISO 8601 timestamp (mandatory)

  • lang (source_language) – Language code to search for

Response JSON Object:
  • email (string) – Email of the contributor

  • full_name (string) – Full name of the contributor

  • change_count (string) – Number of changes done in the time range

Traductions

GET /api/translations/

Renvoie une liste de traductions.

Voir aussi

Translation object attributes are documented at GET /api/translations/(string:project)/(string:component)/(string:language)/.

GET /api/translations/(string: project)/(string: component)/(string: language)/

Renvoie les informations concernant la traduction.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

Response JSON Object:

Exemple de données JSON :

{
    "component": {
        "branch": "main",
        "file_format": "po",
        "file_format_params": {
            "po_line_wrap": 65535,
            "po_no_location": true
        },
        "filemask": "po/*.po",
        "git_export": "",
        "license": "",
        "license_url": "",
        "name": "Weblate",
        "new_base": "",
        "project": {
            "name": "Hello",
            "slug": "hello",
            "source_language": {
                "code": "en",
                "direction": "ltr",
                "population": 159034349015,
                "name": "English",
                "url": "http://example.com/api/languages/en/",
                "web_url": "http://example.com/languages/en/"
            },
            "url": "http://example.com/api/projects/hello/",
            "web": "https://weblate.org/",
            "web_url": "http://example.com/projects/hello/"
        },
        "repo": "file:///home/nijel/work/weblate-hello",
        "slug": "weblate",
        "template": "",
        "url": "http://example.com/api/components/hello/weblate/",
        "vcs": "git",
        "web_url": "http://example.com/projects/hello/weblate/"
    },
    "failing_checks": 3,
    "failing_checks_percent": 75.0,
    "failing_checks_words": 11,
    "filename": "po/cs.po",
    "fuzzy": 0,
    "fuzzy_percent": 0.0,
    "fuzzy_words": 0,
    "have_comment": 0,
    "have_suggestion": 0,
    "is_template": false,
    "language": {
        "code": "cs",
        "direction": "ltr",
        "population": 1303174280
        "name": "Czech",
        "url": "http://example.com/api/languages/cs/",
        "web_url": "http://example.com/languages/cs/"
    },
    "language_code": "cs",
    "last_author": "Weblate Admin",
    "last_change": "2016-03-07T10:20:05.499",
    "revision": "7ddfafe6daaf57fc8654cc852ea6be212b015792",
    "share_url": "http://example.com/engage/hello/cs/",
    "total": 4,
    "total_words": 15,
    "translate_url": "http://example.com/translate/hello/weblate/cs/",
    "translated": 4,
    "translated_percent": 100.0,
    "translated_words": 15,
    "url": "http://example.com/api/translations/hello/weblate/cs/",
    "web_url": "http://example.com/projects/hello/weblate/cs/"
}
DELETE /api/translations/(string: project)/(string: component)/(string: language)/

Supprime une traduction.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

GET /api/translations/(string: project)/(string: component)/(string: language)/changes/

Returns a list of translation changes. This is essentially a translations-scoped GET /api/changes/ accepting the same parameters.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

Response JSON Object:
GET /api/translations/(string: project)/(string: component)/(string: language)/units/

Returns a list of translation units.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

  • q (string) – Search query string Recherche (optional)

Response JSON Object:
POST /api/translations/(string: project)/(string: component)/(string: language)/units/

Ajouter une nouvelle unité.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

Demander l’objet JSON:
  • key (string) – Monolingual translations: Key of translation unit

  • value (array) – Monolingual translations: Source strings (use single string if not creating plural)

  • context (string) – Bilingual translations: Context of a translation unit

  • source (array) – Bilingual translations: Source strings (use single string if not creating plural)

  • target (array) – Bilingual translations: Target strings (use single string if not creating plural)

  • state (int) – String state; see GET /api/units/(int:id)/

Response JSON Object:
POST /api/translations/(string: project)/(string: component)/(string: language)/autotranslate/

Modifié dans la version 5.13: The filter_type parameter is no longer supported and filtering is done by the q parameter.

Activer les traductions automatiques.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

Demander l’objet JSON:
  • mode (string) – Mode de traduction automatique

  • q (string) – Automatic translation search string, see Rechercher des chaînes.

  • auto_source (string) – Automatic translation source - mt or others

  • component (string) – Activez la contribution au mémoire de traduction partagé du projet afin d’avoir accès aux composants supplémentaires.

  • engines (array) – Moteurs de traduction automatisée

  • threshold (string) – Seuil de score

GET /api/translations/(string: project)/(string: component)/(string: language)/file/

Download current translation file as it is stored in the VCS (without the format parameter) or converted to another format (see Téléchargement des traductions).

Note

This API endpoint uses different logic for output than rest of API as it operates on whole file rather than on data. Set of accepted format parameter differs and without such parameter you get translation file as stored in VCS.

En-têtes de réponse:
En-têtes de requête:
  • If-Modified-Since – Skips response if the file has not been modified since that time.

Paramètres de requête:
  • format – File format to use; if not specified no format conversion happens; see Téléchargement des traductions for supported formats

  • q (string) – Filter downloaded strings, see Page de recherche, only applicable when conversion is in place (format is specified).

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

POST /api/translations/(string: project)/(string: component)/(string: language)/file/

Téléverser un nouveau fichier de traductions.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

Paramètres de formulaire:
  • string conflicts – How to deal with conflicts (ignore, replace-translated or replace-approved), see Gestion des conflits

  • file file – Fichier téléversé

  • string email – Adresse courriel de l’auteur

  • string author – Nom de l’auteur

  • string method – Upload method (translate, approve, suggest, fuzzy, replace, source, add), see Méthodes d’importation

  • string fuzzy – Fuzzy (marked for edit) strings processing (empty, process, approve)

Exemple CURL :

curl -X POST \
    -F file=@strings.xml \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/translations/hello/android/cs/file/
GET /api/translations/(string: project)/(string: component)/(string: language)/repository/

Returns information about the VCS repository status.

The response is same as for GET /api/components/(string:project)/(string:component)/repository/.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

POST /api/translations/(string: project)/(string: component)/(string: language)/repository/

Performs given operation on the VCS repository.

See POST /api/projects/(string:project)/repository/ for documentation.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

Demander l’objet JSON:
  • operation (string) – Operation to perform: one of push, pull, commit, reset, cleanup

Response JSON Object:
  • result (boolean) – result of the operation

GET /api/translations/(string: project)/(string: component)/(string: language)/statistics/

Returns detailed translation statistics.

Paramètres:
  • project (string) – URL abrégée du projet

  • component (string) – URL abrégée du composant

  • language (string) – Code de langue de traduction

Voir aussi

Returned attributes are described in Statistiques.

Mémoire

Ajouté dans la version 4.14.

GET /api/memory/

Renvoie une liste de résultats mémoire.

DELETE /api/memory/(int: memory_object_id)/

Deletes a memory object

Paramètres:
  • memory_object_id – Memory Object ID

Unités

A unit is a single piece of a translation which pairs a source string with a corresponding translated string and also contains some related metadata. The term is derived from the translate.storage.base.TranslationUnit in Translate Toolkit and XLIFF.

GET /api/units/

Returns a list of translation units.

Paramètres:
  • q (string) – Search query string Recherche (optional)

Voir aussi

Unit object attributes are documented at GET /api/units/(int:id)/.

GET /api/units/(int: id)/

Modifié dans la version 4.3: The target and source are now arrays to properly handle plural strings.

Modifié dans la version 5.6: The last_updated attribute is now exposed.

Returns information about the translation unit.

Paramètres:
  • id (int) – ID d’unité

Response JSON Object:
  • translation (string) – URL of a related translation object

  • source (array) – Chaîne source

  • previous_source (string) – previous source string used for fuzzy matching

  • target (array) – Chaîne cible

  • id_hash (string) – identifiant unique de l’unité

  • content_hash (string) – unique identifier of the source string

  • location (string) – location of the unit in source code

  • context (string) – translation unit context

  • note (string) – translation unit note

  • flags (string) – translation unit flags

  • labels (array) – translation unit labels, available on source units

  • state (int) – unit state, 0 - untranslated, 10 - needs editing, 20 - translated, 30 - approved, 100 - read-only

  • fuzzy (boolean) – si l’unité est approximative ou marquée pour révision

  • translated (boolean) – si l’unité est traduite

  • approved (boolean) – si la traduction est approuvée

  • position (int) – unit position in translation file

  • has_suggestion (boolean) – si l’unité a des suggestions

  • has_comment (boolean) – si l’unité a des commentaires

  • has_failing_check (boolean) – si l’unité a échoué aux contrôles

  • num_words (int) – nombre de mots source

  • priority (int) – translation priority; 100 is default

  • id (int) – Identifiant d’unité

  • explanation (string) – String explanation, available on source units, see Additional info on source strings

  • extra_flags (string) – Drapeaux de chaîne supplémentaires, disponibles sur les unités sources, voir Personnaliser le comportement en utilisant des drapeaux

  • web_url (string) – URL where the unit can be edited

  • source_unit (string) – Source unit link; see GET /api/units/(int:id)/

  • pending (boolean) – whether the unit is pending for write

  • timestamp (timestamp) – string age

  • last_updated (timestamp) – last string update

PATCH /api/units/(int: id)/

Ajouté dans la version 4.3.

Réaliser une mise à jour partielle sur l’unité de traduction.

Paramètres:
  • id (int) – ID d’unité

Demander l’objet JSON:
PUT /api/units/(int: id)/

Ajouté dans la version 4.3.

Réaliser une mise à jour complète sur l’unité de traduction.

Paramètres:
  • id (int) – ID d’unité

Demander l’objet JSON:
DELETE /api/units/(int: id)/

Ajouté dans la version 4.3.

Supprime une unité de traduction.

Paramètres:
  • id (int) – ID d’unité

GET /api/units/(int: id)/translations/

Ajouté dans la version 5.11.

Returns a list of all target translation units for the given source translation unit.

POST /api/units/(int: id)/comments/

Ajouté dans la version 5.12.

Create a new comment on the given translation unit.

Paramètres:
  • id (int) – ID d’unité

Demander l’objet JSON:
  • scope (string) – comment scope - global, translation (available on all non-source units), report (need review workflow enabled, see Relecteurs dédiés)

  • comment (string) – content of the new comment, you can use Markdown and mention users by @username.

  • user_email (string) – commenter’s email, can be set only by project admins and defaults to the authenticated user.

  • timestamp (string) – creation timestamp of the comment, can be set only by project admins and defaults to now.

Response JSON Object:
  • id (int) – comment identifier

  • comment (string) – content of the new comment

  • user (string) – URL of the commenter’s object

  • timestamp (string) – creation timestamp of the comment

GET /api/units/(int: id)/comments/

Ajouté dans la version 5.15.

Returns a list of comments on a given translation unit

Paramètres:
  • id (int) – ID d’unité

Response JSON Object:
  • id (int) – comment identifier

  • comment (string) – content of the comment

  • timestamp (string) – creation timestamp of the comment

  • user (string) – URL of the commenter’s object

Modifications

GET /api/changes/

Modifié dans la version 4.1: Le filtrage des modifications a été introduit dans la version 4.1 .

Renvoie une liste de modifications de traductions.

Voir aussi

Change object attributes are documented at GET /api/changes/(int:id)/.

Paramètres de requête:
  • user (string) – Username of user to filters

  • action (int) – Action to filter, can be used several times

  • timestamp_after (timestamp) – ISO 8601 formatted timestamp to list changes after

  • timestamp_before (timestamp) – ISO 8601 formatted timestamp to list changes before

GET /api/changes/(int: id)/

Renvoie les informations concernant la modification de traduction.

Paramètres:
  • id (int) – ID de la modification

Response JSON Object:
  • unit (string) – URL of a related unit object

  • translation (string) – URL of a related translation object

  • component (string) – URL of a related component object

  • user (string) – URL of a related user object

  • author (string) – URL of a related author object

  • timestamp (timestamp) – Horodatage de l’événement

  • action (int) – numeric identification of action

  • action_name (string) – text description of action

  • target (string) – event changed text

  • old (string) – texte précédent

  • details (object) – additional details about the change

  • id (int) – Identifiant de l’événement

Captures d’écran

GET /api/screenshots/

Returns a list of screenshot string information.

Voir aussi

Screenshot object attributes are documented at GET /api/screenshots/(int:id)/.

GET /api/screenshots/(int: id)/

Returns information about the screenshot.

Paramètres:
  • id (int) – ID de la capture d’écran

Response JSON Object:
GET /api/screenshots/(int: id)/file/

Download the screenshot image.

Paramètres:
  • id (int) – ID de la capture d’écran

POST /api/screenshots/(int: id)/file/

Replace screenshot image.

Paramètres:
  • id (int) – ID de la capture d’écran

Paramètres de formulaire:
  • file image – Fichier téléversé

Exemple CURL :

curl -X POST \
    -F image=@image.png \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/screenshots/1/file/
POST /api/screenshots/(int: id)/units/

Associate source string with screenshot.

Paramètres:
  • id (int) – ID de la capture d’écran

Paramètres de formulaire:
  • string unit_id – ID d’unité

Response JSON Object:
DELETE /api/screenshots/(int: id)/units/(int: unit_id)

Supprimer l’association de la chaîne source avec la capture d’écran.

Paramètres:
  • id (int) – ID de la capture d’écran

  • unit_id – ID de l’unité de la chaîne source

POST /api/screenshots/

Crée une nouvelle capture d’écran.

Paramètres de formulaire:
  • file image – Fichier téléversé

  • string name – Nom de la capture d’écran

  • string project_slug – Identifiant du projet

  • string component_slug – Identifiant du composant

  • string language_code – Code langue

Response JSON Object:
PATCH /api/screenshots/(int: id)/

Modifier les informations partielles sur la capture d’écran.

Paramètres:
  • id (int) – ID de la capture d’écran

Response JSON Object:
PUT /api/screenshots/(int: id)/

Modifier les informations complètes sur la capture d’écran.

Paramètres:
  • id (int) – ID de la capture d’écran

Response JSON Object:
DELETE /api/screenshots/(int: id)/

Supprimer la capture d’écran.

Paramètres:
  • id (int) – ID de la capture d’écran

Extensions

Ajouté dans la version 4.4.1.

GET /api/addons/

Returns a list of add-ons.

Voir aussi

Add-on object attributes are documented at GET /api/addons/(int:id)/.

GET /api/addons/(int: id)/

Returns information about add-on information.

Paramètres:
  • id (int) – ID du module

Response JSON Object:
  • name (string) – name of an add-on

  • component (string) – URL of a related component object

  • configuration (object) – Optional add-on configuration

Voir aussi

Extensions

POST /api/components/(string: project)/(string: component)/addons/

Creates a new add-on.

Paramètres:
  • project_slug (string) – Identifiant du projet

  • component_slug (string) – Identifiant du composant

Demander l’objet JSON:
  • name (string) – name of an add-on

  • configuration (object) – Optional add-on configuration

PATCH /api/addons/(int: id)/

Edit partial information about add-on.

Paramètres:
  • id (int) – ID du module

Response JSON Object:
  • configuration (object) – Optional add-on configuration

PUT /api/addons/(int: id)/

Edit full information about add-on.

Paramètres:
  • id (int) – ID du module

Response JSON Object:
  • configuration (object) – Optional add-on configuration

DELETE /api/addons/(int: id)/

Delete add-on.

Paramètres:
  • id (int) – ID du module

Listes de composants

Ajouté dans la version 4.0.

GET /api/component-lists/

Renvoie la liste des listes de composants.

Voir aussi

Component list object attributes are documented at GET /api/component-lists/(str:slug)/.

GET /api/component-lists/(str: slug)/

Returns information about component list.

Paramètres:
  • slug (string) – Component list slug

Response JSON Object:
  • name (string) – name of a component list

  • slug (string) – slug of a component list

  • show_dashboard (boolean) – whether to show it on a dashboard

  • components (array) – link to associated components; see GET /api/components/(string:project)/(string:component)/

  • auto_assign (array) – automatic assignment rules

PUT /api/component-lists/(str: slug)/

Changes the component list parameters.

Paramètres:
  • slug (string) – Component list slug

Demander l’objet JSON:
  • name (string) – name of a component list

  • slug (string) – slug of a component list

  • show_dashboard (boolean) – whether to show it on a dashboard

PATCH /api/component-lists/(str: slug)/

Changes the component list parameters.

Paramètres:
  • slug (string) – Component list slug

Demander l’objet JSON:
  • name (string) – name of a component list

  • slug (string) – slug of a component list

  • show_dashboard (boolean) – whether to show it on a dashboard

DELETE /api/component-lists/(str: slug)/

Supprime la liste des composants.

Paramètres:
  • slug (string) – Component list slug

GET /api/component-lists/(str: slug)/components/

Ajouté dans la version 5.0.1: List components in a component list.

param slug:

Component list slug

type slug:

chaîne

form string component_id:

ID du composant

>json array results:

array of component objects; see GET /api/components/(string:project)/(string:component)/

POST /api/component-lists/(str: slug)/components/

Associate component with a component list.

Paramètres:
  • slug (string) – Component list slug

Paramètres de formulaire:
  • string component_id – ID du composant

DELETE /api/component-lists/(str: slug)/components/(str: component_slug)

Disassociate a component from the component list.

Paramètres:
  • slug (string) – Component list slug

  • component_slug (string) – Identifiant du composant

Glossaire

Modifié dans la version 4.5: Glossaries are now stored as regular components, translations and strings, please use respective API instead.

Tâches

Ajouté dans la version 4.4.

GET /api/tasks/

L’affichage de la liste des tâches est actuellement non disponible.

GET /api/tasks/(str: uuid)/

Renvoie les informations à propos d’une tâche.

Paramètres:
  • uuid (string) – UUID de tâche

Response JSON Object:
  • completed (boolean) – Si la tâche est achevée

  • progress (int) – Progression d’une tâche en pourcentage

  • result (object) – Task result or progress details

  • log (string) – Journal des tâches

Statistiques

GET /api/(str: object)/statistics/

There are several statistics endpoints for objects and all of them contain same structure.

Paramètres:
  • object (string) – chemin d’URL

Response JSON Object:
  • total (int) – total number of strings

  • total_words (int) – total number of words

  • total_chars (int) – nombre total de caractères

  • last_change (timestamp) – date de la dernière modification

  • translated (int) – nombre de chaînes traduites

  • translated_percent (float) – pourcentage de chaînes traduites

  • translated_words (int) – number of translated words

  • translated_words_percent (float) – percentage of translated words

  • translated_chars (int) – nombre de caractères traduits

  • translated_chars_percent (float) – percentage of translated characters

  • fuzzy (int) – nombre de chaînes floues marquées À vérifier

  • fuzzy_words (int) – nombre de mots flous marqués À vérifier

  • fuzzy_chars (int) – nombre de caractères flous marqués À vérifier

  • fuzzy_percent (float) – percentage of fuzzy (marked for edit) strings

  • fuzzy_words_percent (float) – pourcentage de mots flous marqués À vérifier

  • fuzzy_chars_percent (float) – pourcentage de caractères flous marqués À vérifier

  • failing (int) – number of failing checks

  • failing_percent (float) – percentage of failing checks

  • approved (int) – number of approved strings

  • approved_words (int) – number of approved words

  • approved_chars (int) – number of approved characters

  • approved_percent (float) – percentage of approved strings

  • approved_words_percent (float) – percentage of approved words

  • approved_chars_percent (float) – percentage of approved characters

  • readonly (int) – number of read-only strings

  • readonly_words (int) – number of read-only words

  • readonly – nombre de caractères en lecture seule

  • readonly_percent (float) – pourcentage de chaînes en lecture seule

  • readonly_words_percent (float) – pourcentage de mots en lecture seule

  • readonly_char_percent (float) – pourcentage de caractères en lecture seule

  • suggestions (int) – nombre de chaînes avec suggestions

  • comments (int) – nombre de chaînes avec commentaires

  • name (string) – Nom de l’objet

  • url (string) – URL to access the object (if applicable)

  • url_translate (string) – URL to access the translation (if applicable)

  • code (string) – language code (if applicable)

Statistiques

GET /api/metrics/

Renvoie les métriques du serveur.

Modifié dans la version 5.6.1: Metrics can now be exposed in OpenMetrics compatible format with ?format=openmetrics.

Response JSON Object:
  • units (int) – Number of units

  • units_translated (int) – Number of translated units

  • users (int) – Number of users

  • changes (int) – Nombre de modifications

  • projects (int) – Nombre de projets

  • components (int) – Nombre de composants

  • translations (int) – Number of translations

  • languages (int) – Number of used languages

  • checks (int) – Number of triggered quality checks

  • configuration_errors (int) – Number of configuration errors

  • suggestions (int) – Number of pending suggestions

  • celery_queues (object) – Lengths of Celery queues, see Background tasks using Celery

  • name (string) – Nom du serveur configuré

Categories

GET /api/categories/

Ajouté dans la version 5.0.

Lists available categories. See GET /api/categories/(int:id)/ for field definitions.

POST /api/categories/

Ajouté dans la version 5.0.

Creates a new category. See GET /api/categories/(int:id)/ for field definitions.

GET /api/categories/(int: id)/

Ajouté dans la version 5.0.

Paramètres:
  • id (int) – Category ID

Response JSON Object:
  • name (str) – Name of category.

  • slug (str) – Slug of category.

  • project (str) – Lier un projet.

  • category (str) – Link to a parent category.

PATCH /api/categories/(int: id)/

Ajouté dans la version 5.0: Edit partial information about category.

param id:

Category ID

type id:

entier

>json object configuration:

Optional category configuration

PUT /api/categories/(int: id)/

Ajouté dans la version 5.0: Edit full information about category.

param id:

Category ID

type id:

entier

>json object configuration:

Optional category configuration

DELETE /api/categories/(int: id)/

Ajouté dans la version 5.0: Delete category.

param id:

Category ID

type id:

entier

GET /api/categories/(int: id)/statistics/

Ajouté dans la version 5.5.

Returns statistics for a category.

Paramètres:
  • project (int) – Category ID

Voir aussi

Returned attributes are described in Statistiques.

Déclencheurs de notification

Notification hooks allow external applications to notify Weblate that the VCS repository has been updated.

You can use repository endpoints for projects, components and translations to update individual repositories; see POST /api/projects/(string:project)/repository/ for documentation.

GET /hooks/update/(string: project)/(string: component)/

Obsolète depuis la version 2.6: Please use POST /api/components/(string:project)/(string:component)/repository/ instead which works properly with authentication for ACL limited projects.

Supprimé dans la version 5.14.

GET /hooks/update/(string: project)/

Obsolète depuis la version 2.6: Please use POST /api/projects/(string:project)/repository/ instead which works properly with authentication for ACL limited projects.

Supprimé dans la version 5.14.

POST /hooks/github/

Special hook for handling GitHub notifications and automatically updating matching components.

Note

GitHub includes direct support for notifying Weblate: enable Weblate service hook in repository settings and set the URL to the URL of your Weblate installation.

Voir aussi

Automatically receiving changes from GitHub

For instruction on setting up GitHub integration

https://docs.github.com/en/get-started/customizing-your-github-workflow/exploring-integrations/about-webhooks

Generic information about GitHub Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/gitlab/

Special hook for handling GitLab notifications and automatically updating matching components.

Voir aussi

Automatically receiving changes from GitLab

For instruction on setting up GitLab integration

https://docs.gitlab.com/user/project/integrations/webhooks/

Generic information about GitLab Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/bitbucket/

Special hook for handling Bitbucket notifications and automatically updating matching components.

Voir aussi

Automatically receiving changes from Bitbucket

For instruction on setting up Bitbucket integration

https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/

Generic information about Bitbucket Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/pagure/

Special hook for handling Pagure notifications and automatically updating matching components.

Voir aussi

Automatically receiving changes from Pagure

For instruction on setting up Pagure integration

https://docs.pagure.org/pagure/usage/using_webhooks.html

Generic information about Pagure Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/azure/

Special hook for handling Azure DevOps notifications and automatically updating matching components.

Note

Please ensure that Resource details to send is set to All, otherwise Weblate will not be able to match your Azure repository.

Voir aussi

Automatically receiving changes from Azure Repos

For instruction on setting up Azure integration

https://learn.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops

Generic information about Azure DevOps Web Hooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/gitea/

Special hook for handling Gitea Webhook notifications and automatically updating matching components.

Voir aussi

Automatically receiving changes from Gitea Repos

For instruction on setting up Gitea integration

https://docs.gitea.io/en-us/webhooks/

Generic information about Gitea Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/gitee/

Special hook for handling Gitee Webhook notifications and automatically updating matching components.

Voir aussi

Automatically receiving changes from Gitee Repos

For instruction on setting up Gitee integration

https://gitee.com/help/categories/40

Generic information about Gitee Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

Flux RSS

Les modifications des traductions sont exportées dans les flux RSS.

GET /exports/rss/(string: project)/(string: component)/(string: language)/

Flux RSS des dernières modifications d’une traduction.

GET /exports/rss/(string: project)/(string: component)/

Flux RSS des dernières modifications d’un composant.

GET /exports/rss/(string: project)/

Flux RSS des dernières modifications d’un projet.

GET /exports/rss/language/(string: language)/

Flux RSS des dernières modifications d’une langue.

GET /exports/rss/

Flux RSS des dernières modifications d’une instance Weblate.

Voir aussi

RSS on Wikipedia