Weblate’s REST API
Neu in Version 2.6: Die REST-API ist seit Weblate 2.6 verfügbar.
The API is accessible on the /api/
URL and it is based on
Django REST framework.
You can use it directly or by Weblate Client.
Authentication and generic parameters
The public project API is available without authentication, though
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.
- Query Parameters
format – Response format (overrides Accept). Possible values depends on REST framework setup, by default
json
andapi
are supported. The latter provides web browser interface for API.page – Gibt eine Seite mit paginierten Ergebnissen zurück (verwenden Sie die Felder next und previous in der Antwort, um die Navigation zu automatisieren).
- Request Headers
Authorization – optionales Token zur Authentifizierung als
Authorization: Token YOUR-TOKEN
- Response Headers
Content-Type – this depends on Accept header of request
Allow – list of allowed HTTP methods on object
- 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 API
web_url (string) – URL to access this resource using web browser
- Statuscodes
200 OK – wenn die Anfrage korrekt bearbeitet wurde
201 Created – wenn ein neues Objekt erfolgreich erstellt wurde
204 No Content – wenn ein Objekt erfolgreich gelöscht wurde
400 Bad Request – wenn Formularparameter fehlen
403 Forbidden – wenn der Zugriff verweigert wird
429 Too Many Requests – wenn die Drosselung in Kraft ist
Authentifizierungstoken
Geändert in Version 4.10: Projektspezifische Token wurden in der Version 4.10 eingeführt.
Each user has his 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.
Beispiele für die Authentifizierung
Beispielanfrage:
GET /api/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Authorization: Token YOUR-TOKEN
Beispielantwort:
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/"
}
CURL-Beispiel:
curl \
-H "Authorization: Token TOKEN" \
https://example.com/api/
Passing Parameters Examples
For the POST method the parameters can be specified either as form submission (application/x-www-form-urlencoded) or as JSON (application/json).
Formularanfrage-Beispiel:
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
JSON-Anfrage-Beispiel:
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"}
CURL-Beispiel:
curl \
-d operation=pull \
-H "Authorization: Token TOKEN" \
http://example.com/api/components/hello/weblate/repository/
CURL-JSON-Beispiel:
curl \
--data-binary '{"operation":"pull"}' \
-H "Content-Type: application/json" \
-H "Authorization: Token TOKEN" \
http://example.com/api/components/hello/weblate/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:
|
Rate limiting limit of requests to perform |
|
Remaining limit of requests |
|
Number of seconds until ratelimit window resets |
Geändert in Version 4.1: Added ratelimiting status headers.
API Entry Point
- GET /api/
The API root entry point.
Beispielanfrage:
GET /api/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript Authorization: Token YOUR-TOKEN
Beispielantwort:
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/" }
Benutzer
Neu in Version 4.0.
- GET /api/users/
Returns a list of users if you have permissions to see manage users. If not, then you get to see only your own details.
Siehe auch
Users object attributes are documented at
GET /api/users/(str:username)/
.
- POST /api/users/
Erstellt einen neuen Benutzer.
- Parameter
username (string) – Benutzername
full_name (string) – Vollständiger Name des Benutzers
email (string) – E-Mail-Adresse des Benutzers
is_superuser (boolean) – Ist der Benutzer Superuser? (Optional)
is_active (boolean) – Ist der Benutzer aktiv? (Optional)
is_bot (boolean) – Is user bot? (optional) (used for project scoped tokens)
- GET /api/users/(str: username)/
Gibt Informationen über Benutzer zurück.
- Parameter
username (string) – Name des Benutzers
- Response JSON Object
username (string) – Benutzernamen eines Benutzers
full_name (string) – Vollständiger Name eines Benutzers
email (string) – E-Mail-Adresse eines Benutzers
is_superuser (boolean) – Ob der Benutzer ein Superuser ist
is_active (boolean) – Ob der Benutzer aktiv ist
is_bot (boolean) – whether the user is bot (used for project scoped tokens)
date_joined (string) – Datum der Erstellung des Benutzers
groups (array) – link to associated groups; see
GET /api/groups/(int:id)/
Example JSON data:
{ "email": "user@example.com", "full_name": "Example User", "username": "exampleusername", "groups": [ "http://example.com/api/groups/2/", "http://example.com/api/groups/3/" ], "is_superuser": true, "is_active": true, "is_bot": false, "date_joined": "2020-03-29T18:42:42.617681Z", "url": "http://example.com/api/users/exampleusername/", "statistics_url": "http://example.com/api/users/exampleusername/statistics/" }
- PUT /api/users/(str: username)/
Ändert die Benutzerparameter.
- Parameter
username (string) – Name des Benutzers
- Response JSON Object
username (string) – Benutzernamen eines Benutzers
full_name (string) – Vollständiger Name eines Benutzers
email (string) – E-Mail-Adresse eines Benutzers
is_superuser (boolean) – Ob der Benutzer ein Superuser ist
is_active (boolean) – Ob der Benutzer aktiv ist
is_bot (boolean) – whether the user is bot (used for project scoped tokens)
date_joined (string) – Datum der Erstellung des Benutzers
- PATCH /api/users/(str: username)/
Ändert die Benutzerparameter.
- Parameter
username (string) – Name des Benutzers
- Response JSON Object
username (string) – Benutzernamen eines Benutzers
full_name (string) – Vollständiger Name eines Benutzers
email (string) – E-Mail-Adresse eines Benutzers
is_superuser (boolean) – Ob der Benutzer ein Superuser ist
is_active (boolean) – Ob der Benutzer aktiv ist
is_bot (boolean) – whether the user is bot (used for project scoped tokens)
date_joined (string) – Datum der Erstellung des Benutzers
- DELETE /api/users/(str: username)/
Löscht alle Benutzerinformationen und markiert den Benutzer als inaktiv.
- Parameter
username (string) – Name des Benutzers
- POST /api/users/(str: username)/groups/
Zuordnen von Gruppen zu einem Benutzer.
- Parameter
username (string) – Name des Benutzers
- Form Parameters
string group_id – Die eindeutige Gruppen-ID
- DELETE /api/users/(str: username)/groups/
Neu in Version 4.13.1.
Benutzer aus einer Gruppe entfernen.
- Parameter
username (string) – Name des Benutzers
- Form Parameters
string group_id – Die eindeutige Gruppen-ID
- GET /api/users/(str: username)/statistics/
Statistik eines Benutzers auflisten.
- Parameter
username (string) – Name des Benutzers
- Response JSON Object
translated (int) – Anzahl der Übersetzungen des Benutzers
suggested (int) – Anzahl der Vorschläge des Benutzers
uploaded (int) – Anzahl der Uploads des Benutzers
commented (int) – Anzahl der Kommentare des Benutzers
languages (int) – Anzahl der Sprachen, die der Benutzer übersetzen kann
- GET /api/users/(str: username)/notifications/
Liste der Abonnements eines Benutzers.
- Parameter
username (string) – Name des Benutzers
- POST /api/users/(str: username)/notifications/
Verknüpfen Sie Abonnements mit einem Benutzer.
- Parameter
username (string) – Name des Benutzers
- Request JSON Object
notification (string) – Name of notification registered
scope (int) – Scope of notification from the available choices
frequency (int) – Frequency choices for notifications
- GET /api/users/(str: username)/notifications/(int: subscription_id)/
Get a subscription associated with a user.
- Parameter
username (string) – Name des Benutzers
subscription_id (int) – ID der registrierten Benachrichtigung
- PUT /api/users/(str: username)/notifications/(int: subscription_id)/
Edit a subscription associated with a user.
- Parameter
username (string) – Name des Benutzers
subscription_id (int) – ID der registrierten Benachrichtigung
- Request JSON Object
notification (string) – Name of notification registered
scope (int) – Scope of notification from the available choices
frequency (int) – Frequency choices for notifications
- PATCH /api/users/(str: username)/notifications/(int: subscription_id)/
Edit a subscription associated with a user.
- Parameter
username (string) – Name des Benutzers
subscription_id (int) – ID der registrierten Benachrichtigung
- Request JSON Object
notification (string) – Name of notification registered
scope (int) – Scope of notification from the available choices
frequency (int) – Frequency choices for notifications
- DELETE /api/users/(str: username)/notifications/(int: subscription_id)/
Delete a subscription associated with a user.
- Parameter
username (string) – Name des Benutzers
subscription_id – Name of notification registered
subscription_id – int
Gruppen
Neu in 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.
Siehe auch
Group object attributes are documented at
GET /api/groups/(int:id)/
.
- POST /api/groups/
Erstellt eine neue Gruppe.
- Parameter
name (string) – Gruppenname
project_selection (int) – Group of project selection from given options
language_selection (int) – Group of languages selected from given options
defining_project (str) – link to the defining project, used for Verwaltung der Zugriffssteuerung nach Projekt; see
GET /api/projects/(string:project)/
- GET /api/groups/(int: id)/
Returns information about group.
- Parameter
id (int) – Group’s ID
- Response JSON Object
name (string) – Name einer Gruppe
project_selection (int) – integer corresponding to group of projects
language_selection (int) – integer corresponding to group of languages
roles (array) – link to associated roles; see
GET /api/roles/(int:id)/
projects (array) – link to associated projects; see
GET /api/projects/(string:project)/
components (array) – link to associated components; see
GET /api/components/(string:project)/(string:component)/
componentlists (array) – link to associated componentlist; see
GET /api/component-lists/(str:slug)/
defining_project (str) – link to the defining project, used for Verwaltung der Zugriffssteuerung nach Projekt; see
GET /api/projects/(string:project)/
Example JSON data:
{ "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/" ] }
- PUT /api/groups/(int: id)/
Changes the group parameters.
- Parameter
id (int) – Group’s ID
- Response JSON Object
name (string) – Name einer Gruppe
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.
- Parameter
id (int) – Group’s ID
- Response JSON Object
name (string) – Name einer Gruppe
project_selection (int) – integer corresponding to group of projects
language_selection (int) – integer corresponding to group of languages
- DELETE /api/groups/(int: id)/
Löscht die Gruppe.
- Parameter
id (int) – Group’s ID
- POST /api/groups/(int: id)/roles/
Zuordnen von Rollen zu einer Gruppe.
- Parameter
id (int) – Group’s ID
- Form Parameters
string role_id – Die eindeutige Rollen-ID
- POST /api/groups/(int: id)/components/
Associate components with a group.
- Parameter
id (int) – Group’s ID
- Form Parameters
string component_id – Die eindeutige Komponenten-ID
- DELETE /api/groups/(int: id)/components/(int: component_id)
Komponente aus einer Gruppe löschen.
- Parameter
id (int) – Group’s ID
component_id (int) – Die eindeutige Komponenten-ID
- POST /api/groups/(int: id)/projects/
Associate projects with a group.
- Parameter
id (int) – Group’s ID
- Form Parameters
string project_id – Die eindeutige Projekt-ID
- DELETE /api/groups/(int: id)/projects/(int: project_id)
Projekt aus einer Gruppe löschen.
- Parameter
id (int) – Group’s ID
project_id (int) – Die eindeutige Projekt-ID
- POST /api/groups/(int: id)/languages/
Associate languages with a group.
- Parameter
id (int) – Group’s ID
- Form Parameters
string language_code – Der eindeutige Sprachcode
- DELETE /api/groups/(int: id)/languages/(string: language_code)
Sprache aus einer Gruppe löschen.
- Parameter
id (int) – Group’s ID
language_code (string) – Der eindeutige Sprachcode
- POST /api/groups/(int: id)/componentlists/
Associate componentlists with a group.
- Parameter
id (int) – Group’s ID
- Form Parameters
string component_list_id – Die eindeutige Komponentenlisten-ID
- DELETE /api/groups/(int: id)/componentlists/(int: component_list_id)
Komponentenliste aus einer Gruppe löschen.
- Parameter
id (int) – Group’s ID
component_list_id (int) – Die eindeutige Komponentenlisten-ID
Rollen
- GET /api/roles/
Returns a list of all roles associated with user. If user is superuser, then list of all existing roles is returned.
Siehe auch
Roles object attributes are documented at
GET /api/roles/(int:id)/
.
- POST /api/roles/
Creates a new role.
- Parameter
name (string) – Role name
permissions (array) – List of codenames of permissions
- GET /api/roles/(int: id)/
Returns information about a role.
- Parameter
id (int) – Role ID
- Response JSON Object
name (string) – Role name
permissions (array) – list of codenames of permissions
Example JSON data:
{ "name": "Access repository", "permissions": [ "vcs.access", "vcs.view" ], "url": "http://example.com/api/roles/1/", }
- PUT /api/roles/(int: id)/
Changes the role parameters.
- Parameter
id (int) – Role’s ID
- Response JSON Object
name (string) – Role name
permissions (array) – list of codenames of permissions
- PATCH /api/roles/(int: id)/
Changes the role parameters.
- Parameter
id (int) – Role’s ID
- Response JSON Object
name (string) – Role name
permissions (array) – list of codenames of permissions
- DELETE /api/roles/(int: id)/
Deletes the role.
- Parameter
id (int) – Role’s ID
Sprachen
- GET /api/languages/
Returns a list of all languages.
Siehe auch
Language object attributes are documented at
GET /api/languages/(string:language)/
.
- POST /api/languages/
Creates a new language.
- Parameter
code (string) – Sprachenname
name (string) – Sprachenname
direction (string) – Leserichtung
population (int) – Anzahl der Sprecher
plural (object) – Language plural formula and number
- GET /api/languages/(string: language)/
Returns information about a language.
- Parameter
language (string) – Sprachkürzel
- Response JSON Object
code (string) – Sprachkürzel
direction (string) – Leserichtung
plural (object) – Object of language plural information
aliases (array) – Array of aliases for language
- Request JSON Object
population (int) – Anzahl der Sprecher
Example JSON data:
{ "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.
- Parameter
language (string) – Language’s code
- Request JSON Object
name (string) – Sprachenname
direction (string) – Leserichtung
population (int) – Anzahl der Sprecher
plural (object) – Language plural details
- PATCH /api/languages/(string: language)/
Changes the language parameters.
- Parameter
language (string) – Language’s code
- Request JSON Object
name (string) – Sprachenname
direction (string) – Leserichtung
population (int) – Anzahl der Sprecher
plural (object) – Language plural details
- DELETE /api/languages/(string: language)/
Löscht die Sprache.
- Parameter
language (string) – Language’s code
- GET /api/languages/(string: language)/statistics/
Returns statistics for a language.
- Parameter
language (string) – Sprachkürzel
- Response JSON Object
total (int) – total number of strings
total_words (int) – total number of words
last_change (timestamp) – last changes in the language
recent_changes (int) – total number of changes
translated (int) – number of translated strings
translated_percent (float) – percentage of translated strings
translated_words (int) – number of translated words
translated_words_percent (int) – percentage of translated words
translated_chars (int) – number of translated characters
translated_chars_percent (int) – percentage of translated characters
total_chars (int) – number of total characters
fuzzy (int) – Anzahl der fragwürdigen (zur Bearbeitung markierten) Zeichenfolgen
fuzzy_percent (int) – percentage of fuzzy (marked for edit) strings
failing (int) – number of failing strings
failing – percentage of failing strings
Projekte
- GET /api/projects/
Returns a list of all projects.
Siehe auch
Project object attributes are documented at
GET /api/projects/(string:project)/
.
- POST /api/projects/
Neu in Version 3.9.
Creates a new project.
- Parameter
name (string) – Projektname
slug (string) – Project slug
web (string) – Projektseite
- GET /api/projects/(string: project)/
Returns information about a project.
- Parameter
project (string) – Kurzer Projekt-URL
- Response JSON Object
name (string) – Projektname
slug (string) – project slug
web (string) – project website
components_list_url (string) – URL to components list; see
GET /api/projects/(string:project)/components/
repository_url (string) – URL to repository status; see
GET /api/projects/(string:project)/repository/
changes_list_url (string) – URL to changes list; see
GET /api/projects/(string:project)/changes/
translation_review (boolean) – Begutachtung aktivieren
source_review (boolean) – Quellenüberprüfung aktivieren
set_language_team (boolean) – Kopfzeile „Language-Team“ setzen
enable_hooks (boolean) – Hooks aktivieren
instructions (string) – Übersetzungsanweisungen
language_aliases (string) – Sprachaliasnamen
Example JSON data:
{ "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)/
Neu in Version 4.3.
Edit a project by a PATCH request.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- PUT /api/projects/(string: project)/
Neu in Version 4.3.
Edit a project by a PUT request.
- Parameter
project (string) – Kurzer Projekt-URL
- DELETE /api/projects/(string: project)/
Neu in Version 3.9.
Deletes a project.
- Parameter
project (string) – Kurzer Projekt-URL
- GET /api/projects/(string: project)/changes/
Returns a list of project changes. This is essentially a project scoped
GET /api/changes/
accepting same params.- Parameter
project (string) – Kurzer Projekt-URL
- Response JSON Object
results (array) – array of component objects; see
GET /api/changes/(int:id)/
- GET /api/projects/(string: project)/repository/
Returns information about 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/
.- Parameter
project (string) – Kurzer Projekt-URL
- 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
Example JSON data:
{ "needs_commit": true, "needs_merge": false, "needs_push": true }
- POST /api/projects/(string: project)/repository/
Performs given operation on the VCS repository.
- Parameter
project (string) – Kurzer Projekt-URL
- Request JSON Object
operation (string) – Operation to perform: one of
push
,pull
,commit
,reset
,cleanup
,file-sync
- Response JSON Object
result (boolean) – result of the operation
CURL-Beispiel:
curl \ -d operation=pull \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/repository/
JSON-Anfrage-Beispiel:
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.
- Parameter
project (string) – Kurzer Projekt-URL
- Response JSON Object
results (array) – array of component objects; see
GET /api/components/(string:project)/(string:component)/
- POST /api/projects/(string: project)/components/
Neu in Version 3.9.
Geändert in Version 4.3: The
zipfile
anddocfile
parameters are now accepted for VCS-less components, see Local files.Geändert in Version 4.6: The cloned repositories are now automatically shared within a project using Weblate internal URLs. Use
disable_autoshare
to turn off this.Creates translation components in the given project.
Hinweis
Use Weblate internal URLs when creating multiple components from a single VCS repository.
Bemerkung
Most of the component creation happens in the background. Check the
task_url
attribute of created component and follow the progress there.- Parameter
project (string) – Kurzer Projekt-URL
- Form Parameters
file zipfile – ZIP file to upload into Weblate for translations initialization
file docfile – Dokument zum Übersetzen
boolean disable_autoshare – Disables automatic repository sharing via Weblate internal URLs.
- Request JSON Object
object – Component parameters, see
GET /api/components/(string:project)/(string:component)/
- Response JSON Object
result (object) – Created component object; see
GET /api/components/(string:project)/(string:component)/
JSON can not be used when uploading the files using the
zipfile
anddocfile
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", "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", "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", "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.
Neu in Version 3.8.
- Parameter
project (string) – Kurzer Projekt-URL
- Response JSON Object
results (array) – array of translation statistics objects
language (string) – language name
code (string) – Sprachcode
total (int) – total number of strings
translated (int) – number of translated strings
translated_percent (float) – percentage of translated strings
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.
Neu in Version 3.8.
- Parameter
project (string) – Kurzer Projekt-URL
- Response JSON Object
total (int) – total number of strings
translated (int) – number of translated strings
translated_percent (float) – percentage of translated strings
total_words (int) – total number of words
translated_words (int) – number of translated words
words_percent (float) – percentage of translated words
Komponenten
Hinweis
Use POST /api/projects/(string:project)/components/
to create new components.
- GET /api/components/
Returns a list of translation components.
Siehe auch
Component object attributes are documented at
GET /api/components/(string:project)/(string:component)/
.
- GET /api/components/(string: project)/(string: component)/
Returns information about translation component.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Response JSON Object
project (object) – the translation project; see
GET /api/projects/(string:project)/
name (string) – Name der Komponente
slug (string) – Component slug
vcs (string) – Versionsverwaltung
repo (string) – Quellcode-Repository
git_export (string) – Exportierte Paketquelladresse
branch (string) – Repository-Zweig
push_branch (string) – Push Branch
filemask (string) – Dateimaske
template (string) – Einsprachige Basis-Sprachdatei
edit_template (string) – Basisdatei bearbeiten
intermediate (string) – Zwischensprachedatei
new_base (string) – Vorlage für neue Übersetzungen
file_format (string) – Dateiformat
license (string) – Lizenzierung der Übersetzung
agreement (string) – Mitwirkungsvereinbarung
new_lang (string) – Neue Übersetzung hinzufügen
language_code_style (string) – Stil des Sprachcodes
source_language (object) – source language object; see
GET /api/languages/(string:language)/
push (string) – Push-URL für Repository
check_flags (string) – Übersetzungsmarkierungen
priority (string) – Priorität
enforced_checks (string) – Erzwungene Qualitätsprüfungen
restricted (string) – Restricted access
repoweb (string) – Paketquellnavigator
report_source_bugs (string) – Adresse für Fehlerberichte bei Ausgangszeichenketten
merge_style (string) – Git-Strategie
commit_message (string) – Commit, add, delete, merge, add-on, and merge request messages
add_message (string) – Commit, add, delete, merge, add-on, and merge request messages
delete_message (string) – Commit, add, delete, merge, add-on, and merge request messages
merge_message (string) – Commit, add, delete, merge, add-on, and merge request messages
addon_message (string) – Commit, add, delete, merge, add-on, and merge request messages
pull_message (string) – Commit, add, delete, merge, add-on, and merge request messages
allow_translation_propagation (string) – Verbreitung von Übersetzungen erlauben
enable_suggestions (string) – Vorschläge aktivieren
suggestion_voting (string) – Abstimmen über Vorschläge
suggestion_autoaccept (string) – Vorschläge automatisch annehmen
push_on_commit (string) – Bei Commit gleichzeitig Pushen
commit_pending_age (string) – Alter der Änderungen, das erreicht sein muss, bevor ein Commit erfolgt
auto_lock_error (string) – Sperre bei Fehler
language_regex (string) – Sprachen-Filter
variant_regex (string) – Varianten regulärer Ausdruck
repository_url (string) – URL to repository status; see
GET /api/components/(string:project)/(string:component)/repository/
translations_url (string) – URL to translations list; see
GET /api/components/(string:project)/(string:component)/translations/
lock_url (string) – URL to lock status; see
GET /api/components/(string:project)/(string:component)/lock/
changes_list_url (string) – URL to changes list; see
GET /api/components/(string:project)/(string:component)/changes/
task_url (string) – URL to a background task (if any); see
GET /api/tasks/(str:uuid)/
Example JSON data:
{ "branch": "main", "file_format": "po", "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)/
Edit a component by a PATCH request.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
source_language (string) – Project source language code (optional)
- Request JSON Object
name (string) – name of component
slug (string) – slug of component
repo (string) – VCS repository URL
CURL-Beispiel:
curl \ --data-binary '{"name": "new name"}' \ -H "Content-Type: application/json" \ -H "Authorization: Token TOKEN" \ PATCH http://example.com/api/projects/hello/components/
JSON-Anfrage-Beispiel:
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", "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.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Request JSON Object
branch (string) – VCS repository branch
file_format (string) – file format of translations
filemask (string) – mask of translation files in the repository
name (string) – name of component
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) – Versionsverwaltung
- DELETE /api/components/(string: project)/(string: component)/
Neu in Version 3.9.
Deletes a component.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- 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.- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Response JSON Object
results (array) – array of component objects; see
GET /api/changes/(int:id)/
- GET /api/components/(string: project)/(string: component)/file/
Neu in Version 4.9.
Downloads all available translations associated with the component as an archive file using the requested format.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Query Parameters
format (string) – The archive format to use; If not specified, defaults to
zip
; Supported formats:zip
- GET /api/components/(string: project)/(string: component)/screenshots/
Gibt eine Liste von Komponenten-Bildschirmfotos zurück.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Response JSON Object
results (array) – Reihe von Komponenten-Bildschirmfotos; siehe
GET /api/screenshots/(int:id)/
- GET /api/components/(string: project)/(string: component)/lock/
Returns component lock status.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Response JSON Object
locked (boolean) – whether component is locked for updates
Example JSON data:
{ "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/
.- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Request JSON Object
lock – Boolean whether to lock or not.
CURL-Beispiel:
curl \ -d lock=true \ -H "Authorization: Token TOKEN" \ http://example.com/api/components/hello/weblate/repository/
JSON-Anfrage-Beispiel:
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 VCS repository status.
The response is same as for
GET /api/projects/(string:project)/repository/
.- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- 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.- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Request JSON Object
operation (string) – Operation to perform: one of
push
,pull
,commit
,reset
,cleanup
- Response JSON Object
result (boolean) – result of the operation
CURL-Beispiel:
curl \ -d operation=pull \ -H "Authorization: Token TOKEN" \ http://example.com/api/components/hello/weblate/repository/
JSON-Anfrage-Beispiel:
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.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- GET /api/components/(string: project)/(string: component)/new_template/
Downloads template file for new translations.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- GET /api/components/(string: project)/(string: component)/translations/
Returns a list of translation objects in the given component.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Response JSON Object
results (array) – array of translation objects; see
GET /api/translations/(string:project)/(string:component)/(string:language)/
- POST /api/components/(string: project)/(string: component)/translations/
Creates new translation in the given component.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Request JSON Object
language_code (string) – translation language code; see
GET /api/languages/(string:language)/
- Response JSON Object
result (object) – new translation object created
CURL-Beispiel:
curl \ -d language_code=cs \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
JSON-Anfrage-Beispiel:
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.
Neu in Version 2.7.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Response JSON Object
results (array) – array of translation statistics objects; see
GET /api/translations/(string:project)/(string:component)/(string:language)/statistics/
- GET /api/components/(string: project)/(string: component)/links/
Gibt Projekte zurück, die mit einer Komponente verknüpft sind.
Neu in Version 4.5.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Response JSON Object
projects (array) – associated projects; see
GET /api/projects/(string:project)/
- POST /api/components/(string: project)/(string: component)/links/
Projekt mit einer Komponente verknüpfen.
Neu in Version 4.5.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
- Form Parameters
string project_slug – Project slug
- DELETE /api/components/(string: project)/(string: component)/links/(string: project_slug)/
Aufhebung der Zuordnung eines Projekts zu einer Komponente.
Neu in Version 4.5.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
project_slug (string) – Slug des zu entfernenden Projekts
Übersetzungen
- GET /api/translations/
Returns a list of translations.
Siehe auch
Translation object attributes are documented at
GET /api/translations/(string:project)/(string:component)/(string:language)/
.
- GET /api/translations/(string: project)/(string: component)/(string: language)/
Returns information about a translation.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- Response JSON Object
component (object) – component object; see
GET /api/components/(string:project)/(string:component)/
failing_checks (int) – Anzahl der Zeichenketten, die nicht geprüft wurden
failing_checks_percent (float) – Prozentsatz der Zeichenketten, welche die Qualitätsprüfungen nicht bestanden haben
failing_checks_words (int) – Anzahl der Wörter mit nicht bestandener Qualitätsprüfungen
filename (string) – translation filename
fuzzy (int) – Anzahl der fragwürdigen (zur Bearbeitung markierten) Zeichenfolgen
fuzzy_percent (float) – percentage of fuzzy (marked for edit) strings
fuzzy_words (int) – number of words in fuzzy (marked for edit) strings
have_comment (int) – number of strings with comment
have_suggestion (int) – number of strings with suggestion
is_template (boolean) – ob die Übersetzung eine einsprachige Basis hat
language (object) – source language object; see
GET /api/languages/(string:language)/
language_code (string) – language code used in the repository; this can be different from language code in the language object
last_author (string) – name of last author
last_change (timestamp) – last change timestamp
revision (string) – revision hash for the file
share_url (string) – URL for sharing leading to engagement page
total (int) – total number of strings
total_words (int) – total number of words
translate_url (string) – URL for translating
translated (int) – number of translated strings
translated_percent (float) – percentage of translated strings
translated_words (int) – number of translated words
repository_url (string) – URL to repository status; see
GET /api/translations/(string:project)/(string:component)/(string:language)/repository/
file_url (string) – URL to file object; see
GET /api/translations/(string:project)/(string:component)/(string:language)/file/
changes_list_url (string) – URL to changes list; see
GET /api/translations/(string:project)/(string:component)/(string:language)/changes/
units_list_url (string) – URL to strings list; see
GET /api/translations/(string:project)/(string:component)/(string:language)/units/
Example JSON data:
{ "component": { "branch": "main", "file_format": "po", "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)/
Neu in Version 3.9.
Deletes a translation.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- 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.- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- Response JSON Object
results (array) – array of component objects; see
GET /api/changes/(int:id)/
- GET /api/translations/(string: project)/(string: component)/(string: language)/units/
Returns a list of translation units.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
q (string) – Search query string Searching (optional)
- Response JSON Object
results (array) – array of component objects; see
GET /api/units/(int:id)/
- POST /api/translations/(string: project)/(string: component)/(string: language)/units/
Neue Einheit hinzufügen.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- Request JSON Object
key (string) – Name of translation unit (used as key or context)
value (array) – Source strings (use single string if not creating plural)
- Response JSON Object
unit (object) – newly created unit; see
GET /api/units/(int:id)/
Siehe auch
- POST /api/translations/(string: project)/(string: component)/(string: language)/autotranslate/
Trigger automatic translation.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- Request JSON Object
mode (string) – Automatischer Übersetzungsmodus
filter_type (string) – Automatic translation filter type
auto_source (string) – Automatische Übersetzung -
mt
oderothers
component (string) – Aktivieren Sie den Beitrag zum gemeinsamen Übersetzungsspeicher für das Projekt, um Zugriff auf zusätzliche Komponenten zu erhalten.
engines (array) – Vorschläge aus automatischer Übersetzung
threshold (string) – Scoreschwellwert
- 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 Downloading translations).Bemerkung
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.- Query Parameters
format – File format to use; if not specified no format conversion happens; supported file formats:
po
,mo
,xliff
,xliff11
,tbx
,csv
,xlsx
,json
,aresource
,strings
q (string) – Filter downloaded strings, see Suche.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- POST /api/translations/(string: project)/(string: component)/(string: language)/file/
Upload new file with translations.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- Form Parameters
string conflicts – How to deal with conflicts (
ignore
,replace-translated
orreplace-approved
)file file – Uploaded file
string email – Autor-E-Mail
string author – Autor-Name
string method – Upload method (
translate
,approve
,suggest
,fuzzy
,replace
,source
,add
), see Import methodsstring fuzzy – Fuzzy (marked for edit) strings processing (empty,
process
,approve
)
CURL-Beispiel:
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 VCS repository status.
The response is same as for
GET /api/components/(string:project)/(string:component)/repository/
.- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- 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.- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- Request JSON Object
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.
Neu in Version 2.7.
- Parameter
project (string) – Kurzer Projekt-URL
component (string) – Kurzer Komponenten-URL
language (string) – Translation language code
- Response JSON Object
code (string) – Sprachcode
failing (int) – number of failing checks
failing_percent (float) – percentage of failing checks
fuzzy (int) – Anzahl der fragwürdigen (zur Bearbeitung markierten) Zeichenfolgen
fuzzy_percent (float) – percentage of fuzzy (marked for edit) strings
total_words (int) – total number of words
translated_words (int) – number of translated words
last_author (string) – name of last author
last_change (timestamp) – date of last change
name (string) – language name
total (int) – total number of strings
translated (int) – number of translated strings
translated_percent (float) – percentage of translated strings
url (string) – URL to access the translation (engagement URL)
url_translate (string) – URL to access the translation (real translation URL)
Speicher
Neu in Version 4.14.
- GET /api/memory/
Returns a list of memory results.
- DELETE /api/memory/(int: memory_object_id)/
Deletes a memory object
- Parameter
memory_object_id – Memory Object ID
Units
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 Toolkit and XLIFF.
Neu in Version 2.10.
- GET /api/units/
Returns list of translation units.
- Parameter
q (string) – Search query string Searching (optional)
Siehe auch
Unit object attributes are documented at
GET /api/units/(int:id)/
.
- GET /api/units/(int: id)/
Geändert in Version 4.3: The
target
andsource
are now arrays to properly handle plural strings.Returns information about translation unit.
- Parameter
id (int) – Unit ID
- Response JSON Object
translation (string) – URL of a related translation object
source (array) – Ausgangszeichenkette
previous_source (string) – previous source string used for fuzzy matching
target (array) – target string
id_hash (string) – unique identifier of the 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) – ob die Einheit fragwürdig oder zur Überprüfung markiert ist
translated (boolean) – ob die Einheit übersetzt wird
approved (boolean) – ob die Übersetzung genehmigt wird
position (int) – Position der Einheit in der Übersetzungsdatei
has_suggestion (boolean) – ob die Einheit Vorschläge hat
has_comment (boolean) – ob die Einheit Kommentare hat
has_failing_check (boolean) – ob die Einheit fehlerhafte Prüfungen aufweist
num_words (int) – Anzahl der Ausgangswörter
priority (int) – Übersetzungspriorität; 100 ist Standard
id (int) – Einheitenkennung
explanation (string) – String explanation, available on source units, see Additional info on source strings
extra_flags (string) – Additional string flags, available on source units, see Anpassen des Verhaltens mit Flaggen
web_url (string) – URL, unter der die Einheit bearbeitet werden kann
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
- PATCH /api/units/(int: id)/
Neu in Version 4.3.
Führt eine teilweise Aktualisierung der Übersetzungseinheit durch.
- Parameter
id (int) – Unit ID
- Request JSON Object
state (int) – unit state, 0 - untranslated, 10 - needs editing, 20 - translated, 30 - approved (need review workflow enabled, see Zugehörige Prüfer)
target (array) – target string
explanation (string) – String explanation, available on source units, see Additional info on source strings
extra_flags (string) – Additional string flags, available on source units, see Anpassen des Verhaltens mit Flaggen
- Response JSON Object
labels (array) – labels, available on source units
- PUT /api/units/(int: id)/
Neu in Version 4.3.
Führt ein vollständiges Update der Übersetzungseinheit durch.
- Parameter
id (int) – Unit ID
- Request JSON Object
state (int) – unit state, 0 - untranslated, 10 - needs editing, 20 - translated, 30 - approved (need review workflow enabled, see Zugehörige Prüfer)
target (array) – target string
explanation (string) – String explanation, available on source units, see Additional info on source strings
extra_flags (string) – Additional string flags, available on source units, see Anpassen des Verhaltens mit Flaggen
- Response JSON Object
labels (array) – labels, available on source units
- DELETE /api/units/(int: id)/
Neu in Version 4.3.
Löscht eine Übersetzungseinheit.
- Parameter
id (int) – Unit ID
Änderungen
Neu in Version 2.10.
- GET /api/changes/
Geändert in Version 4.1: Filtering of changes was introduced in the 4.1 release.
Returns a list of translation changes.
Siehe auch
Change object attributes are documented at
GET /api/changes/(int:id)/
.- Query Parameters
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)/
Returns information about translation change.
- Parameter
id (int) – Change ID
- Response JSON Object
unit (string) – URL eines zugehörigen Einheitenobjekts
translation (string) – URL of a related translation object
component (string) – URL eines zugehörigen Komponentenobjekts
user (string) – URL eines zugehörigen Benutzerobjekts
author (string) – URL eines zugehörigen Autorenobjekts
timestamp (timestamp) – Zeitstempel des Ereignisses
action (int) – numeric identification of action
action_name (string) – text description of action
target (string) – event changed text or detail
id (int) – change identifier
Bildschirmfotos
Neu in Version 2.14.
- GET /api/screenshots/
Returns a list of screenshot string information.
Siehe auch
Die Attribute von Bildschirmfoto-Objekten sind unter
GET /api/screenshots/(int:id)/
dokumentiert.
- GET /api/screenshots/(int: id)/
Gibt Informationen über Bildschirmfotos zurück.
- Parameter
id (int) – Bildschirmfoto-ID
- Response JSON Object
name (string) – Name eines Bildschirmfotos
component (string) – URL eines zugehörigen Komponentenobjekts
file_url (string) – URL zum Herunterladen einer Datei; siehe
GET /api/screenshots/(int:id)/file/
units (array) – link to associated source string information; see
GET /api/units/(int:id)/
- GET /api/screenshots/(int: id)/file/
Laden Sie das Bildschirmfoto herunter.
- Parameter
id (int) – Bildschirmfoto-ID
- POST /api/screenshots/(int: id)/file/
Ersetzen Sie das Bildschirmfoto.
- Parameter
id (int) – Bildschirmfoto-ID
- Form Parameters
file image – Uploaded file
CURL-Beispiel:
curl -X POST \ -F image=@image.png \ -H "Authorization: Token TOKEN" \ http://example.com/api/screenshots/1/file/
- POST /api/screenshots/(int: id)/units/
Verknüpfen Sie die Ausgangszeichenkette mit dem Bildschirmfoto.
- Parameter
id (int) – Bildschirmfoto-ID
- Form Parameters
string unit_id – Unit ID
- Response JSON Object
name (string) – Name eines Bildschirmfotos
translation (string) – URL of a related translation object
file_url (string) – URL zum Herunterladen einer Datei; siehe
GET /api/screenshots/(int:id)/file/
units (array) – link to associated source string information; see
GET /api/units/(int:id)/
- DELETE /api/screenshots/(int: id)/units/(int: unit_id)
Entfernen Sie die Verknüpfung der Ausgangszeichenkette mit dem Bildschirmfoto.
- Parameter
id (int) – Bildschirmfoto-ID
unit_id – Source string unit ID
- POST /api/screenshots/
Erzeugt ein neues Bildschirmfoto.
- Form Parameters
file image – Uploaded file
string name – Name des Bildschirmfotos
string project_slug – Project slug
string component_slug – Component slug
string language_code – Sprachkürzel
- Response JSON Object
name (string) – Name eines Bildschirmfotos
component (string) – URL eines zugehörigen Komponentenobjekts
file_url (string) – URL zum Herunterladen einer Datei; siehe
GET /api/screenshots/(int:id)/file/
units (array) – link to associated source string information; see
GET /api/units/(int:id)/
- PATCH /api/screenshots/(int: id)/
Teilinformationen zum Bildschirmfoto bearbeiten.
- Parameter
id (int) – Bildschirmfoto-ID
- Response JSON Object
name (string) – Name eines Bildschirmfotos
component (string) – URL eines zugehörigen Komponentenobjekts
file_url (string) – URL zum Herunterladen einer Datei; siehe
GET /api/screenshots/(int:id)/file/
units (array) – link to associated source string information; see
GET /api/units/(int:id)/
- PUT /api/screenshots/(int: id)/
Bearbeiten Sie alle Informationen zum Bildschirmfoto.
- Parameter
id (int) – Bildschirmfoto-ID
- Response JSON Object
name (string) – Name eines Bildschirmfotos
component (string) – URL eines zugehörigen Komponentenobjekts
file_url (string) – URL zum Herunterladen einer Datei; siehe
GET /api/screenshots/(int:id)/file/
units (array) – link to associated source string information; see
GET /api/units/(int:id)/
- DELETE /api/screenshots/(int: id)/
Bildschirmfoto löschen.
- Parameter
id (int) – Bildschirmfoto-ID
Erweiterungen
Neu in Version 4.4.1.
- GET /api/addons/
Gibt eine Liste der Erweiterungen aus.
Siehe auch
Add-on object attributes are documented at
GET /api/addons/(int:id)/
.
- GET /api/addons/(int: id)/
Returns information about add-on information.
- Parameter
id (int) – Erweiterungs-ID
- Response JSON Object
name (string) – name of an add-on
component (string) – URL eines zugehörigen Komponentenobjekts
configuration (object) – Optional add-on configuration
Siehe auch
- POST /api/components/(string: project)/(string: component)/addons/
Creates a new add-on.
- Parameter
project_slug (string) – Project slug
component_slug (string) – Component slug
- Request JSON Object
name (string) – name of an add-on
configuration (object) – Optional add-on configuration
- PATCH /api/addons/(int: id)/
Edit partial information about add-on.
- Parameter
id (int) – Erweiterungs-ID
- Response JSON Object
configuration (object) – Optional add-on configuration
- PUT /api/addons/(int: id)/
Edit full information about add-on.
- Parameter
id (int) – Erweiterungs-ID
- Response JSON Object
configuration (object) – Optional add-on configuration
- DELETE /api/addons/(int: id)/
Delete add-on.
- Parameter
id (int) – Erweiterungs-ID
Komponentenlisten
Neu in Version 4.0.
- GET /api/component-lists/
Returns a list of component lists.
Siehe auch
Component list object attributes are documented at
GET /api/component-lists/(str:slug)/
.
- GET /api/component-lists/(str: slug)/
Returns information about component list.
- Parameter
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.
- Parameter
slug (string) – Component list slug
- Request 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
- PATCH /api/component-lists/(str: slug)/
Changes the component list parameters.
- Parameter
slug (string) – Component list slug
- Request 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
- DELETE /api/component-lists/(str: slug)/
Deletes the component list.
- Parameter
slug (string) – Component list slug
- POST /api/component-lists/(str: slug)/components/
Associate component with a component list.
- Parameter
slug (string) – Component list slug
- Form Parameters
string component_id – Component ID
- DELETE /api/component-lists/(str: slug)/components/(str: component_slug)
Disassociate a component from the component list.
- Parameter
slug (string) – Component list slug
component_slug (string) – Component slug
Glossar
Geändert in Version 4.5: Glossaries are now stored as regular components, translations and strings, please use respective API instead.
Tasks
Neu in Version 4.4.
- GET /api/tasks/
Eine Auflistung der Aufgaben ist derzeit nicht verfügbar.
- GET /api/tasks/(str: uuid)/
Gibt Informationen über eine Aufgabe zurück
- Parameter
uuid (string) – Task UUID
- Response JSON Object
completed (boolean) – ob die Aufgabe abgeschlossen ist
progress (int) – Task progress in percent
result (object) – Task result or progress details
log (string) – Aufgabenprotokoll
Metrics
- GET /api/metrics/
Returns server metrics.
- Response JSON Object
units (int) – Anzahl der Einheiten
units_translated (int) – Anzahl der übersetzten Einheiten
users (int) – Anzahl der Benutzer
changes (int) – Anzahl der Änderungen
projects (int) – Anzahl der Projekte
components (int) – Gleiche Pluralformen
translations (int) – Anzahl der Übersetzungen
languages (int) – Anzahl der verwendeten Sprachen
checks (int) – Anzahl der ausgelösten Qualitätsprüfungen
configuration_errors (int) – Anzahl der Konfigurationsfehler
suggestions (int) – Anzahl der ausstehenden Übersetzungsvorschläge
celery_queues (object) – Lengths of Celery queues, see Background tasks using Celery
name (string) – Konfigurierter Servername
Benachrichtigungs-Hooks
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)/
Veraltet ab Version 2.6: Please use
POST /api/components/(string:project)/(string:component)/repository/
instead which works properly with authentication for ACL limited projects.Triggers update of a component (pulling from VCS and scanning for translation changes).
- GET /hooks/update/(string: project)/
Veraltet ab Version 2.6: Please use
POST /api/projects/(string:project)/repository/
instead which works properly with authentication for ACL limited projects.Triggers update of all components in a project (pulling from VCS and scanning for translation changes).
- POST /hooks/github/
Special hook for handling GitHub notifications and automatically updating matching components.
Bemerkung
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.
Siehe auch
- Automatically receiving changes from GitHub
Für Anweisungen zur Einrichtung der GitHub-Integration
- https://docs.github.com/en/get-started/customizing-your-github-workflow/exploring-integrations/about-webhooks
Allgemeine Informationen zu GitHub-Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/gitlab/
Special hook for handling GitLab notifications and automatically updating matching components.
Siehe auch
- Automatically receiving changes from GitLab
Für Anweisungen zur Einrichtung der GitLab-Integration
- https://docs.gitlab.com/ee/user/project/integrations/webhooks.html
Allgemeine Informationen zu GitLab-Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/bitbucket/
Special hook for handling Bitbucket notifications and automatically updating matching components.
Siehe auch
- Automatically receiving changes from Bitbucket
Für Anweisungen zur Einrichtung der Bitbucket-Integration
- https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/
Allgemeine Informationen zu Bitbucket-Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/pagure/
Neu in Version 3.3.
Special hook for handling Pagure notifications and automatically updating matching components.
Siehe auch
- Automatically receiving changes from Pagure
Für Anweisungen zur Einrichtung der Pagure-Integration
- https://docs.pagure.org/pagure/usage/using_webhooks.html
Allgemeine Informationen zu Pagure-Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/azure/
Neu in Version 3.8.
Special hook for handling Azure DevOps notifications and automatically updating matching components.
Bemerkung
Please make sure that Resource details to send is set to All, otherwise Weblate will not be able to match your Azure repository.
Siehe auch
- Automatically receiving changes from Azure Repos
Für Anweisungen zur Einrichtung der 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/
Neu in Version 3.9.
Special hook for handling Gitea Webhook notifications and automatically updating matching components.
Siehe auch
- Automatically receiving changes from Gitea Repos
Für Anweisungen zur Einrichtung der Gitea-Integration
- https://docs.gitea.io/en-us/webhooks/
Allgemeine Informationen zu Gitea-Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/gitee/
Neu in Version 3.9.
Special hook for handling Gitee Webhook notifications and automatically updating matching components.
Siehe auch
- Automatically receiving changes from Gitee Repos
Für Anweisungen zur Einrichtung der Gitee-Integration
- https://gitee.com/help/categories/40
Allgemeine Informationen zu Gitee-Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
Exports
Weblate provides various exports to allow you to further process the data.
- GET /exports/stats/(string: project)/(string: component)/
- Query Parameters
format (string) – Output format: either
json
orcsv
Veraltet ab Version 2.6: Please use
GET /api/components/(string:project)/(string:component)/statistics/
andGET /api/translations/(string:project)/(string:component)/(string:language)/statistics/
instead; it allows access to ACL controlled projects as well.Retrieves statistics for given component in given format.
Beispielanfrage:
GET /exports/stats/weblate/main/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript
Beispielantwort:
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json [ { "code": "cs", "failing": 0, "failing_percent": 0.0, "fuzzy": 0, "fuzzy_percent": 0.0, "last_author": "Michal Čihař", "last_change": "2012-03-28T15:07:38+00:00", "name": "Czech", "total": 436, "total_words": 15271, "translated": 436, "translated_percent": 100.0, "translated_words": 3201, "url": "http://hosted.weblate.org/engage/weblate/cs/", "url_translate": "http://hosted.weblate.org/projects/weblate/main/cs/" }, { "code": "nl", "failing": 21, "failing_percent": 4.8, "fuzzy": 11, "fuzzy_percent": 2.5, "last_author": null, "last_change": null, "name": "Dutch", "total": 436, "total_words": 15271, "translated": 319, "translated_percent": 73.2, "translated_words": 3201, "url": "http://hosted.weblate.org/engage/weblate/nl/", "url_translate": "http://hosted.weblate.org/projects/weblate/main/nl/" }, { "code": "el", "failing": 11, "failing_percent": 2.5, "fuzzy": 21, "fuzzy_percent": 4.8, "last_author": null, "last_change": null, "name": "Greek", "total": 436, "total_words": 15271, "translated": 312, "translated_percent": 71.6, "translated_words": 3201, "url": "http://hosted.weblate.org/engage/weblate/el/", "url_translate": "http://hosted.weblate.org/projects/weblate/main/el/" } ]
RSS-Feeds
Änderungen an Übersetzungen werden in RSS-Feeds exportiert.
- GET /exports/rss/(string: project)/(string: component)/(string: language)/
Ruft den RSS-Feed mit den letzten Änderungen für eine Übersetzung ab.
- GET /exports/rss/(string: project)/(string: component)/
Ruft den RSS-Feed mit den letzten Änderungen für eine Komponente ab.
- GET /exports/rss/(string: project)/
Ruft den RSS-Feed mit den letzten Änderungen für ein Projekt ab.
- GET /exports/rss/language/(string: language)/
Ruft den RSS-Feed mit den letzten Änderungen für eine Sprache ab.
- GET /exports/rss/
Ruft den RSS-Feed mit den letzten Änderungen für die Weblate-Instanz ab.
Siehe auch