REST API Weblate#

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 and api are supported. The latter provides web browser interface for API.

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

Nagłówki żądań:
  • Accept – the response content type depends on Accept header

  • Authorization – opcjonalny token do uwierzytelniania jako Authorization: Token TWÓJ-TOKEN

Nagłówki odpowiedzi:
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 the API

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

Kody stanu:

Tokeny uwierzytelniające#

Zmienione w wersji 4.10: Project scoped tokens were introduced in the 4.10 release.

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

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

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/

Components and categories#

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

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.

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

The status of rate limiting is reported in following headers:

X-RateLimit-Limit

Rate limiting limit of requests to perform

X-RateLimit-Remaining

Pozostały limit żądań

X-RateLimit-Reset

Number of seconds until ratelimit window resets

Zmienione w wersji 4.1: Dodano nagłówki statusu ograniczenia szybkości.

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)

  • is_bot (boolean) – Is user bot? (optional) (used for project scoped tokens)

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

  • is_bot (boolean) – whether the user is bot (used for project scoped tokens)

  • date_joined (string) – data utworzenia użytkownika

  • last_login (string) – date the user last signed in

  • 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,
    "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)/#

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

  • is_bot (boolean) – whether the user is bot (used for project scoped tokens)

  • 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

  • is_bot (boolean) – whether the user is bot (used for project scoped tokens)

  • 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

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

Nowe w wersji 4.13.1.

Remove user from a group.

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:
GET /api/groups/(int: id)/#

Zwraca informacje o grupie.

Parametry:
  • id (int) – Identyfikator grupy

Odpowiedź Obiekt JSON:

Przykładowe dane JSON:

{
    "name": "Guests",
    "defining_project": null,
    "project_selection": 3,
    "language_selection": 1,
    "url": "http://example.com/api/groups/1/",
    "roles": [
        "http://example.com/api/roles/1/",
        "http://example.com/api/roles/2/"
    ],
    "languages": [
        "http://example.com/api/languages/en/",
        "http://example.com/api/languages/cs/",
    ],
    "projects": [
        "http://example.com/api/projects/demo1/",
        "http://example.com/api/projects/demo/"
    ],
    "componentlist": "http://example.com/api/component-lists/new/",
    "components": [
        "http://example.com/api/components/demo/weblate/"
    ]
}
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

  • population (int) – Liczba mówców

  • 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

Żądanie obiektu JSON:
  • population (int) – Liczba mówców

Przykładowe dane JSON:

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

Zmienia parametry języka.

Parametry:
  • language (string) – Kod języka

Żądanie obiektu JSON:
  • name (string) – Nazwa języka

  • direction (string) – Kierunek tekstu

  • population (int) – Liczba mówców

  • 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

  • population (int) – Liczba mówców

  • 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

Zobacz także

Returned attributes are described in Statystyki.

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/#

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:

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)/#

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:
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, file-scan

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:
POST /api/projects/(string: project)/components/#

Zmienione w wersji 4.3: The zipfile and docfile 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.

Żądanie obiektu JSON:
Odpowiedź Obiekt JSON:

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

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",
        "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"
}

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",
             "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.

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.

Parametry:
  • project (string) – Końcówka adresu URL projektu

Zobacz także

Returned attributes are described in Statystyki.

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

Nowe w wersji 5.0: Returns categories for a project. See GET /api/categories/(int:id)/ for field definitions.

param project:

Końcówka adresu URL projektu

type project:

ciąg

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

Nowe w wersji 5.3: Returns labels for a project.

param project:

Końcówka adresu URL projektu

type project:

ciąg

>json int id:

ID of the label

>json string name:

name of the label

>json string color:

color of the label

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

Nowe w wersji 5.3: Creates a label for a project.

param project:

Końcówka adresu URL projektu

type project:

ciąg

<json string name:

name of the label

<json string color:

color of the label

Komponenty#

Podpowiedź

Użyj POST /api/projects/(string:project)/components/, aby utworzyć nowe 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:

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",
             "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.

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",
            "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.

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)/#

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:
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 and zip:CONVERSION where CONVERSION is one of converters listed at Pobieranie tłumaczeń.

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:
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:
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:
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",
        "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.

Parametry:
  • project (string) – Końcówka adresu URL projektu

  • component (string) – Końcówka adresu URL komponentu

Zobacz także

Returned attributes are described in Statystyki.

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:
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

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:

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",
                "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)/#

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:
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:
POST /api/translations/(string: project)/(string: component)/(string: language)/units/#

Dodaj nową jednostkę.

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 (używana jako klucz lub kontekst)

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

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

Odpowiedź Obiekt JSON:
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 lub others

  • 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.

Nagłówki odpowiedzi:
Nagłówki żądań:
  • If-Modified-Since – Skips response if the file has not been modified since that time.

Parametry zapytania:
  • format – File format to use; if not specified no format conversion happens; see Pobieranie tłumaczeń for supported formats

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

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 conflicts – How to deal with conflicts (ignore, replace-translated or replace-approved), see Obsługa konfliktów

  • 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 importu

  • string 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ń.

