single: REST single: API
2.6
The API is available since Weblate 2.6.
The API is accessible on the /api/
URL and it is based on Django REST framework. You can use it directly or by wlc
.
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:
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/
For the :http:method:POST method the parameters can be specified either as form submission (application/x-www-form-urlencoded
) or as JSON (application/json
).
Form request example:
http
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:
http
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/
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.
4.0
4.0
2.10
2.10
2.14
4.0
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 :http:post:/api/projects/(string:project)/repository/ for documentation.
Weblate provides various exports to allow you to further process the data.
Changes in translations are exported in RSS feeds.