REST API Weblate
Nowe w wersji 2.6: The REST API is available since Weblate 2.6.
The API is accessible on the /api/
URL and it is based on
Django REST framework.
You can use it directly or by Klient Weblate.
Uwierzytelnianie i parametry ogólne
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.
- Parametry zapytania
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 – Returns given page of paginated results (use next and previous fields in response to automate the navigation).
- Nagłówki żądań
Authorization – opcjonalny token do uwierzytelniania jako
Authorization: Token TWÓJ-TOKEN
- Nagłówki odpowiedzi
Content-Type – this depends on Accept header of request
Allow – list of allowed HTTP methods on object
- Odpowiedź Obiekt JSON
detail (string) – pełny opis wyniku (dla kodów statusu HTTP innych niż 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) – wyniki dla list obiektów
url (string) – URL to access this resource using API
web_url (string) – URL to access this resource using web browser
- Kody stanu
200 OK – gdy żądanie zostało poprawnie obsłużone
201 Created – gdy nowy obiekt został pomyślnie utworzony
204 No Content – gdy obiekt został pomyślnie usunięty
400 Bad Request – gdy brakuje parametrów formularza
403 Forbidden – gdy odmowa dostępu
429 Too Many Requests – when throttling is in place
Przykłady uwierzytelniania
Przykładowe żądanie:
GET /api/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Authorization: Token YOUR-TOKEN
Przykładowa odpowiedź:
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/"
}
Przykład CURL:
curl \
-H "Authorization: Token TOKEN" \
https://example.com/api/
Przykłady przekazywania parametrów
For the POST method the parameters can be specified either as form submission (application/x-www-form-urlencoded) or as JSON (application/json).
Przykład żądania formularza:
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
Przykład żądania 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"}
Przykład CURL:
curl \
-d operation=pull \
-H "Authorization: Token TOKEN" \
http://example.com/api/components/hello/weblate/repository/
Przykład JSON w CURL:
curl \
--data-binary '{"operation":"pull"}' \
-H "Content-Type: application/json" \
-H "Authorization: Token TOKEN" \
http://example.com/api/components/hello/weblate/repository/
Ograniczanie szybkości interfejsu API
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.
The status of rate limiting is reported in following headers:
|
Rate limiting limit of requests to perform |
|
Pozostały limit żądań |
|
Number of seconds until ratelimit window resets |
Zmienione w wersji 4.1: Dodano nagłówki statusu ograniczenia szybkości.
Zobacz także
Punkt wejścia interfejsu API
- GET /api/
The API root entry point.
Przykładowe żądanie:
GET /api/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript Authorization: Token YOUR-TOKEN
Przykładowa odpowiedź:
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/" }
Użytkownicy
Nowe w wersji 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.
Zobacz także
Users object attributes are documented at
GET /api/users/(str:username)/
.
- POST /api/users/
Utwórz nowego użytkownika.
- Parametry
username (string) – Nazwa użytkownika
full_name (string) – Pełna nazwa użytkownika
email (string) – E-mail użytkownika
is_superuser (boolean) – Czy użytkownik jest superużytkownikiem? (opcjonalnie)
is_active (boolean) – Czy użytkownik jest aktywny? (opcjonalnie)
- GET /api/users/(str: username)/
Zwraca informacje o użytkownikach.
- Parametry
username (string) – Nazwa użytkownika
- Odpowiedź Obiekt JSON
username (string) – nazwa użytkownika
full_name (string) – pełna nazwa użytkownika
email (string) – e-mail użytkownika
is_superuser (boolean) – whether the user is a super user
is_active (boolean) – czy użytkownik jest aktywny
date_joined (string) – data utworzenia użytkownika
groups (array) – link to associated groups; see
GET /api/groups/(int:id)/
Przykładowe dane JSON:
{ "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, "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)/
Zmienia parametry użytkownika.
- Parametry
username (string) – Nazwa użytkownika
- Odpowiedź Obiekt JSON
username (string) – nazwa użytkownika
full_name (string) – pełna nazwa użytkownika
email (string) – e-mail użytkownika
is_superuser (boolean) – whether the user is a super user
is_active (boolean) – czy użytkownik jest aktywny
date_joined (string) – data utworzenia użytkownika
- PATCH /api/users/(str: username)/
Zmienia parametry użytkownika.
- Parametry
username (string) – Nazwa użytkownika
- Odpowiedź Obiekt JSON
username (string) – nazwa użytkownika
full_name (string) – pełna nazwa użytkownika
email (string) – e-mail użytkownika
is_superuser (boolean) – whether the user is a super user
is_active (boolean) – czy użytkownik jest aktywny
date_joined (string) – data utworzenia użytkownika
- DELETE /api/users/(str: username)/
Deletes all user information and marks the user inactive.
- Parametry
username (string) – Nazwa użytkownika
- POST /api/users/(str: username)/groups/
Powiąż grupy z użytkownikiem.
- Parametry
username (string) – Nazwa użytkownika
- Parametry formularza
string group_id – Unikalny identyfikator grupy
- GET /api/users/(str: username)/statistics/
List statistics of a user.
- Parametry
username (string) – Nazwa użytkownika
- Odpowiedź Obiekt JSON
translated (int) – Liczba tłumaczeń według użytkownika
suggested (int) – Liczba sugestii według użytkownika
uploaded (int) – Liczba przesłańedług użytkownika
commented (int) – Liczba komentarzy wedługużytkownika
languages (int) – Liczba języków, które użytkownik może przetłumaczyć
- GET /api/users/(str: username)/notifications/
Wyświetl listę subskrypcji użytkownika.
- Parametry
username (string) – Nazwa użytkownika
- POST /api/users/(str: username)/notifications/
Powiąż subskrypcje z użytkownikiem.
- Parametry
username (string) – Nazwa użytkownika
- Żądanie obiektu JSON
notification (string) – Nazwa zarejestrowanego powiadomienia
scope (int) – Scope of notification from the available choices
frequency (int) – Wybór częstotliwości powiadomień
- GET /api/users/(str: username)/notifications/(int: subscription_id)/
Get a subscription associated with a user.
- Parametry
username (string) – Nazwa użytkownika
subscription_id (int) – ID zarejestrowanego powiadomienia
- PUT /api/users/(str: username)/notifications/(int: subscription_id)/
Edit a subscription associated with a user.
- Parametry
username (string) – Nazwa użytkownika
subscription_id (int) – ID zarejestrowanego powiadomienia
- Żądanie obiektu JSON
notification (string) – Nazwa zarejestrowanego powiadomienia
scope (int) – Scope of notification from the available choices
frequency (int) – Wybór częstotliwości powiadomień
- PATCH /api/users/(str: username)/notifications/(int: subscription_id)/
Edit a subscription associated with a user.
- Parametry
username (string) – Nazwa użytkownika
subscription_id (int) – ID zarejestrowanego powiadomienia
- Żądanie obiektu JSON
notification (string) – Nazwa zarejestrowanego powiadomienia
scope (int) – Scope of notification from the available choices
frequency (int) – Wybór częstotliwości powiadomień
- DELETE /api/users/(str: username)/notifications/(int: subscription_id)/
Delete a subscription associated with a user.
- Parametry
username (string) – Nazwa użytkownika
subscription_id – Nazwa zarejestrowanego powiadomienia
subscription_id – int
Grupy
Nowe w wersji 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.
Zobacz także
Group object attributes are documented at
GET /api/groups/(int:id)/
.
- POST /api/groups/
Tworzy nową grupę.
- Parametry
name (string) – Nazwa grupy
project_selection (int) – Group of project selection from given options
language_selection (int) – Group of languages selected from given options
- GET /api/groups/(int: id)/
Zwraca informacje o grupie.
- Parametry
id (int) – Identyfikator grupy
- Odpowiedź Obiekt JSON
name (string) – nazwa grupy
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)/
componentlist (array) – link to associated componentlist; see
GET /api/component-lists/(str:slug)/
Przykładowe dane JSON:
{ "name": "Guests", "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)/
Zmienia parametry grupy.
- Parametry
id (int) – Identyfikator grupy
- Odpowiedź Obiekt JSON
name (string) – nazwa grupy
project_selection (int) – integer corresponding to group of projects
language_selection (int) – integer corresponding to group of Languages
- PATCH /api/groups/(int: id)/
Zmienia parametry grupy.
- Parametry
id (int) – Identyfikator grupy
- Odpowiedź Obiekt JSON
name (string) – nazwa grupy
project_selection (int) – integer corresponding to group of projects
language_selection (int) – integer corresponding to group of languages
- DELETE /api/groups/(int: id)/
Usuwa grupę.
- Parametry
id (int) – Identyfikator grupy
- POST /api/groups/(int: id)/roles/
Powiąż role z grupą.
- Parametry
id (int) – Identyfikator grupy
- Parametry formularza
string role_id – Unikatowy identyfikator roli
- POST /api/groups/(int: id)/components/
Powiąż komponenty z grupą.
- Parametry
id (int) – Identyfikator grupy
- Parametry formularza
string component_id – Unikatowy identyfikator komponentu
- DELETE /api/groups/(int: id)/components/(int: component_id)
Usuń komponent z grupy.
- Parametry
id (int) – Identyfikator grupy
component_id (int) – Unikatowy identyfikator komponentu
- POST /api/groups/(int: id)/projects/
Powiąż projekty z grupą.
- Parametry
id (int) – Identyfikator grupy
- Parametry formularza
string project_id – Unikalny identyfikator projektu
- DELETE /api/groups/(int: id)/projects/(int: project_id)
Usuń projekt z grupy.
- Parametry
id (int) – Identyfikator grupy
project_id (int) – Unikalny identyfikator projektu
- POST /api/groups/(int: id)/languages/
Powiąż języki z grupą.
- Parametry
id (int) – Identyfikator grupy
- Parametry formularza
string language_code – Unikatowy kod języka
- DELETE /api/groups/(int: id)/languages/(string: language_code)
Usuń język z grupy.
- Parametry
id (int) – Identyfikator grupy
language_code (string) – Unikatowy kod języka
- POST /api/groups/(int: id)/componentlists/
Powiąż listy komponentów z grupą.
- Parametry
id (int) – Identyfikator grupy
- Parametry formularza
string component_list_id – Unikatowy identyfikator listy komponentów
- DELETE /api/groups/(int: id)/componentlists/(int: component_list_id)
Usuń listę komponentów z grupy.
- Parametry
id (int) – Identyfikator grupy
component_list_id (int) – Unikatowy identyfikator listy komponentów
Role
- GET /api/roles/
Returns a list of all roles associated with user. If user is superuser, then list of all existing roles is returned.
Zobacz także
Roles object attributes are documented at
GET /api/roles/(int:id)/
.
- POST /api/roles/
Tworzy nową rolę.
- Parametry
name (string) – Nazwa roli
permissions (array) – List of codenames of permissions
- GET /api/roles/(int: id)/
Zwraca informacje o roli.
- Parametry
id (int) – Identyfikator roli
- Odpowiedź Obiekt JSON
name (string) – Nazwa roli
permissions (array) – list of codenames of permissions
Przykładowe dane JSON:
{ "name": "Access repository", "permissions": [ "vcs.access", "vcs.view" ], "url": "http://example.com/api/roles/1/", }
- PUT /api/roles/(int: id)/
Zmienia parametry roli.
- Parametry
id (int) – Identyfikator roli
- Odpowiedź Obiekt JSON
name (string) – Nazwa roli
permissions (array) – list of codenames of permissions
- PATCH /api/roles/(int: id)/
Zmienia parametry roli.
- Parametry
id (int) – Identyfikator roli
- Odpowiedź Obiekt JSON
name (string) – Nazwa roli
permissions (array) – list of codenames of permissions
- DELETE /api/roles/(int: id)/
Usuwa rolę.
- Parametry
id (int) – Identyfikator roli
Języki
- GET /api/languages/
Returns a list of all languages.
Zobacz także
Language object attributes are documented at
GET /api/languages/(string:language)/
.
- POST /api/languages/
Tworzy nowy język.
- Parametry
code (string) – Nazwa języka
name (string) – Nazwa języka
direction (string) – Kierunek tekstu
plural (object) – Language plural formula and number
- GET /api/languages/(string: language)/
Zwraca informacje o języku.
- Parametry
language (string) – Kod języka
- Odpowiedź Obiekt JSON
code (string) – Kod języka
direction (string) – Kierunek tekstu
plural (object) – Object of language plural information
aliases (array) – Tablica aliasów dla języka
Przykładowe dane JSON:
{ "code": "en", "direction": "ltr", "name": "English", "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)/
Zmienia parametry języka.
- Parametry
language (string) – Kod języka
- Żądanie obiektu JSON
name (string) – Nazwa języka
direction (string) – Kierunek tekstu
plural (object) – Szczegóły dotyczące liczby mnogiej w języku
- PATCH /api/languages/(string: language)/
Zmienia parametry języka.
- Parametry
language (string) – Kod języka
- Żądanie obiektu JSON
name (string) – Nazwa języka
direction (string) – Kierunek tekstu
plural (object) – Szczegóły dotyczące liczby mnogiej w języku
- DELETE /api/languages/(string: language)/
Usuwa język.
- Parametry
language (string) – Kod języka
- GET /api/languages/(string: language)/statistics/
Zwraca statystyki dla języka.
- Parametry
language (string) – Kod języka
- Odpowiedź Obiekt JSON
total (int) – całkowita liczba ciągów
total_words (int) – całkowita liczba słów
last_change (timestamp) – ostatnie zmiany w języku
recent_changes (int) – całkowita liczba zmian
translated (int) – liczba przetłumaczonych ciągów tekstowych
translated_percent (float) – procent przetłumaczonych ciągów
translated_words (int) – liczba przetłumaczonych słów
translated_words_percent (int) – procent przetłumaczonych słów
translated_chars (int) – liczba przetłumaczonych znaków
translated_chars_percent (int) – procent przetłumaczonych znaków
total_chars (int) – liczba całkowitych znaków
fuzzy (int) – liczba rozmytych (zaznaczonych do edycji) ciągów
fuzzy_percent (int) – percentage of fuzzy (marked for edit) strings
failing (int) – number of failing strings
failing – percentage of failing strings
Projekty
- GET /api/projects/
Returns a list of all projects.
Zobacz także
Project object attributes are documented at
GET /api/projects/(string:project)/
.
- POST /api/projects/
Nowe w wersji 3.9.
Tworzy nowy projekt.
- Parametry
name (string) – Nazwa projektu
slug (string) – Końcówka adresu URL projektu
web (string) – Strona internetowa projektu
- GET /api/projects/(string: project)/
Zwraca informacje o projekcie.
- Parametry
project (string) – Końcówka adresu URL projektu
- Odpowiedź Obiekt JSON
name (string) – nazwa projektu
slug (string) – końcówka adresu URL projektu
web (string) – strona internetowa projektu
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) – Włącz recenzje
source_review (boolean) – Włącz recenzje źródła
set_language_team (boolean) – Ustaw nagłówek „Zespół Tłumaczy”
enable_hooks (boolean) – Włącz hooki
instructions (string) – Instrukcje tłumaczenia
language_aliases (string) – Aliasy językowe
Przykładowe dane 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)/
Nowe w wersji 4.3.
Edit a project by a PATCH request.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- PUT /api/projects/(string: project)/
Nowe w wersji 4.3.
Edit a project by a PUT request.
- Parametry
project (string) – Końcówka adresu URL projektu
- DELETE /api/projects/(string: project)/
Nowe w wersji 3.9.
Usuwa projekt.
- Parametry
project (string) – Końcówka adresu URL projektu
- GET /api/projects/(string: project)/changes/
Returns a list of project changes. This is essentially a project scoped
GET /api/changes/
accepting same params.- Parametry
project (string) – Końcówka adresu URL projektu
- Odpowiedź Obiekt JSON
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/
.- Parametry
project (string) – Końcówka adresu URL projektu
- Odpowiedź Obiekt JSON
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
Przykładowe dane JSON:
{ "needs_commit": true, "needs_merge": false, "needs_push": true }
- POST /api/projects/(string: project)/repository/
Performs given operation on the VCS repository.
- Parametry
project (string) – Końcówka adresu URL projektu
- Żądanie obiektu JSON
operation (string) – Operation to perform: one of
push
,pull
,commit
,reset
,cleanup
,file-sync
- Odpowiedź Obiekt JSON
result (boolean) – wynik operacji
Przykład CURL:
curl \ -d operation=pull \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/repository/
Przykład żądania 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"}
Przykład odpowiedzi JSON:
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.
- Parametry
project (string) – Końcówka adresu URL projektu
- Odpowiedź Obiekt JSON
results (array) – array of component objects; see
GET /api/components/(string:project)/(string:component)/
- POST /api/projects/(string: project)/components/
Nowe w wersji 3.9.
Zmienione w wersji 4.3: The
zipfile
anddocfile
parameters are now accepted for VCS-less components, see Pliki lokalne.Zmienione w wersji 4.6: The cloned repositories are now automatically shared within a project using Wewnętrzne adresy URL Weblate. Use
disable_autoshare
to turn off this.Creates translation components in the given project.
Podpowiedź
Use Wewnętrzne adresy URL Weblate when creating multiple components from a single VCS repository.
Informacja
Most of the component creation happens in the background. Check the
task_url
attribute of created component and follow the progress there.- Parametry
project (string) – Końcówka adresu URL projektu
- Parametry formularza
file zipfile – ZIP file to upload into Weblate for translations initialization
file docfile – Dokument do przetłumaczenia
boolean disable_autoshare – Disables automatic repository sharing via Wewnętrzne adresy URL Weblate.
- Odpowiedź Obiekt JSON
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.Przykład żądania formularza w CURL:
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/
Przykład żądania JSON w CURL:
curl \ --data-binary '{ "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "slug": "weblate", "repo": "file:///home/nijel/work/weblate-hello", "template": "", "new_base": "", "vcs": "git" }' \ -H "Content-Type: application/json" \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
Przykład żądania 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 { "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "slug": "weblate", "repo": "file:///home/nijel/work/weblate-hello", "template": "", "new_base": "", "vcs": "git" }
Przykład odpowiedzi JSON:
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", "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.
Nowe w wersji 3.8.
- Parametry
project (string) – Końcówka adresu URL projektu
- Odpowiedź Obiekt JSON
results (array) – tablica obiektów statystyk tłumaczenia
language (string) – nazwa języka
code (string) – kod języka
total (int) – całkowita liczba ciągów
translated (int) – liczba przetłumaczonych ciągów tekstowych
translated_percent (float) – procent przetłumaczonych ciągów
total_words (int) – całkowita liczba słów
translated_words (int) – liczba przetłumaczonych słów
words_percent (float) – procent przetłumaczonych słów
- GET /api/projects/(string: project)/statistics/
Zwraca statystyki dla projektu.
Nowe w wersji 3.8.
- Parametry
project (string) – Końcówka adresu URL projektu
- Odpowiedź Obiekt JSON
total (int) – całkowita liczba ciągów
translated (int) – liczba przetłumaczonych ciągów tekstowych
translated_percent (float) – procent przetłumaczonych ciągów
total_words (int) – całkowita liczba słów
translated_words (int) – liczba przetłumaczonych słów
words_percent (float) – procent przetłumaczonych słów
Komponenty
- GET /api/components/
Returns a list of translation components.
Zobacz także
Component object attributes are documented at
GET /api/components/(string:project)/(string:component)/
.
- GET /api/components/(string: project)/(string: component)/
Zwraca informacje o komponencie tłumaczenia.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Odpowiedź Obiekt JSON
project (object) – the translation project; see
GET /api/projects/(string:project)/
name (string) – Nazwa komponentu
slug (string) – Końcówka adresu URL komponentu
vcs (string) – System kontroli wersji
repo (string) – Repozytorium kodu źródłowego
git_export (string) – URL repozytorium eksportu
branch (string) – Gałąź repozytorium
push_branch (string) – Wypchnij gałąź
filemask (string) – Maska pliku
template (string) – Jednojęzyczny bazowy plik języka
edit_template (string) – Edytuj plik szablonu
intermediate (string) – Plik języka pośredniego
new_base (string) – Szablon dla nowych tłumaczeń
file_format (string) – Format pliku
license (string) – Licencja tłumaczenia
agreement (string) – Zgoda współpracownika
new_lang (string) – Dodawanie nowego tłumaczenia
language_code_style (string) – Styl kodu języka
source_language (object) – obiekt języka źródłowego; zobacz
GET /api/languages/(string:language)/
push (string) – URL repozytorium dla push
check_flags (string) – Flagi tłumaczeń
priority (string) – Priorytet
enforced_checks (string) – Wymuszone kontrole
restricted (string) – Ograniczony dostęp
repoweb (string) – Przeglądarka repozytorium
report_source_bugs (string) – Adres do zgłaszania błędów łańcucha źródłowego
merge_style (string) – Scalanie stylów
commit_message (string) – Commit, add, delete, merge and addon messages
add_message (string) – Commit, add, delete, merge and addon messages
delete_message (string) – Commit, add, delete, merge and addon messages
merge_message (string) – Commit, add, delete, merge and addon messages
addon_message (string) – Commit, add, delete, merge and addon messages
allow_translation_propagation (string) – Zezwól na propagację tłumaczenia
enable_suggestions (string) – Włącz sugestie
suggestion_voting (string) – Głosowanie na sugestie
suggestion_autoaccept (string) – Automatyczne akceptowanie sugestii
push_on_commit (string) – Przesyłaj przy commitowaniu
commit_pending_age (string) – Wiek zmian do scommitowania
auto_lock_error (string) – Błąd blokowania
language_regex (string) – Filtr języka
variant_regex (string) – Warianty wyrażenia regularnego
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)/
Przykładowe dane JSON:
{ "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", "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", "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.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
source_language (string) – Kod języka źródłowego projektu (opcjonalnie)
- Żądanie obiektu JSON
name (string) – nazwa komponentu
slug (string) – końcówka adresu URL komponentu
repo (string) – Adres URL repozytorium VCS
Przykład CURL:
curl \ --data-binary '{"name": "new name"}' \ -H "Content-Type: application/json" \ -H "Authorization: Token TOKEN" \ PATCH http://example.com/api/projects/hello/components/
Przykład żądania 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" }
Przykład odpowiedzi JSON:
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", "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.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Żądanie obiektu JSON
branch (string) – Gałąź repozytorium VCS
file_format (string) – format plików z tłumaczeniami
filemask (string) – mask of translation files in the repository
name (string) – nazwa komponentu
slug (string) – końcówka adresu URL komponentu
repo (string) – Adres URL repozytorium VCS
template (string) – plik podstawowy do tłumaczeń jednojęzycznych
new_base (string) – base file for adding new translations
vcs (string) – system kontroli wersji
- DELETE /api/components/(string: project)/(string: component)/
Nowe w wersji 3.9.
Usuwa komponent.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- 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.- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Odpowiedź Obiekt JSON
results (array) – array of component objects; see
GET /api/changes/(int:id)/
- GET /api/components/(string: project)/(string: component)/file/
Nowe w wersji 4.9.
Downloads all available translations associated with the component as an archive file using the requested format.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Parametry zapytania
format (string) – The archive format to use; If not specified, defaults to
zip
; Supported formats:zip
- GET /api/components/(string: project)/(string: component)/screenshots/
Returns a list of component screenshots.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Odpowiedź Obiekt JSON
results (array) – array of component screenshots; see
GET /api/screenshots/(int:id)/
- GET /api/components/(string: project)/(string: component)/lock/
Zwraca stan blokady komponentu.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Odpowiedź Obiekt JSON
locked (boolean) – whether component is locked for updates
Przykładowe dane JSON:
{ "locked": false }
- POST /api/components/(string: project)/(string: component)/lock/
Ustawia stan blokady komponentów.
Response is same as
GET /api/components/(string:project)/(string:component)/lock/
.- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Żądanie obiektu JSON
lock – Boolean whether to lock or not.
Przykład CURL:
curl \ -d lock=true \ -H "Authorization: Token TOKEN" \ http://example.com/api/components/hello/weblate/repository/
Przykład żądania 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}
Przykład odpowiedzi JSON:
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/
.- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Odpowiedź Obiekt JSON
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) – Informacje o zdalnym commicie
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.
Zobacz
POST /api/projects/(string:project)/repository/
w celu uzyskania dokumentacji.- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Żądanie obiektu JSON
operation (string) – Operation to perform: one of
push
,pull
,commit
,reset
,cleanup
- Odpowiedź Obiekt JSON
result (boolean) – wynik operacji
Przykład CURL:
curl \ -d operation=pull \ -H "Authorization: Token TOKEN" \ http://example.com/api/components/hello/weblate/repository/
Przykład żądania 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"}
Przykład odpowiedzi JSON:
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.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- GET /api/components/(string: project)/(string: component)/new_template/
Downloads template file for new translations.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- GET /api/components/(string: project)/(string: component)/translations/
Returns a list of translation objects in the given component.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Odpowiedź Obiekt JSON
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.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Żądanie obiektu JSON
language_code (string) – translation language code; see
GET /api/languages/(string:language)/
- Odpowiedź Obiekt JSON
result (object) – tworzony nowy obiekt tłumaczeniowy
Przykład CURL:
curl \ -d language_code=cs \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
Przykład żądania 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"}
Przykład odpowiedzi JSON:
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", "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.
Nowe w wersji 2.7.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Odpowiedź Obiekt JSON
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/
Zwraca projekty powiązane z danym komponentem.
Nowe w wersji 4.5.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Odpowiedź Obiekt JSON
projects (array) – associated projects; see
GET /api/projects/(string:project)/
- POST /api/components/(string: project)/(string: component)/links/
Powiąż projekt z komponentem.
Nowe w wersji 4.5.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
- Parametry formularza
string project_slug – Końcówka adresu URL projektu
- DELETE /api/components/(string: project)/(string: component)/links/(string: project_slug)/
Usuń powiązanie projektu z komponentem.
Nowe w wersji 4.5.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
project_slug (string) – Końcówka adresu URL projektu do usunięcia
Tłumaczenia
- GET /api/translations/
Zwraca listę tłumaczeń.
Zobacz także
Translation object attributes are documented at
GET /api/translations/(string:project)/(string:component)/(string:language)/
.
- GET /api/translations/(string: project)/(string: component)/(string: language)/
Zwraca informacje o tłumaczeniu.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- Odpowiedź Obiekt JSON
component (object) – obiekt komponentu; zobacz
GET /api/components/(string:project)/(string:component)/
failing_checks (int) – Liczba ciągów, które nie przeszły kontroli
failing_checks_percent (float) – procent ciągów, które nie przeszły kontroli
failing_checks_words (int) – liczba słów z nieudanymi kontrolami
filename (string) – nazwa pliku tłumaczenia
fuzzy (int) – liczba rozmytych (zaznaczonych do edycji) ciągów
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) – liczba ciągów z komentarzem
have_suggestion (int) – liczba ciągów z sugestią
is_template (boolean) – czy tłumaczenie ma jednojęzyczną podstawę
language (object) – obiekt języka źródłowego; zobacz
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) – nazwisko ostatniego autora
last_change (timestamp) – znacznik czasu ostatniej zmiany
revision (string) – revision hash for the file
share_url (string) – URL for sharing leading to engagement page
total (int) – całkowita liczba ciągów
total_words (int) – całkowita liczba słów
translate_url (string) – Adres URL tłumaczenia
translated (int) – liczba przetłumaczonych ciągów tekstowych
translated_percent (float) – procent przetłumaczonych ciągów
translated_words (int) – liczba przetłumaczonych słów
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/
Przykładowe dane JSON:
{ "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", "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", "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)/
Nowe w wersji 3.9.
Usuwa tłumaczenie.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- 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.- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- Odpowiedź Obiekt JSON
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.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
q (string) – Search query string Wyszukiwanie (optional)
- Odpowiedź Obiekt JSON
results (array) – array of component objects; see
GET /api/units/(int:id)/
- POST /api/translations/(string: project)/(string: component)/(string: language)/units/
Dodaj nową jednostkę jednojęzyczną.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- Żądanie obiektu JSON
key (string) – Nazwa jednostki tłumaczeniowej
value (array) – Wartość jednostki tłumaczeniowej
Zobacz także
- POST /api/translations/(string: project)/(string: component)/(string: language)/autotranslate/
Wyzwalanie automatycznego tłumaczenia.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- Żądanie obiektu JSON
mode (string) – Tryb automatycznego tłumaczenia
filter_type (string) – Typ filtru automatycznego tłumaczenia
auto_source (string) – Źródło automatycznego tłumaczenia -
mt
lubothers
component (string) – Włącz wkład do wspólnej pamięci tłumaczeniowej dla projektu, aby uzyskać dostęp do dodatkowych komponentów.
engines (array) – Silniki tłumaczenia maszynowego
threshold (string) – Ocena wyniku
- 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 Pobieranie tłumaczeń).Informacja
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.- Parametry zapytania
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
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- POST /api/translations/(string: project)/(string: component)/(string: language)/file/
Prześlij nowy plik z tłumaczeniami.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- Parametry formularza
string conflict – How to deal with conflicts (
ignore
,replace-translated
orreplace-approved
)file file – Przesłany plik
string email – Adres e-mail autora
string author – Imię i nazwisko autora
string method – Upload method (
translate
,approve
,suggest
,fuzzy
,replace
,source
,add
), see Metody importustring fuzzy – Fuzzy (marked for edit) strings processing (empty,
process
,approve
)
Przykład 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 VCS repository status.
The response is same as for
GET /api/components/(string:project)/(string:component)/repository/
.- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- POST /api/translations/(string: project)/(string: component)/(string: language)/repository/
Performs given operation on the VCS repository.
Zobacz
POST /api/projects/(string:project)/repository/
w celu uzyskania dokumentacji.- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- Żądanie obiektu JSON
operation (string) – Operation to perform: one of
push
,pull
,commit
,reset
,cleanup
- Odpowiedź Obiekt JSON
result (boolean) – wynik operacji
- GET /api/translations/(string: project)/(string: component)/(string: language)/statistics/
Zwraca szczegółowe dane statystyczne dotyczące tłumaczeń.
Nowe w wersji 2.7.
- Parametry
project (string) – Końcówka adresu URL projektu
component (string) – Końcówka adresu URL komponentu
language (string) – Kod języka tłumaczenia
- Odpowiedź Obiekt JSON
code (string) – kod języka
failing (int) – liczba nieudanych kontroli
failing_percent (float) – odsetek nieudanych kontroli
fuzzy (int) – liczba rozmytych (zaznaczonych do edycji) ciągów
fuzzy_percent (float) – percentage of fuzzy (marked for edit) strings
total_words (int) – całkowita liczba słów
translated_words (int) – liczba przetłumaczonych słów
last_author (string) – nazwisko ostatniego autora
last_change (timestamp) – data ostatniej zmiany
name (string) – nazwa języka
total (int) – całkowita liczba ciągów
translated (int) – liczba przetłumaczonych ciągów tekstowych
translated_percent (float) – procent przetłumaczonych ciągów
url (string) – URL to access the translation (engagement URL)
url_translate (string) – URL to access the translation (real translation URL)
Jednostki
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.
Nowe w wersji 2.10.
- GET /api/units/
Returns list of translation units.
Zobacz także
Unit object attributes are documented at
GET /api/units/(int:id)/
.
- GET /api/units/(int: id)/
Zmienione w wersji 4.3: The
target
andsource
are now arrays to properly handle plural strings.Returns information about translation unit.
- Parametry
id (int) – Identyfikator jednostki
- Odpowiedź Obiekt JSON
translation (string) – URL of a related translation object
source (array) – ciąg źródłowy
previous_source (string) – previous source string used for fuzzy matching
target (array) – ciąg docelowy
id_hash (string) – niepowtarzalny identyfikator jednostki
content_hash (string) – unique identifier of the source string
location (string) – location of the unit in source code
context (string) – ontekst tłumaczenia
note (string) – notatka o jednostce tłumaczeniowej
flags (string) – flagi jednostek tłumaczeniowych
state (int) – unit state, 0 - not translated, 10 - needs editing, 20 - translated, 30 - approved, 100 - read only
fuzzy (boolean) – czy jednostka jest rozmyta lub oznaczona do recenzji
translated (boolean) – czy dana jednostka jest tłumaczona
approved (boolean) – czy tłumaczenie jest zatwierdzone
position (int) – pozycja jednostki w pliku tłumaczenia
has_suggestion (boolean) – czy jednostka ma sugestie
has_comment (boolean) – czy jednostka ma komentarze
has_failing_check (boolean) – czy jednostka nie przeszła pomyślnie testów
num_words (int) – liczba słów źródłowych
priority (int) – priorytet tłumaczenia; 100 to wartość domyślna
id (int) – identyfikator jednostki
explanation (string) – String explanation, available on source units, see Dodatkowe informacje o ciągach źródłowych
extra_flags (string) – Additional string flags, available on source units, see Dostosowywanie zachowania za pomocą flag
web_url (string) – URL where the unit can be edited
souce_unit (string) – Source unit link; see
GET /api/units/(int:id)/
- PATCH /api/units/(int: id)/
Nowe w wersji 4.3.
Wykonuje częściową aktualizację jednostki tłumaczenia.
- Parametry
id (int) – Identyfikator jednostki
- Żądanie obiektu JSON
state (int) – unit state, 0 - not translated, 10 - needs editing, 20 - translated, 30 - approved (need review workflow enabled, see Dedykowani recenzenci)
target (array) – ciąg docelowy
explanation (string) – String explanation, available on source units, see Dodatkowe informacje o ciągach źródłowych
extra_flags (string) – Additional string flags, available on source units, see Dostosowywanie zachowania za pomocą flag
- PUT /api/units/(int: id)/
Nowe w wersji 4.3.
Wykonuje pełną aktualizację jednostki tłumaczeniowej.
- Parametry
id (int) – Identyfikator jednostki
- Żądanie obiektu JSON
state (int) – unit state, 0 - not translated, 10 - needs editing, 20 - translated, 30 - approved (need review workflow enabled, see Dedykowani recenzenci)
target (array) – ciąg docelowy
explanation (string) – String explanation, available on source units, see Dodatkowe informacje o ciągach źródłowych
extra_flags (string) – Additional string flags, available on source units, see Dostosowywanie zachowania za pomocą flag
- DELETE /api/units/(int: id)/
Nowe w wersji 4.3.
Usuwa jednostkę tłumaczeniową.
- Parametry
id (int) – Identyfikator jednostki
Zmiany
Nowe w wersji 2.10.
- GET /api/changes/
Zmienione w wersji 4.1: Filtering of changes was introduced in the 4.1 release.
Returns a list of translation changes.
Zobacz także
Change object attributes are documented at
GET /api/changes/(int:id)/
.- Parametry zapytania
user (string) – Nazwa użytkownika do filtrów
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)/
Zwraca informacje o zmianie tłumaczenia.
- Parametry
id (int) – Zmiana identyfikatora
- Odpowiedź Obiekt JSON
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) – znacznik czasu zdarzenia
action (int) – numeryczna identyfikacja działania
action_name (string) – opis tekstowy działania
target (string) – event changed text or detail
id (int) – zmiana identyfikatora
Zrzuty ekranu
Nowe w wersji 2.14.
- GET /api/screenshots/
Returns a list of screenshot string information.
Zobacz także
Screenshot object attributes are documented at
GET /api/screenshots/(int:id)/
.
- GET /api/screenshots/(int: id)/
Zwraca informacje o zrzutach ekranu.
- Parametry
id (int) – Identyfikator zrzutu ekranu
- Odpowiedź Obiekt JSON
name (string) – nazwa zrzutu ekranu
component (string) – URL of a related component object
file_url (string) – URL to download a file; see
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/
Pobierz zrzut ekranu.
- Parametry
id (int) – Identyfikator zrzutu ekranu
- POST /api/screenshots/(int: id)/file/
Zastąp obraz zrzutu ekranu.
- Parametry
id (int) – Identyfikator zrzutu ekranu
- Parametry formularza
file image – Przesłany plik
Przykład 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/
Powiąż ciąg źródłowy ze zrzutem ekranu.
- Parametry
id (int) – Identyfikator zrzutu ekranu
- Parametry formularza
string unit_id – Identyfikator jednostki
- Odpowiedź Obiekt JSON
name (string) – nazwa zrzutu ekranu
translation (string) – URL of a related translation object
file_url (string) – URL to download a file; see
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)
Usuń powiązanie zrzutu ekranu z ciągami źródłowymi.
- Parametry
id (int) – Identyfikator zrzutu ekranu
unit_id – ID jednostki ciągu źródłowego
- POST /api/screenshots/
Tworzy nowy zrzut ekranu.
- Parametry formularza
file image – Przesłany plik
string name – Nazwa zrzutu ekranu
string project_slug – Końcówka adresu URL projektu
string component_slug – Końcówka adresu URL komponentu
string language_code – Kod języka
- Odpowiedź Obiekt JSON
name (string) – nazwa zrzutu ekranu
component (string) – URL of a related component object
file_url (string) – URL to download a file; see
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)/
Edytuj częściowe informacje o zrzucie ekranu.
- Parametry
id (int) – Identyfikator zrzutu ekranu
- Odpowiedź Obiekt JSON
name (string) – nazwa zrzutu ekranu
component (string) – URL of a related component object
file_url (string) – URL to download a file; see
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)/
Edytuj pełne informacje o zrzucie ekranu.
- Parametry
id (int) – Identyfikator zrzutu ekranu
- Odpowiedź Obiekt JSON
name (string) – nazwa zrzutu ekranu
component (string) – URL of a related component object
file_url (string) – URL to download a file; see
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)/
Usuń zrzut ekranu.
- Parametry
id (int) – Identyfikator zrzutu ekranu
Dodatki
Nowe w wersji 4.4.1.
- GET /api/addons/
Zwraca listę dodatków.
Zobacz także
Add-on object attributes are documented at
GET /api/addons/(int:id)/
.
- GET /api/addons/(int: id)/
Zwraca informacje o dodatku.
- Parametry
id (int) – ID dodatku
- Odpowiedź Obiekt JSON
name (string) – nazwa dodatku
component (string) – URL of a related component object
configuration (object) – Opcjonalna konfiguracja dodatku
Zobacz także
- POST /api/components/(string: project)/(string: component)/addons/
Tworzy nowy dodatek.
- Parametry
project_slug (string) – Końcówka adresu URL projektu
component_slug (string) – Końcówka adresu URL komponentu
- Żądanie obiektu JSON
name (string) – nazwa dodatku
configuration (object) – Opcjonalna konfiguracja dodatku
- PATCH /api/addons/(int: id)/
Edytuj częściowe informacje o dodatku.
- Parametry
id (int) – ID dodatku
- Odpowiedź Obiekt JSON
configuration (object) – Opcjonalna konfiguracja dodatku
- PUT /api/addons/(int: id)/
Edytuj pełne informacje o dodatku.
- Parametry
id (int) – ID dodatku
- Odpowiedź Obiekt JSON
configuration (object) – Opcjonalna konfiguracja dodatku
- DELETE /api/addons/(int: id)/
Usuń dodatek.
- Parametry
id (int) – ID dodatku
Listy komponentów
Nowe w wersji 4.0.
- GET /api/component-lists/
Returns a list of component lists.
Zobacz także
Component list object attributes are documented at
GET /api/component-lists/(str:slug)/
.
- GET /api/component-lists/(str: slug)/
Zwraca informacje o liście komponentów.
- Parametry
slug (string) – Końcówka adresu URL listy komponentów
- Odpowiedź Obiekt JSON
name (string) – nazwa listy komponentów
slug (string) – końcówka adresu URL listy komponentów
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) – zasady automatycznego przydzielania
- PUT /api/component-lists/(str: slug)/
Zmienia parametry listy komponentów.
- Parametry
slug (string) – Końcówka adresu URL listy komponentów
- Żądanie obiektu JSON
name (string) – nazwa listy komponentów
slug (string) – końcówka adresu URL listy komponentów
show_dashboard (boolean) – whether to show it on a dashboard
- PATCH /api/component-lists/(str: slug)/
Zmienia parametry listy komponentów.
- Parametry
slug (string) – Końcówka adresu URL listy komponentów
- Żądanie obiektu JSON
name (string) – nazwa listy komponentów
slug (string) – końcówka adresu URL listy komponentów
show_dashboard (boolean) – whether to show it on a dashboard
- DELETE /api/component-lists/(str: slug)/
Usuwa listę komponentów.
- Parametry
slug (string) – Końcówka adresu URL listy komponentów
- POST /api/component-lists/(str: slug)/components/
Associate component with a component list.
- Parametry
slug (string) – Końcówka adresu URL listy komponentów
- Parametry formularza
string component_id – Identyfikator komponentu
- DELETE /api/component-lists/(str: slug)/components/(str: component_slug)
Disassociate a component from the component list.
- Parametry
slug (string) – Końcówka adresu URL listy komponentów
component_slug (string) – Końcówka adresu URL komponentu
Słownik
Zmienione w wersji 4.5: Glossaries are now stored as regular components, translations and strings, please use respective API instead.
Zadania
Nowe w wersji 4.4.
- GET /api/tasks/
Lista zadań jest obecnie niedostępna.
- GET /api/tasks/(str: uuid)/
Zwraca informacje o zadaniu
- Parametry
uuid (string) – Identyfikator UUID zadania
- Odpowiedź Obiekt JSON
completed (boolean) – Określa, czy zadanie zostało ukończone
progress (int) – Task progress in percent
result (object) – Task result or progress details
log (string) – Dziennik zadań
Metrics
- GET /api/metrics/
Returns server metrics.
- Odpowiedź Obiekt JSON
units (int) – Liczba jednostek
units_translated (int) – Liczba przetłumaczonych jednostek
users (int) – Liczba użytkowników
changes (int) – Liczba zmian
projects (int) – Liczba projektów
components" (int) – Liczba komponentów
translations" (int) – Liczba tłumaczeń
languages" (int) – Liczba używanych języków
checks" (int) – Liczba uruchomionych kontroli jakości
configuration_errors" (int) – Liczba błędów konfiguracji
suggestions" (int) – Liczba oczekujących sugestii
celery_queues (object) – Długości kolejek Celery, patrz Zadania w tle korzystające z Celery
name (string) – Skonfigurowana nazwa serwera
Hooki powiadomień
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)/
Niezalecane od wersji 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)/
Niezalecane od wersji 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.
Informacja
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.
Zobacz także
- Automatyczne otrzymywanie zmian z GitHub
For instruction on setting up GitHub integration
- https://docs.github.com/en/github/extending-github/about-webhooks
Ogólne informacje na temat Webhooków GitHub
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/gitlab/
Special hook for handling GitLab notifications and automatically updating matching components.
Zobacz także
- Automatyczne otrzymywanie zmian z GitHub
For instruction on setting up GitLab integration
- https://docs.gitlab.com/ee/user/project/integrations/webhooks.html
Ogólne informacje na temat Webhooków GitLab
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/bitbucket/
Special hook for handling Bitbucket notifications and automatically updating matching components.
Zobacz także
- Automatyczne otrzymywanie zmian z Bitbucket
For instruction on setting up Bitbucket integration
- https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/
Ogólne informacje na temat WebhookówBitbucket
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/pagure/
Nowe w wersji 3.3.
Special hook for handling Pagure notifications and automatically updating matching components.
Zobacz także
- Automatyczne odbieranie zmian Pagure
For instruction on setting up Pagure integration
- https://docs.pagure.org/pagure/usage/using_webhooks.html
Ogólne informacje na temat Webhooków
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/azure/
Nowe w wersji 3.8.
Special hook for handling Azure Repos notifications and automatically updating matching components.
Zobacz także
- Automatically receiving changes from Azure Repos
For instruction on setting up Azure integration
- https://docs.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops
Generic information about Azure Repos Web Hooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/gitea/
Nowe w wersji 3.9.
Special hook for handling Gitea Webhook notifications and automatically updating matching components.
Zobacz także
- Automatically receiving changes from Gitea Repos
For instruction on setting up Gitea integration
- https://docs.gitea.io/en-us/webhooks/
Ogólne informacje na temat Webhooków Gitea
ENABLE_HOOKS
For enabling hooks for whole Weblate
- POST /hooks/gitee/
Nowe w wersji 3.9.
Special hook for handling Gitee Webhook notifications and automatically updating matching components.
Zobacz także
- Automatically receiving changes from Gitee Repos
For instruction on setting up Gitee integration
- https://gitee.com/help/categories/40
Ogólne informacje na temat Webhooków Gitee
ENABLE_HOOKS
For enabling hooks for whole Weblate
Eksport
Weblate provides various exports to allow you to further process the data.
- GET /exports/stats/(string: project)/(string: component)/
- Parametry zapytania
format (string) – Output format: either
json
orcsv
Niezalecane od wersji 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.
Przykładowe żądanie:
GET /exports/stats/weblate/main/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript
Przykładowa odpowiedź:
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/" } ]
Kanały RSS
Changes in translations are exported in RSS feeds.
- GET /exports/rss/(string: project)/(string: component)/(string: language)/
Retrieves RSS feed with recent changes for a translation.
- GET /exports/rss/(string: project)/(string: component)/
Retrieves RSS feed with recent changes for a component.
- GET /exports/rss/(string: project)/
Retrieves RSS feed with recent changes for a project.
- GET /exports/rss/language/(string: language)/
Retrieves RSS feed with recent changes for a language.
- GET /exports/rss/
Retrieves RSS feed with recent changes for Weblate instance.
Zobacz także