Parametry:
  • project (string) – Końcówka adresu URL projektu

  • component (string) – Końcówka adresu URL komponentu

  • language (string) – Kod języka tłumaczenia

Zobacz także

Returned attributes are described in Statystyki.

Pamięć#

Nowe w wersji 4.14.

GET /api/memory/#

Returns a list of memory results.

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

Deletes a memory object

Parametry:
  • memory_object_id – Memory Object ID

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.

GET /api/units/#

Returns list of translation units.

Parametry:
  • q (string) – Search query string Wyszukiwanie (optional)

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 and source 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

  • 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) – czy jednostka jest rozmyta lub oznaczona do przeglądu

  • 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

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

  • pending (boolean) – czy jednostka oczekuje na zapis

  • timestamp (timestamp) – wiek ciągu

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:
Odpowiedź Obiekt JSON:
  • labels (array) – labels, available on source units

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:
Odpowiedź Obiekt JSON:
  • labels (array) – labels, available on source units

DELETE /api/units/(int: id)/#

Nowe w wersji 4.3.

Usuwa jednostkę tłumaczeniową.

Parametry:
  • id (int) – Identyfikator jednostki

Zmiany#

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#

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:
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:
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:
PATCH /api/screenshots/(int: id)/#

Edytuj częściowe informacje o zrzucie ekranu.

Parametry:
  • id (int) – Identyfikator zrzutu ekranu

Odpowiedź Obiekt JSON:
PUT /api/screenshots/(int: id)/#

Edytuj pełne informacje o zrzucie ekranu.

Parametry:
  • id (int) – Identyfikator zrzutu ekranu

Odpowiedź Obiekt JSON:
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

Dodatki

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

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

Nowe w wersji 5.0.1: List components in a component list.

param slug:

Końcówka adresu URL listy komponentów

type slug:

ciąg

form string component_id:

Identyfikator komponentu

>json array results:

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

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

Associate component with a component list.

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)/#

Returns information about a task.

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ń

Statystyki#

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

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

Parametry:
  • object (string) – URL path

Odpowiedź Obiekt JSON:
  • total (int) – całkowita liczba ciągów

  • total_words (int) – całkowita liczba słów

  • total_chars (int) – total number of characters

  • last_change (timestamp) – data ostatniej zmiany

  • 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 (float) – procent przetłumaczonych słów

  • translated_chars (int) – liczba przetłumaczonych znaków

  • translated_chars_percent (float) – procent przetłumaczonych znaków

  • fuzzy (int) – liczba rozmytych (zaznaczonych do edycji) ciągów

  • fuzzy_words (int) – number of fuzzy (marked for edit) words

  • fuzzy_chars (int) – number of fuzzy (marked for edit) characters

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

  • fuzzy_words_percent (float) – percentage of fuzzy (marked for edit) words

  • fuzzy_chars_percent (float) – percentage of fuzzy (marked for edit) characters

  • failing (int) – liczba nieudanych kontroli

  • failing_percent (float) – odsetek nieudanych kontroli

  • approved (int) – number of approved strings

  • approved_words (int) – number of approved words

  • approved_chars (int) – number of approved characters

  • approved_percent (float) – percentage of approved strings

  • approved_words_percent (float) – percentage of approved words

  • approved_chars_percent (float) – percentage of approved characters

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

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

  • readonly – number of read-only characters

  • readonly_percent (float) – percentage of read-only strings

  • readonly_words_percent (float) – percentage of read-only words

  • readonly_char_percent (float) – percentage of read-only characters

  • suggestions (int) – number of strings with suggestions

  • comments (int) – number of strings with comments

  • name (string) – object name

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

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

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

Metryki#

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

Categories#

GET /api/categories/#

Nowe w wersji 5.0.

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

POST /api/categories/#

Nowe w wersji 5.0.

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

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

Nowe w wersji 5.0.

Parametry:
  • id (int) – Category ID

Odpowiedź Obiekt JSON:
  • name (str) – Name of category.

  • slug (str) – Slug of category.

  • project (str) – Link to a project.

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

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

Nowe w wersji 5.0: Edit partial information about category.

param id:

Category ID

type id:

int

>json object configuration:

Optional category configuration

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

Nowe w wersji 5.0: Edit full information about category.

param id:

Category ID

type id:

int

>json object configuration:

Optional category configuration

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

Nowe w wersji 5.0: Delete category.

param id:

Category ID

type id:

int

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/get-started/customizing-your-github-workflow/exploring-integrations/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/#

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/#

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

Informacja

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

Zobacz także

Automatically receiving changes from Azure Repos

For instruction on setting up Azure integration

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

Ogólne informacje na temat Azure DevOps Web Hooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/gitea/#

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

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/#

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 or csv

Niezalecane od wersji 2.6: Please use GET /api/components/(string:project)/(string:component)/statistics/ and GET /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

RSS w Wikipedii