API REST de Weblate
Nuevo en la versión 2.6: La API REST está disponible a partir de 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 Cliente de Weblate.
Autenticación y parámetros genéricos
The public project API is available without authentication, though
unauthenticated requests are heavily throttled (by default to 100 requests per
day), so it is recommended to use authentication. The authentication uses a
token, which you can get in your profile. Use it in the Authorization
header:
- ANY /
Generic request behaviour for the API, the headers, status codes and parameters here apply to all endpoints as well.
- Query Parameters
format – Response format (overrides Accept). Possible values depends on REST framework setup, by default
json
andapi
are supported. The latter provides web browser interface for API.page – Returns given page of paginated results (use next and previous fields in response to automate the navigation).
- Request Headers
Authorization – optional token to authenticate as
Authorization: Token YOUR-TOKEN
- Response Headers
Content-Type – this depends on Accept header of request
Allow – list of allowed HTTP methods on object
- Response JSON Object
detail (string) – verbose description of the result (for HTTP status codes other than 200 OK)
count (int) – total item count for object lists
next (string) – next page URL for object lists
previous (string) – previous page URL for object lists
results (array) – results for object lists
url (string) – URL to access this resource using API
web_url (string) – URL to access this resource using web browser
- Status Codes
200 OK – when request was correctly handled
201 Created – when a new object was created successfully
204 No Content – when an object was deleted successfully
400 Bad Request – when form parameters are missing
403 Forbidden – when access is denied
429 Too Many Requests – when throttling is in place
Authentication tokens
Distinto en la versión 4.10: Project scoped tokens were introduced in the 4.10 release.
Each user has his personal access token which can be obtained in the user
profile. Newly generated user tokens have the wlu_
prefix.
It is possible to create project scoped tokens for API access to given project
only. These tokens can be identified by the wlp_
prefix.
Authentication examples
Example request:
GET /api/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Authorization: Token YOUR-TOKEN
Example response:
HTTP/1.0 200 OK
Date: Fri, 25 Mar 2016 09:46:12 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, HEAD, OPTIONS
{
"projects":"http://example.com/api/projects/",
"components":"http://example.com/api/components/",
"translations":"http://example.com/api/translations/",
"languages":"http://example.com/api/languages/"
}
CURL example:
curl \
-H "Authorization: Token TOKEN" \
https://example.com/api/
Passing Parameters Examples
For the POST method the parameters can be specified either as form submission (application/x-www-form-urlencoded) or as JSON (application/json).
Form request example:
POST /api/projects/hello/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Authorization: Token TOKEN
operation=pull
JSON request example:
POST /api/projects/hello/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20
{"operation":"pull"}
CURL example:
curl \
-d operation=pull \
-H "Authorization: Token TOKEN" \
http://example.com/api/components/hello/weblate/repository/
CURL JSON example:
curl \
--data-binary '{"operation":"pull"}' \
-H "Content-Type: application/json" \
-H "Authorization: Token TOKEN" \
http://example.com/api/components/hello/weblate/repository/
API rate limiting
The API requests are rate limited; the default configuration limits it to 100 requests per day for anonymous users and 5000 requests per hour for authenticated users.
Rate limiting can be adjusted in the settings.py
; see
Throttling in Django REST framework documentation
for more details how to configure it.
In the Docker container this can be configured using
WEBLATE_API_RATELIMIT_ANON
and WEBLATE_API_RATELIMIT_USER
.
The status of rate limiting is reported in following headers:
|
Rate limiting limit of requests to perform |
|
Remaining limit of requests |
|
Number of seconds until ratelimit window resets |
Distinto en la versión 4.1: Added ratelimiting status headers.
API Entry Point
- GET /api/
The API root entry point.
Example request:
GET /api/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript Authorization: Token YOUR-TOKEN
Example response:
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/" }
Usuarios
Nuevo en la versión 4.0.
- GET /api/users/
Devuelve un listado de usuarios si tiene permisos para ver y gestionar usuarios. En caso contrario, podrá ver solo sus propios datos.
Ver también
Users object attributes are documented at
GET /api/users/(str:username)/
.
- POST /api/users/
Creates a new user.
- Parámetros
username (string) – Nombre de usuario
full_name (string) – User full name
email (string) – User email
is_superuser (boolean) – Is user superuser? (optional)
is_active (boolean) – Is user active? (optional)
is_bot (boolean) – Is user bot? (optional) (used for project scoped tokens)
- GET /api/users/(str: username)/
Returns information about users.
- Parámetros
username (string) – User’s username
- Response JSON Object
username (string) – username of a user
full_name (string) – full name of a user
email (string) – email of a user
is_superuser (boolean) – whether the user is a super user
is_active (boolean) – whether the user is active
is_bot (boolean) – whether the user is bot (used for project scoped tokens)
date_joined (string) – date the user is created
groups (array) – link to associated groups; see
GET /api/groups/(int:id)/
Example JSON data:
{ "email": "user@example.com", "full_name": "Example User", "username": "exampleusername", "groups": [ "http://example.com/api/groups/2/", "http://example.com/api/groups/3/" ], "is_superuser": true, "is_active": true, "is_bot": false, "date_joined": "2020-03-29T18:42:42.617681Z", "url": "http://example.com/api/users/exampleusername/", "statistics_url": "http://example.com/api/users/exampleusername/statistics/" }
- PUT /api/users/(str: username)/
Changes the user parameters.
- Parámetros
username (string) – User’s username
- Response JSON Object
username (string) – username of a user
full_name (string) – full name of a user
email (string) – email of a user
is_superuser (boolean) – whether the user is a super user
is_active (boolean) – whether the user is active
is_bot (boolean) – whether the user is bot (used for project scoped tokens)
date_joined (string) – date the user is created
- PATCH /api/users/(str: username)/
Changes the user parameters.
- Parámetros
username (string) – User’s username
- Response JSON Object
username (string) – username of a user
full_name (string) – full name of a user
email (string) – email of a user
is_superuser (boolean) – whether the user is a super user
is_active (boolean) – whether the user is active
is_bot (boolean) – whether the user is bot (used for project scoped tokens)
date_joined (string) – date the user is created
- DELETE /api/users/(str: username)/
Elimina toda la información de la cuenta de usuario y la marca como inactiva.
- Parámetros
username (string) – User’s username
- POST /api/users/(str: username)/groups/
Associate groups with a user.
- Parámetros
username (string) – User’s username
- Form Parameters
string group_id – The unique group ID
- GET /api/users/(str: username)/statistics/
Enumera estadísticas de una cuenta de usuario.
- Parámetros
username (string) – User’s username
- Response JSON Object
translated (int) – Número de traducciones efectuadas
suggested (int) – Número de sugerencias efectuadas
uploaded (int) – Número de cargas efectuadas
commented (int) – Número de comentarios efectuados
languages (int) – Número de idiomas en que puede traducir
- GET /api/users/(str: username)/notifications/
List subscriptions of a user.
- Parámetros
username (string) – User’s username
- POST /api/users/(str: username)/notifications/
Associate subscriptions with a user.
- Parámetros
username (string) – User’s username
- Request JSON Object
notification (string) – Nombre de notificación registrada
scope (int) – Scope of notification from the available choices
frequency (int) – Elecciones de frecuencia de las notificaciones
- GET /api/users/(str: username)/notifications/(int: subscription_id)/
Get a subscription associated with a user.
- Parámetros
username (string) – User’s username
subscription_id (int) – Identificador de notificación registrada
- PUT /api/users/(str: username)/notifications/(int: subscription_id)/
Edit a subscription associated with a user.
- Parámetros
username (string) – User’s username
subscription_id (int) – Identificador de notificación registrada
- Request JSON Object
notification (string) – Nombre de notificación registrada
scope (int) – Scope of notification from the available choices
frequency (int) – Elecciones de frecuencia de las notificaciones
- PATCH /api/users/(str: username)/notifications/(int: subscription_id)/
Edit a subscription associated with a user.
- Parámetros
username (string) – User’s username
subscription_id (int) – Identificador de notificación registrada
- Request JSON Object
notification (string) – Nombre de notificación registrada
scope (int) – Scope of notification from the available choices
frequency (int) – Elecciones de frecuencia de las notificaciones
- DELETE /api/users/(str: username)/notifications/(int: subscription_id)/
Delete a subscription associated with a user.
- Parámetros
username (string) – User’s username
subscription_id – Nombre de notificación registrada
subscription_id – int
Grupos
Nuevo en la versión 4.0.
- GET /api/groups/
Devuelve una lista de grupos si tiene permisos para ver y gestionar grupos. En caso contrario, verá solo los grupos a los que pertenece el usuario.
Ver también
Group object attributes are documented at
GET /api/groups/(int:id)/
.
- POST /api/groups/
Creates a new group.
- Parámetros
name (string) – Nombre de grupo
project_selection (int) – Group of project selection from given options
language_selection (int) – Group of languages selected from given options
defining_project (str) – link to the defining project, used for Gestionar el control de acceso por proyecto; see
GET /api/projects/(string:project)/
- GET /api/groups/(int: id)/
Returns information about group.
- Parámetros
id (int) – Identificador del grupo
- Response JSON Object
name (string) – nombre de un grupo
project_selection (int) – entero que se corresponde a un grupo de proyectos
language_selection (int) – entero que se corresponde a un grupo de idiomas
roles (array) – link to associated roles; see
GET /api/roles/(int:id)/
projects (array) – link to associated projects; see
GET /api/projects/(string:project)/
components (array) – link to associated components; see
GET /api/components/(string:project)/(string:component)/
componentlists (array) – link to associated componentlist; see
GET /api/component-lists/(str:slug)/
defining_project (str) – link to the defining project, used for Gestionar el control de acceso por proyecto; see
GET /api/projects/(string:project)/
Example JSON data:
{ "name": "Guests", "defining_project": null, "project_selection": 3, "language_selection": 1, "url": "http://example.com/api/groups/1/", "roles": [ "http://example.com/api/roles/1/", "http://example.com/api/roles/2/" ], "languages": [ "http://example.com/api/languages/en/", "http://example.com/api/languages/cs/", ], "projects": [ "http://example.com/api/projects/demo1/", "http://example.com/api/projects/demo/" ], "componentlist": "http://example.com/api/component-lists/new/", "components": [ "http://example.com/api/components/demo/weblate/" ] }
- PUT /api/groups/(int: id)/
Cambia los parámetros del grupo.
- Parámetros
id (int) – Identificador del grupo
- Response JSON Object
name (string) – nombre de un grupo
project_selection (int) – entero que se corresponde a un grupo de proyectos
language_selection (int) – entero que se corresponde a un grupo de idiomas
- PATCH /api/groups/(int: id)/
Cambia los parámetros del grupo.
- Parámetros
id (int) – Identificador del grupo
- Response JSON Object
name (string) – nombre de un grupo
project_selection (int) – entero que se corresponde a un grupo de proyectos
language_selection (int) – entero que se corresponde a un grupo de idiomas
- DELETE /api/groups/(int: id)/
Elimina el grupo.
- Parámetros
id (int) – Identificador del grupo
- POST /api/groups/(int: id)/roles/
Associate roles with a group.
- Parámetros
id (int) – Identificador del grupo
- Form Parameters
string role_id – The unique role ID
- POST /api/groups/(int: id)/components/
Associate components with a group.
- Parámetros
id (int) – Identificador del grupo
- Form Parameters
string component_id – The unique component ID
- DELETE /api/groups/(int: id)/components/(int: component_id)
Delete component from a group.
- Parámetros
id (int) – Identificador del grupo
component_id (int) – The unique component ID
- POST /api/groups/(int: id)/projects/
Associate projects with a group.
- Parámetros
id (int) – Identificador del grupo
- Form Parameters
string project_id – The unique project ID
- DELETE /api/groups/(int: id)/projects/(int: project_id)
Delete project from a group.
- Parámetros
id (int) – Identificador del grupo
project_id (int) – The unique project ID
- POST /api/groups/(int: id)/languages/
Associate languages with a group.
- Parámetros
id (int) – Identificador del grupo
- Form Parameters
string language_code – The unique language code
- DELETE /api/groups/(int: id)/languages/(string: language_code)
Delete language from a group.
- Parámetros
id (int) – Identificador del grupo
language_code (string) – The unique language code
- POST /api/groups/(int: id)/componentlists/
Associate componentlists with a group.
- Parámetros
id (int) – Identificador del grupo
- Form Parameters
string component_list_id – The unique componentlist ID
- DELETE /api/groups/(int: id)/componentlists/(int: component_list_id)
Delete componentlist from a group.
- Parámetros
id (int) – Identificador del grupo
component_list_id (int) – The unique componentlist ID
Roles
- GET /api/roles/
Returns a list of all roles associated with user. If user is superuser, then list of all existing roles is returned.
Ver también
Roles object attributes are documented at
GET /api/roles/(int:id)/
.
- POST /api/roles/
Creates a new role.
- Parámetros
name (string) – Role name
permissions (array) – List of codenames of permissions
- GET /api/roles/(int: id)/
Returns information about a role.
- Parámetros
id (int) – Role ID
- Response JSON Object
name (string) – Role name
permissions (array) – list of codenames of permissions
Example JSON data:
{ "name": "Access repository", "permissions": [ "vcs.access", "vcs.view" ], "url": "http://example.com/api/roles/1/", }
- PUT /api/roles/(int: id)/
Changes the role parameters.
- Parámetros
id (int) – Role’s ID
- Response JSON Object
name (string) – Role name
permissions (array) – list of codenames of permissions
- PATCH /api/roles/(int: id)/
Changes the role parameters.
- Parámetros
id (int) – Role’s ID
- Response JSON Object
name (string) – Role name
permissions (array) – list of codenames of permissions
- DELETE /api/roles/(int: id)/
Deletes the role.
- Parámetros
id (int) – Role’s ID
Idiomas
- GET /api/languages/
Devuelve un listado de todos los idiomas.
Ver también
Los atributos de objeto de idioma se documentan en
GET /api/languages/(string:language)/
.
- POST /api/languages/
Crea un idioma nuevo.
- Parámetros
code (string) – Nombre del idioma
name (string) – Nombre del idioma
direction (string) – Dirección del texto
plural (object) – Fórmula y número de plurales del idioma
- GET /api/languages/(string: language)/
Devuelve información relativa a un idioma.
- Parámetros
language (string) – Código de idioma
- Response JSON Object
code (string) – Código de idioma
direction (string) – Dirección del texto
plural (object) – Objeto de información de plurales de un idioma
aliases (array) – Array of aliases for language
Example JSON data:
{ "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)/
Permite cambiar los parámetros del idioma.
- Parámetros
language (string) – Código del idioma
- Request JSON Object
name (string) – Nombre del idioma
direction (string) – Dirección del texto
plural (object) – Language plural details
- PATCH /api/languages/(string: language)/
Permite cambiar los parámetros del idioma.
- Parámetros
language (string) – Código del idioma
- Request JSON Object
name (string) – Nombre del idioma
direction (string) – Dirección del texto
plural (object) – Language plural details
- DELETE /api/languages/(string: language)/
Deletes the language.
- Parámetros
language (string) – Código del idioma
- GET /api/languages/(string: language)/statistics/
Devuelve estadísticas sobre un idioma.
- Parámetros
language (string) – Código de idioma
- Response JSON Object
total (int) – número total de cadenas
total_words (int) – número total de palabras
last_change (timestamp) – últimos cambios en el idioma
recent_changes (int) – número total de cambios
translated (int) – número de cadenas traducidas
translated_percent (float) – porcentaje de cadenas traducidas
translated_words (int) – número de palabras traducidas
translated_words_percent (int) – porcentaje de palabras traducidas
translated_chars (int) – número de caracteres traducidos
translated_chars_percent (int) – porcentaje de caracteres traducidos
total_chars (int) – número de caracteres totales
fuzzy (int) – number of fuzzy (marked for edit) strings
fuzzy_percent (int) – percentage of fuzzy (marked for edit) strings
failing (int) – número de cadenas fallidas
failing – porcentaje de cadenas fallidas
Proyectos
- GET /api/projects/
Devuelve un listado de todos los proyectos.
Ver también
Los atributos de objeto de proyecto se documentan en
GET /api/projects/(string:project)/
.
- POST /api/projects/
Nuevo en la versión 3.9.
Crea un proyecto nuevo.
- Parámetros
name (string) – Nombre del proyecto
slug (string) – «Slug» del proyecto
web (string) – Sitio web del proyecto
- GET /api/projects/(string: project)/
Devuelve información relativa a un proyecto.
- Parámetros
project (string) – URL semántico del proyecto
- Response JSON Object
name (string) – nombre del proyecto
slug (string) – project slug
web (string) – sitio web del proyecto
components_list_url (string) – URL a la lista de componentes; vea
GET /api/projects/(string:project)/components/
repository_url (string) – URL al estado del repositorio; vea
GET /api/projects/(string:project)/repository/
changes_list_url (string) – URL a la lista de cambios; vea
GET /api/projects/(string:project)/changes/
translation_review (boolean) – Activar revisiones
source_review (boolean) – Activar revisiones de origen
set_language_team (boolean) – Definir cabecera «Language-Team»
enable_hooks (boolean) – Activar actuadores
instructions (string) – Instrucciones de traducción
language_aliases (string) – Alias de idiomas
Example JSON data:
{ "name": "Hello", "slug": "hello", "url": "http://example.com/api/projects/hello/", "web": "https://weblate.org/", "web_url": "http://example.com/projects/hello/" }
- PATCH /api/projects/(string: project)/
Nuevo en la versión 4.3.
Edit a project by a PATCH request.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- PUT /api/projects/(string: project)/
Nuevo en la versión 4.3.
Edit a project by a PUT request.
- Parámetros
project (string) – URL semántico del proyecto
- DELETE /api/projects/(string: project)/
Nuevo en la versión 3.9.
Elimina un proyecto.
- Parámetros
project (string) – URL semántico del proyecto
- GET /api/projects/(string: project)/changes/
Returns a list of project changes. This is essentially a project scoped
GET /api/changes/
accepting same params.- Parámetros
project (string) – URL semántico del proyecto
- Response JSON Object
results (array) – array of component objects; see
GET /api/changes/(int:id)/
- GET /api/projects/(string: project)/repository/
Returns information about VCS repository status. This endpoint contains only an overall summary for all repositories for the project. To get more detailed status use
GET /api/components/(string:project)/(string:component)/repository/
.- Parámetros
project (string) – URL semántico del proyecto
- Response JSON Object
needs_commit (boolean) – whether there are any pending changes to commit
needs_merge (boolean) – whether there are any upstream changes to merge
needs_push (boolean) – whether there are any local changes to push
Example JSON data:
{ "needs_commit": true, "needs_merge": false, "needs_push": true }
- POST /api/projects/(string: project)/repository/
Efectúa la operación indicada en el repositorio del sistema de control de versiones.
- Parámetros
project (string) – URL semántico del proyecto
- Request JSON Object
operation (string) – Operation to perform: one of
push
,pull
,commit
,reset
,cleanup
,file-sync
- Response JSON Object
result (boolean) – resultado de la operación
CURL example:
curl \ -d operation=pull \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/repository/
JSON request example:
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"}
Ejemplo de respuesta en 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/
Devuelve un listado de componentes de traducción en el proyecto indicado.
- Parámetros
project (string) – URL semántico del proyecto
- Response JSON Object
results (array) – array of component objects; see
GET /api/components/(string:project)/(string:component)/
- POST /api/projects/(string: project)/components/
Nuevo en la versión 3.9.
Distinto en la versión 4.3: The
zipfile
anddocfile
parameters are now accepted for VCS-less components, see Archivos locales.Distinto en la versión 4.6: The cloned repositories are now automatically shared within a project using URL internos de Weblate. Use
disable_autoshare
to turn off this.Crea componentes de traducción en el proyecto indicado.
Consejo
Use URL internos de Weblate when creating multiple components from a single VCS repository.
Nota
Most of the component creation happens in the background. Check the
task_url
attribute of created component and follow the progress there.- Parámetros
project (string) – URL semántico del proyecto
- Form Parameters
file zipfile – ZIP file to upload into Weblate for translations initialization
file docfile – Documento para traducir
boolean disable_autoshare – Disables automatic repository sharing via URL internos de Weblate.
- Request JSON Object
object – Component parameters, see
GET /api/components/(string:project)/(string:component)/
- Response JSON Object
result (object) – Created component object; see
GET /api/components/(string:project)/(string:component)/
JSON can not be used when uploading the files using the
zipfile
anddocfile
parameters. The data has to be uploaded as multipart/form-data.CURL form request example:
curl \ --form docfile=@strings.html \ --form name=Weblate \ --form slug=weblate \ --form file_format=html \ --form new_lang=add \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
CURL JSON request example:
curl \ --data-binary '{ "branch": "main", "file_format": "po", "filemask": "po/*.po", "name": "Weblate", "slug": "weblate", "repo": "https://github.com/WeblateOrg/hello.git", "template": "", "new_base": "po/hello.pot", "vcs": "git" }' \ -H "Content-Type: application/json" \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
JSON request to create a new component from Git:
POST /api/projects/hello/components/ HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Authorization: Token TOKEN Content-Length: 20 { "branch": "main", "file_format": "po", "filemask": "po/*.po", "name": "Weblate", "slug": "weblate", "repo": "https://github.com/WeblateOrg/hello.git", "template": "", "new_base": "po/hello.pot", "vcs": "git" }
JSON request to create a new component from another one:
POST /api/projects/hello/components/ HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Authorization: Token TOKEN Content-Length: 20 { "file_format": "po", "filemask": "po/*.po", "name": "Weblate", "slug": "weblate", "repo": "weblate://weblate/hello", "template": "", "new_base": "po/hello.pot", "vcs": "git" }
Ejemplo de respuesta en 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.
Nuevo en la versión 3.8.
- Parámetros
project (string) – URL semántico del proyecto
- Response JSON Object
results (array) – array of translation statistics objects
language (string) – nombre del idioma
code (string) – código del idioma
total (int) – número total de cadenas
translated (int) – número de cadenas traducidas
translated_percent (float) – porcentaje de cadenas traducidas
total_words (int) – número total de palabras
translated_words (int) – número de palabras traducidas
words_percent (float) – porcentaje de palabras traducidas
- GET /api/projects/(string: project)/statistics/
Devuelve estadísticas sobre un proyecto.
Nuevo en la versión 3.8.
- Parámetros
project (string) – URL semántico del proyecto
- Response JSON Object
total (int) – número total de cadenas
translated (int) – número de cadenas traducidas
translated_percent (float) – porcentaje de cadenas traducidas
total_words (int) – número total de palabras
translated_words (int) – número de palabras traducidas
words_percent (float) – porcentaje de palabras traducidas
Componentes
Consejo
Use POST /api/projects/(string:project)/components/
to create new components.
- GET /api/components/
Devuelve un listado de componentes de traducción.
Ver también
Component object attributes are documented at
GET /api/components/(string:project)/(string:component)/
.
- GET /api/components/(string: project)/(string: component)/
Devuelve información relativa al componente de traducción.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Response JSON Object
project (object) – el proyecto de traducción; vea
GET /api/projects/(string:project)/
name (string) – Nombre de componente
slug (string) – «Slug» del componente
vcs (string) – Sistema de control de versiones
repo (string) – Repositorio de código fuente
git_export (string) – URL de repositorio exportado
branch (string) – Rama del repositorio
push_branch (string) – Rama a la que enviar
filemask (string) – Máscara de archivos
template (string) – Archivo de base monolingüe
edit_template (string) – Editar archivo de base
intermediate (string) – Archivo de idioma intermediario
new_base (string) – Plantilla para traducciones nuevas
file_format (string) – Formato de archivo
license (string) – Licencia de la traducción
agreement (string) – Acuerdo de contribuidor
new_lang (string) – Adición de traducciones nuevas
language_code_style (string) – Estilo de código de idioma
source_language (object) – objeto de idioma de origen; vea
GET /api/languages/(string:language)/
push (string) – URL de envío al repositorio
check_flags (string) – Indicadores de traducción
priority (string) – Prioridad
enforced_checks (string) – Comprobaciones obligatorias
restricted (string) – Acceso restringido
repoweb (string) – Explorador del repositorio
report_source_bugs (string) – Dirección para informar de errores en las cadenas de origen
merge_style (string) – Estilo de fusión
commit_message (string) – Commit, add, delete, merge and add-on messages
add_message (string) – Commit, add, delete, merge and add-on messages
delete_message (string) – Commit, add, delete, merge and add-on messages
merge_message (string) – Commit, add, delete, merge and add-on messages
addon_message (string) – Commit, add, delete, merge and add-on messages
allow_translation_propagation (string) – Permitir propagación de traducciones
enable_suggestions (string) – Activar sugerencias
suggestion_voting (string) – Votar sugerencias
suggestion_autoaccept (string) – Aceptar sugerencias automáticamente
push_on_commit (string) – Enviar al consignar
commit_pending_age (string) – Antigüedad de cambios por consignar
auto_lock_error (string) – Bloquear al producirse un error
language_regex (string) – Filtro de idioma
variant_regex (string) – Expresión regular de variantes
repository_url (string) – URL al estado del repositorio; vea
GET /api/components/(string:project)/(string:component)/repository/
translations_url (string) – URL a la lista de traducciones; vea
GET /api/components/(string:project)/(string:component)/translations/
lock_url (string) – URL to lock status; see
GET /api/components/(string:project)/(string:component)/lock/
changes_list_url (string) – URL to changes list; see
GET /api/components/(string:project)/(string:component)/changes/
task_url (string) – URL to a background task (if any); see
GET /api/tasks/(str:uuid)/
Example JSON data:
{ "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "slug": "weblate", "project": { "name": "Hello", "slug": "hello", "source_language": { "code": "en", "direction": "ltr", "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.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
source_language (string) – Código del idioma de origen del proyecto (opcional)
- Request JSON Object
name (string) – nombre del componente
slug (string) – slug of component
repo (string) – VCS repository URL
CURL example:
curl \ --data-binary '{"name": "new name"}' \ -H "Content-Type: application/json" \ -H "Authorization: Token TOKEN" \ PATCH http://example.com/api/projects/hello/components/
JSON request example:
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" }
Ejemplo de respuesta en 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.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Request JSON Object
branch (string) – Rama del repositorio de control de versiones
file_format (string) – formato de archivo de las traducciones
filemask (string) – mask of translation files in the repository
name (string) – nombre del componente
slug (string) – slug of component
repo (string) – VCS repository URL
template (string) – base file for monolingual translations
new_base (string) – base file for adding new translations
vcs (string) – sistema de control de versiones
- DELETE /api/components/(string: project)/(string: component)/
Nuevo en la versión 3.9.
Elimina un componente.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- 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.- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Response JSON Object
results (array) – array of component objects; see
GET /api/changes/(int:id)/
- GET /api/components/(string: project)/(string: component)/file/
Nuevo en la versión 4.9.
Downloads all available translations associated with the component as an archive file using the requested format.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Query Parameters
format (string) – The archive format to use; If not specified, defaults to
zip
; Supported formats:zip
q (string) – Filter downloaded strings, see Página de Búsqueda.
- GET /api/components/(string: project)/(string: component)/screenshots/
Devuelve un listado de las capturas de pantalla del componente.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Response JSON Object
results (array) – array of component screenshots; see
GET /api/screenshots/(int:id)/
- GET /api/components/(string: project)/(string: component)/lock/
Devuelve el estado de bloqueo del componente.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Response JSON Object
locked (boolean) – whether component is locked for updates
Example JSON data:
{ "locked": false }
- POST /api/components/(string: project)/(string: component)/lock/
Establece el estado de bloqueo del componente.
Response is same as
GET /api/components/(string:project)/(string:component)/lock/
.- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Request JSON Object
lock – Boolean whether to lock or not.
CURL example:
curl \ -d lock=true \ -H "Authorization: Token TOKEN" \ http://example.com/api/components/hello/weblate/repository/
JSON request example:
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}
Ejemplo de respuesta en 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/
.- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Response JSON Object
needs_commit (boolean) – whether there are any pending changes to commit
needs_merge (boolean) – whether there are any upstream changes to merge
needs_push (boolean) – whether there are any local changes to push
remote_commit (string) – Remote commit information
status (string) – VCS repository status as reported by VCS
merge_failure – Text describing merge failure or null if there is none
- POST /api/components/(string: project)/(string: component)/repository/
Performs the given operation on a VCS repository.
See
POST /api/projects/(string:project)/repository/
for documentation.- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Request JSON Object
operation (string) – Operation to perform: one of
push
,pull
,commit
,reset
,cleanup
- Response JSON Object
result (boolean) – resultado de la operación
CURL example:
curl \ -d operation=pull \ -H "Authorization: Token TOKEN" \ http://example.com/api/components/hello/weblate/repository/
JSON request example:
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"}
Ejemplo de respuesta en 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/
Descarga el archivo de base para traducciones monolingües.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- GET /api/components/(string: project)/(string: component)/new_template/
Descarga el archivo de plantilla para traducciones nuevas.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- GET /api/components/(string: project)/(string: component)/translations/
Devuelve un listado de objetos de traducción en el componente indicado.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Response JSON Object
results (array) – array of translation objects; see
GET /api/translations/(string:project)/(string:component)/(string:language)/
- POST /api/components/(string: project)/(string: component)/translations/
Creates new translation in the given component.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Request JSON Object
language_code (string) – translation language code; see
GET /api/languages/(string:language)/
- Response JSON Object
result (object) – new translation object created
CURL example:
curl \ -d language_code=cs \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
JSON request example:
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"}
Ejemplo de respuesta en 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/
Devuelve estadísticas paginadas para todas las traducciones del componente.
Nuevo en la versión 2.7.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Response JSON Object
results (array) – array of translation statistics objects; see
GET /api/translations/(string:project)/(string:component)/(string:language)/statistics/
- GET /api/components/(string: project)/(string: component)/links/
Returns projects linked with a component.
Nuevo en la versión 4.5.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Response JSON Object
projects (array) – proyectos asociados; vea
GET /api/projects/(string:project)/
- POST /api/components/(string: project)/(string: component)/links/
Associate project with a component.
Nuevo en la versión 4.5.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
- Form Parameters
string project_slug – «Slug» del proyecto
- DELETE /api/components/(string: project)/(string: component)/links/(string: project_slug)/
Remove association of a project with a component.
Nuevo en la versión 4.5.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
project_slug (string) – Slug of the project to remove
Traducciones
- GET /api/translations/
Devuelve un listado de traducciones.
Ver también
Translation object attributes are documented at
GET /api/translations/(string:project)/(string:component)/(string:language)/
.
- GET /api/translations/(string: project)/(string: component)/(string: language)/
Devuelve información relativa a una traducción.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- Response JSON Object
component (object) – component object; see
GET /api/components/(string:project)/(string:component)/
failing_checks (int) – número de cadenas que fallan una comprobación
failing_checks_percent (float) – porcentaje de cadenas que fallan una comprobación
failing_checks_words (int) – número de palabras con comprobaciones fallidas
filename (string) – nombre de archivo de la traducción
fuzzy (int) – number of fuzzy (marked for edit) strings
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) – número de cadenas con un comentario
have_suggestion (int) – número de cadenas con una sugerencia
is_template (boolean) – indica si la traducción tiene una base monolingüe
language (object) – objeto de idioma de origen; vea
GET /api/languages/(string:language)/
language_code (string) – el código de idioma utilizado en el repositorio; puede ser distinto del código de idioma del objeto de idioma
last_author (string) – nombre del último autor
last_change (timestamp) – cronomarcador del último cambio
revision (string) – revision hash for the file
share_url (string) – URL para compartir que va a la página de participación
total (int) – número total de cadenas
total_words (int) – número total de palabras
translate_url (string) – URL para traducir
translated (int) – número de cadenas traducidas
translated_percent (float) – porcentaje de cadenas traducidas
translated_words (int) – número de palabras traducidas
repository_url (string) – URL to repository status; see
GET /api/translations/(string:project)/(string:component)/(string:language)/repository/
file_url (string) – URL to file object; see
GET /api/translations/(string:project)/(string:component)/(string:language)/file/
changes_list_url (string) – URL to changes list; see
GET /api/translations/(string:project)/(string:component)/(string:language)/changes/
units_list_url (string) – URL to strings list; see
GET /api/translations/(string:project)/(string:component)/(string:language)/units/
Example JSON data:
{ "component": { "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "new_base": "", "project": { "name": "Hello", "slug": "hello", "source_language": { "code": "en", "direction": "ltr", "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)/
Nuevo en la versión 3.9.
Elimina una traducción.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- 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.- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- Response JSON Object
results (array) – array of component objects; see
GET /api/changes/(int:id)/
- GET /api/translations/(string: project)/(string: component)/(string: language)/units/
Devuelve un listado de unidades de traducción.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
q (string) – Search query string Búsquedas (optional)
- Response JSON Object
results (array) – array of component objects; see
GET /api/units/(int:id)/
- POST /api/translations/(string: project)/(string: component)/(string: language)/units/
Add new monolingual unit.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- Request JSON Object
key (string) – Nombre de la unidad de traducción
value (array) – El valor de la unidad de traducción
Ver también
- POST /api/translations/(string: project)/(string: component)/(string: language)/autotranslate/
Trigger automatic translation.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- Request JSON Object
mode (string) – Modo de traducción automatizada
filter_type (string) – Automatic translation filter type
auto_source (string) – Automatic translation source -
mt
orothers
component (string) – Permita que el proyecto contribuya a la memoria de traducción compartida para obtener acceso a componentes adicionales.
engines (array) – Motores de traducción automática
threshold (string) – Umbral de puntuación
- 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 Descargar traducciones).Nota
This API endpoint uses different logic for output than rest of API as it operates on whole file rather than on data. Set of accepted
format
parameter differs and without such parameter you get translation file as stored in VCS.- Query Parameters
format – File format to use; if not specified no format conversion happens; supported file formats:
po
,mo
,xliff
,xliff11
,tbx
,csv
,xlsx
,json
,aresource
,strings
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- POST /api/translations/(string: project)/(string: component)/(string: language)/file/
Upload new file with translations.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- Form Parameters
string conflict – How to deal with conflicts (
ignore
,replace-translated
orreplace-approved
)file file – Archivo cargado
string email – Correo electrónico del autor
string author – Nombre del autor
string method – Upload method (
translate
,approve
,suggest
,fuzzy
,replace
,source
,add
), see Métodos de importaciónstring fuzzy – Fuzzy (marked for edit) strings processing (empty,
process
,approve
)
CURL example:
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/
.- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- POST /api/translations/(string: project)/(string: component)/(string: language)/repository/
Efectúa la operación indicada en el repositorio del sistema de control de versiones.
See
POST /api/projects/(string:project)/repository/
for documentation.- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- Request JSON Object
operation (string) – Operation to perform: one of
push
,pull
,commit
,reset
,cleanup
- Response JSON Object
result (boolean) – resultado de la operación
- GET /api/translations/(string: project)/(string: component)/(string: language)/statistics/
Devuelve estadísticas detalladas sobre la traducción.
Nuevo en la versión 2.7.
- Parámetros
project (string) – URL semántico del proyecto
component (string) – URL semántico del componente
language (string) – Código de idioma de la traducción
- Response JSON Object
code (string) – código del idioma
failing (int) – número de comprobaciones fallidas
failing_percent (float) – porcentaje de comprobaciones fallidas
fuzzy (int) – number of fuzzy (marked for edit) strings
fuzzy_percent (float) – percentage of fuzzy (marked for edit) strings
total_words (int) – número total de palabras
translated_words (int) – número de palabras traducidas
last_author (string) – nombre del último autor
last_change (timestamp) – fecha del último cambio
name (string) – nombre del idioma
total (int) – número total de cadenas
translated (int) – número de cadenas traducidas
translated_percent (float) – porcentaje de cadenas traducidas
url (string) – URL to access the translation (engagement URL)
url_translate (string) – URL to access the translation (real translation URL)
Unidades
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.
Nuevo en la versión 2.10.
- GET /api/units/
Devuelve un listado de unidades de traducción.
Ver también
Unit object attributes are documented at
GET /api/units/(int:id)/
.
- GET /api/units/(int: id)/
Distinto en la versión 4.3: The
target
andsource
are now arrays to properly handle plural strings.Returns information about translation unit.
- Parámetros
id (int) – Identificador de unidad
- Response JSON Object
translation (string) – URL de un objeto de traducción relacionado
source (array) – cadena de origen
previous_source (string) – previous source string used for fuzzy matching
target (array) – cadena de destino
id_hash (string) – identificador único de la unidad
content_hash (string) – identificador único de la cadena de origen
location (string) – ubicación de la unidad en el código fuente
context (string) – contexto de la unidad de traducción
note (string) – nota de la unidad de traducción
flags (string) – indicadores de la unidad de traducción
state (int) – unit state, 0 - untranslated, 10 - needs editing, 20 - translated, 30 - approved, 100 - read only
fuzzy (boolean) – si la unidad está marcada como pendiente de trabajo o revisión
translated (boolean) – indica si la unidad está traducida
approved (boolean) – indica si la traducción está aprobada
position (int) – posición de la unidad en el archivo de traducción
has_suggestion (boolean) – indica si la unidad tiene sugerencias
has_comment (boolean) – indica si la unidad tiene comentarios
has_failing_check (boolean) – indica si la unidad tiene comprobaciones fallidas
num_words (int) – número de palabras de origen
priority (int) – prioridad de traducción; 100 es la predeterminada
id (int) – identificador de unidad
explanation (string) – String explanation, available on source units, see Información adicional sobre las cadenas de origen
extra_flags (string) – Additional string flags, available on source units, see Personalizar el comportamiento mediante indicadores
web_url (string) – URL para editar la unidad
souce_unit (string) – Source unit link; see
GET /api/units/(int:id)/
- PATCH /api/units/(int: id)/
Nuevo en la versión 4.3.
Performs partial update on translation unit.
- Parámetros
id (int) – Identificador de unidad
- Request JSON Object
state (int) – unit state, 0 - untranslated, 10 - needs editing, 20 - translated, 30 - approved (need review workflow enabled, see Revisores dedicados)
target (array) – cadena de destino
explanation (string) – String explanation, available on source units, see Información adicional sobre las cadenas de origen
extra_flags (string) – Additional string flags, available on source units, see Personalizar el comportamiento mediante indicadores
- PUT /api/units/(int: id)/
Nuevo en la versión 4.3.
Performs full update on translation unit.
- Parámetros
id (int) – Identificador de unidad
- Request JSON Object
state (int) – unit state, 0 - untranslated, 10 - needs editing, 20 - translated, 30 - approved (need review workflow enabled, see Revisores dedicados)
target (array) – cadena de destino
explanation (string) – String explanation, available on source units, see Información adicional sobre las cadenas de origen
extra_flags (string) – Additional string flags, available on source units, see Personalizar el comportamiento mediante indicadores
- DELETE /api/units/(int: id)/
Nuevo en la versión 4.3.
Deletes a translation unit.
- Parámetros
id (int) – Identificador de unidad
Cambios
Nuevo en la versión 2.10.
- GET /api/changes/
Distinto en la versión 4.1: Filtering of changes was introduced in the 4.1 release.
Devuelve un listado de cambios a la traducción.
Ver también
Change object attributes are documented at
GET /api/changes/(int:id)/
.- Query Parameters
user (string) – Username of user to filters
action (int) – Action to filter, can be used several times
timestamp_after (timestamp) – ISO 8601 formatted timestamp to list changes after
timestamp_before (timestamp) – ISO 8601 formatted timestamp to list changes before
- GET /api/changes/(int: id)/
Devuelve información relativa a un cambio de traducción.
- Parámetros
id (int) – Identificador de cambio
- Response JSON Object
unit (string) – URL of a related unit object
translation (string) – URL de un objeto de traducción relacionado
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) – cronomarcador de suceso
action (int) – identificación numérica de acción
action_name (string) – descripción de texto de acción
target (string) – event changed text or detail
id (int) – change identifier
Capturas de pantalla
Nuevo en la versión 2.14.
- GET /api/screenshots/
Devuelve un listado de información de cadenas de capturas de pantalla.
Ver también
Los atributos de los objetos de captura de pantalla están documentados en
GET /api/screenshots/(int:id)/
.
- GET /api/screenshots/(int: id)/
Devuelve información relativa a los datos de una captura de pantalla.
- Parámetros
id (int) – Identificador de captura de pantalla
- Response JSON Object
name (string) – nombre de una captura de pantalla
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/
Descargar la imagen de la captura de pantalla.
- Parámetros
id (int) – Identificador de captura de pantalla
- POST /api/screenshots/(int: id)/file/
Reemplazar la imagen de la captura de pantalla.
- Parámetros
id (int) – Identificador de captura de pantalla
- Form Parameters
file image – Archivo cargado
CURL example:
curl -X POST \ -F image=@image.png \ -H "Authorization: Token TOKEN" \ http://example.com/api/screenshots/1/file/
- POST /api/screenshots/(int: id)/units/
Asociar la cadena de origen con una captura de pantalla.
- Parámetros
id (int) – Identificador de captura de pantalla
- Form Parameters
string unit_id – Identificador de unidad
- Response JSON Object
name (string) – nombre de una captura de pantalla
translation (string) – URL de un objeto de traducción relacionado
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)
Quitar la asociación entre la cadena de origen y la captura de pantalla.
- Parámetros
id (int) – Identificador de captura de pantalla
unit_id – Id. de unidad de cadena de origen
- POST /api/screenshots/
Crea una captura de pantalla nueva.
- Form Parameters
file image – Archivo cargado
string name – Nombre de captura de pantalla
string project_slug – «Slug» del proyecto
string component_slug – «Slug» del componente
string language_code – Código de idioma
- Response JSON Object
name (string) – nombre de una captura de pantalla
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)/
Editar información parcial relativa a una captura de pantalla.
- Parámetros
id (int) – Identificador de captura de pantalla
- Response JSON Object
name (string) – nombre de una captura de pantalla
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)/
Editar información completa relativa a una captura de pantalla.
- Parámetros
id (int) – Identificador de captura de pantalla
- Response JSON Object
name (string) – nombre de una captura de pantalla
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)/
Eliminar captura de pantalla.
- Parámetros
id (int) – Identificador de captura de pantalla
Complementos
Nuevo en la versión 4.4.1.
- GET /api/addons/
Devuelve un listado de complementos.
Ver también
Los atributos de objeto de complemento se documentan en
GET /api/addons/(int:id)/
.
- GET /api/addons/(int: id)/
Devuelve información relativa a los datos de un complemento.
- Parámetros
id (int) – Add-on ID
- Response JSON Object
name (string) – nombre de un complemento
component (string) – URL of a related component object
configuration (object) – Configuración opcional del complemento
Ver también
- POST /api/components/(string: project)/(string: component)/addons/
Crea un complemento nuevo.
- Parámetros
project_slug (string) – «Slug» del proyecto
component_slug (string) – «Slug» del componente
- Request JSON Object
name (string) – nombre de un complemento
configuration (object) – Configuración opcional del complemento
- PATCH /api/addons/(int: id)/
Editar información parcial relativa a un complemento.
- Parámetros
id (int) – Add-on ID
- Response JSON Object
configuration (object) – Configuración opcional del complemento
- PUT /api/addons/(int: id)/
Editar información completa relativa a un complemento.
- Parámetros
id (int) – Add-on ID
- Response JSON Object
configuration (object) – Configuración opcional del complemento
- DELETE /api/addons/(int: id)/
Eliminar el complemento.
- Parámetros
id (int) – Add-on ID
Listas de componentes
Nuevo en la versión 4.0.
- GET /api/component-lists/
Devuelve un listado de listas de componentes.
Ver también
Component list object attributes are documented at
GET /api/component-lists/(str:slug)/
.
- GET /api/component-lists/(str: slug)/
Devuelve información relativa a la lista de componentes.
- Parámetros
slug (string) – Component list slug
- Response JSON Object
name (string) – nombre de una lista de componentes
slug (string) – slug of a component list
show_dashboard (boolean) – whether to show it on a dashboard
components (array) – link to associated components; see
GET /api/components/(string:project)/(string:component)/
auto_assign (array) – reglas de asignación automáticas
- PUT /api/component-lists/(str: slug)/
Cambia los parámetros de la lista de componentes.
- Parámetros
slug (string) – Component list slug
- Request JSON Object
name (string) – nombre de una lista de componentes
slug (string) – slug of a component list
show_dashboard (boolean) – whether to show it on a dashboard
- PATCH /api/component-lists/(str: slug)/
Cambia los parámetros de la lista de componentes.
- Parámetros
slug (string) – Component list slug
- Request JSON Object
name (string) – nombre de una lista de componentes
slug (string) – slug of a component list
show_dashboard (boolean) – whether to show it on a dashboard
- DELETE /api/component-lists/(str: slug)/
Elimina la lista de componentes.
- Parámetros
slug (string) – Component list slug
- POST /api/component-lists/(str: slug)/components/
Associate component with a component list.
- Parámetros
slug (string) – Component list slug
- Form Parameters
string component_id – Identificador de componente
- DELETE /api/component-lists/(str: slug)/components/(str: component_slug)
Disassociate a component from the component list.
- Parámetros
slug (string) – Component list slug
component_slug (string) – «Slug» del componente
Glosario
Distinto en la versión 4.5: Glossaries are now stored as regular components, translations and strings, please use respective API instead.
Tareas
Nuevo en la versión 4.4.
- GET /api/tasks/
La enumeración de las tareas no está disponible actualmente.
- GET /api/tasks/(str: uuid)/
Devuelve información relativa a una tarea
- Parámetros
uuid (string) – UUID de la tarea
- Response JSON Object
completed (boolean) – Indica si la tarea se ha completado
progress (int) – Progreso de la tarea expresado en porcentaje
result (object) – Resultado de la tarea o detalles de progreso
log (string) – Registro de tareas
Metrics
- GET /api/metrics/
Returns server metrics.
- Response JSON Object
units (int) – Number of units
units_translated (int) – Number of translated units
users (int) – Number of users
changes (int) – Cantidad de cambios
projects (int) – Number of projects
components" (int) – Número de componentes
translations" (int) – Number of translations
languages" (int) – Number of used languages
checks" (int) – Number of triggered quality checks
configuration_errors" (int) – Number of configuration errors
suggestions" (int) – Number of pending suggestions
celery_queues (object) – Lengths of Celery queues, see Tareas en segundo plano con Celery
name (string) – Configured server name
Actuadores de notificación
Los actuadores de notificación permiten a aplicaciones externas notificar a Weblate de que se ha actualizado un repositorio de control de versiones.
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)/
Obsoleto desde la versión 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)/
Obsoleto desde la versión 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.
Nota
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.
Ver también
- Recibir cambios automáticamente de GitHub
For instruction on setting up GitHub integration
- https://docs.github.com/en/get-started/customizing-your-github-workflow/exploring-integrations/about-webhooks
Información genérica sobre los actuadores web de GitHub
ENABLE_HOOKS
Para activar actuadores en todo Weblate
- POST /hooks/gitlab/
Special hook for handling GitLab notifications and automatically updating matching components.
Ver también
- Automatically receiving changes from GitLab
For instruction on setting up GitLab integration
- https://docs.gitlab.com/ee/user/project/integrations/webhooks.html
Información genérica sobre los actuadores web de GitLab
ENABLE_HOOKS
Para activar actuadores en todo Weblate
- POST /hooks/bitbucket/
Special hook for handling Bitbucket notifications and automatically updating matching components.
Ver también
- Recibir cambios automáticamente de Bitbucket
For instruction on setting up Bitbucket integration
- https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/
Información genérica sobre los actuadores web de Bitbucket
ENABLE_HOOKS
Para activar actuadores en todo Weblate
- POST /hooks/pagure/
Nuevo en la versión 3.3.
Special hook for handling Pagure notifications and automatically updating matching components.
Ver también
- Recibir cambios automáticamente de Pagure
For instruction on setting up Pagure integration
- https://docs.pagure.org/pagure/usage/using_webhooks.html
Información genérica sobre los actuadores web de Pagure
ENABLE_HOOKS
Para activar actuadores en todo Weblate
- POST /hooks/azure/
Nuevo en la versión 3.8.
Special hook for handling Azure Repos notifications and automatically updating matching components.
Ver también
- Recibir cambios automáticamente de Azure Repos
For instruction on setting up Azure integration
- https://docs.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops
Información genérica sobre los actuadores web de Azure Repos
ENABLE_HOOKS
Para activar actuadores en todo Weblate
- POST /hooks/gitea/
Nuevo en la versión 3.9.
Special hook for handling Gitea Webhook notifications and automatically updating matching components.
Ver también
- Recibir cambios automáticamente de Gitea
For instruction on setting up Gitea integration
- https://docs.gitea.io/en-us/webhooks/
Información genérica sobre los actuadores web de Gitea
ENABLE_HOOKS
Para activar actuadores en todo Weblate
- POST /hooks/gitee/
Nuevo en la versión 3.9.
Special hook for handling Gitee Webhook notifications and automatically updating matching components.
Ver también
- Recibir cambios automáticamente de Gitee
For instruction on setting up Gitee integration
- https://gitee.com/help/categories/40
Información genérica sobre los actuadores web de Gitee
ENABLE_HOOKS
Para activar actuadores en todo Weblate
Exportaciones
Weblate brinda diversas exportaciones para permitirle un tratamiento posterior de sus datos.
- GET /exports/stats/(string: project)/(string: component)/
- Query Parameters
format (string) – Formato de salida:
json
ocsv
Obsoleto desde la versión 2.6: Utilice
GET /api/components/(string:project)/(string:component)/statistics/
yGET /api/translations/(string:project)/(string:component)/(string:language)/statistics/
en su lugar; esto permite además el acceso a los proyectos controlados por ACL.Recupera las estadísticas del componente indicado en el formato que se indique.
Ejemplo de solicitud:
GET /exports/stats/weblate/main/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript
Ejemplo de respuesta:
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/" } ]
Sindicación RSS
Las modificaciones a las traducciones se exportan en suministros RSS.
- GET /exports/rss/(string: project)/(string: component)/(string: language)/
Recupera el suministro RSS de los cambios recientes de una traducción.
- GET /exports/rss/(string: project)/(string: component)/
Recupera el suministro RSS de los cambios recientes de un componente.
- GET /exports/rss/(string: project)/
Recupera el suministro RSS de los cambios recientes de un proyecto.
- GET /exports/rss/language/(string: language)/
Recupera el suministro RSS de los cambios recientes de un idioma.
- GET /exports/rss/
Recupera el suministro RSS de los cambios recientes de la instalación de Weblate.
Ver también