Weblate の REST API

バージョン 2.6 で追加: REST API は、Weblate 2.6 から使用できる。

API は /api/ URL からアクセスでき、Django REST framework がベースになっています。直接もしくは、Weblate クライアント から使用できます。

認証と一般的なパラメータ

公開プロジェクト API は認証なしで使用できますが、認証されていないリクエストは大幅に制限されます(デフォルトでは、毎日100リクエスト)。制限回避のために、認証の使用を推奨します。認証では、ユーザー情報ページから取得できるトークンを使用します。Authorization ヘッダーで使用してください:

ANY /

API に対する一般的なリクエストの動作であり、ヘッダ、ステータスコード、パラメータはすべてのエンドポイントにも適用します。

クエリ パラメータ
  • format -- レスポンス形式(Accept を上書きします)。指定できる値は REST フレームワークの設定に依存します。デフォルトでは json および api に対応。後者には、API 用の Web ブラウザー インターフェースを提供します。

リクエスト ヘッダー
  • Accept -- レスポンスの内容の型は Accept ヘッダーに依存する

  • Authorization -- optional token to authenticate as Authorization: Token YOUR-TOKEN

レスポンス ヘッダー
  • Content-Type -- リクエストの Accept ヘッダーに依存する

  • Allow -- オブジェクトで許可されている HTTP メソッドのリスト

レスポンス JSON オブジェクト
  • detail (string) -- 結果の詳細な説明(200 OK 以外の HTTP ステータス コードの場合)

  • count (int) -- オブジェクト リストの合計項目数

  • next (string) -- オブジェクト リストの次のページの URL

  • previous (string) -- オブジェクト リストの前のページの URL

  • results (array) -- オブジェクト リストの結果

  • url (string) -- このリソースへの API を使用したアクセス用の URL

  • web_url (string) -- このリソースへの Web ブラウザを使用したアクセス用の URL

ステータスコード
  • 200 OK -- リクエストが正常に処理された場合

  • 201 Created -- 新しいオブジェクトが正常に作成された場合

  • 204 No Content -- オブジェクトが正常に削除された場合

  • 400 Bad Request -- フォーム パラメータが不足している場合

  • 403 Forbidden -- アクセスが拒否された場合

  • 429 Too Many Requests -- スロットルが設定されている場合

認証の例

リクエストの例:

GET /api/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Authorization: Token YOUR-TOKEN

レスポンスの例:

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

curl \
    -H "Authorization: Token TOKEN" \
    https://example.com/api/

パラメータの受け渡し例

POST メソッドでは、フォーム送信(application/x-www-form-urlencoded)または JSON(application/json)のどちらかでパラメータを指定します。

フォーム リクエストの例:

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 リクエストの例:

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

curl \
    -d operation=pull \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/components/hello/weblate/repository/

CURL JSON の例:

curl \
    --data-binary '{"operation":"pull"}' \
    -H "Content-Type: application/json" \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/components/hello/weblate/repository/

API 接続制限

API リクエストは接続制限しています。デフォルト設定では、匿名ユーザーの場合は 100 リクエスト / 日、認証済みユーザーの場合は 5000 リクエスト / 時間に制限しています。

接続制限は settings.py で変更できます。詳細な設定方法は、Throttling in Django REST framework documentation を確認してください。

ヘッダーで報告される接続制限の状態:

X-RateLimit-Limit

実行するリクエストの接続制限回数

X-RateLimit-Remaining

リクエストが制限されるまでの回数

X-RateLimit-Reset

接続制限がリセットされるまでの秒数

バージョン 4.1 で変更: 接続制限状態のヘッダーの追加。

API エントリ ポイント

GET /api/

API ルート エントリ ポイント。

リクエストの例:

GET /api/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Authorization: Token YOUR-TOKEN

レスポンスの例:

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

ユーザー

バージョン 4.0 で追加.

GET /api/users/

返り値は、ユーザーの管理権限を持っている場合は、ユーザーの一覧です。持っていない場合は、自分の詳細のみになります。

参考

ユーザー オブジェクトの属性については、GET /api/users/(str:username)/ にドキュメントがあります。

POST /api/users/

新しいユーザーを作成します。

パラメータ
  • username (string) -- ユーザー名

  • full_name (string) -- ユーザーのフルネーム

  • email (string) -- ユーザーのメールアドレス

  • is_superuser (boolean) -- ユーザーがスーパーユーザーかどうか? (オプション)

  • is_active (boolean) -- ユーザーが有効かどうか? (オプション)

GET /api/users/(str: username)/

返り値は、ユーザーの情報です。

パラメータ
  • username (string) -- ユーザーのユーザー名

レスポンス JSON オブジェクト
  • username (string) -- ユーザーのユーザー名

  • full_name (string) -- ユーザーのフルネーム

  • email (string) -- ユーザーのメールアドレス

  • is_superuser (boolean) -- ユーザーがスーパーユーザーかどうか

  • is_active (boolean) -- ユーザーが有効かどうか

  • date_joined (string) -- ユーザー登録日

  • groups (array) -- 関連するグループへのリンク。参照: GET /api/groups/(int:id)/

JSON データの例:

{
    "email": "user@example.com",
    "full_name": "Example User",
    "username": "exampleusername",
    "groups": [
        "http://example.com/api/groups/2/",
        "http://example.com/api/groups/3/"
    ],
    "is_superuser": true,
    "is_active": true,
    "date_joined": "2020-03-29T18:42:42.617681Z",
    "url": "http://example.com/api/users/exampleusername/",
    "statistics_url": "http://example.com/api/users/exampleusername/statistics/"
}
PUT /api/users/(str: username)/

ユーザーのパラメータを変更します。

パラメータ
  • username (string) -- ユーザーのユーザー名

レスポンス JSON オブジェクト
  • username (string) -- ユーザーのユーザー名

  • full_name (string) -- ユーザーのフルネーム

  • email (string) -- ユーザーのメールアドレス

  • is_superuser (boolean) -- ユーザーがスーパーユーザーかどうか

  • is_active (boolean) -- ユーザーが有効かどうか

  • date_joined (string) -- ユーザー登録日

PATCH /api/users/(str: username)/

ユーザーのパラメータを変更します。

パラメータ
  • username (string) -- ユーザーのユーザー名

レスポンス JSON オブジェクト
  • username (string) -- ユーザーのユーザー名

  • full_name (string) -- ユーザーのフルネーム

  • email (string) -- ユーザーのメールアドレス

  • is_superuser (boolean) -- ユーザーがスーパーユーザーかどうか

  • is_active (boolean) -- ユーザーが有効かどうか

  • date_joined (string) -- ユーザー登録日

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

ユーザーのすべての情報を削除し、ユーザーを無効にします。

パラメータ
  • username (string) -- ユーザーのユーザー名

POST /api/users/(str: username)/groups/

ユーザーをグループに設定します。

パラメータ
  • username (string) -- ユーザーのユーザー名

フォーム パラメーター
  • string group_id -- 固有のグループ ID

GET /api/users/(str: username)/statistics/

ユーザーの統計情報を一覧表示します。

パラメータ
  • username (string) -- ユーザーのユーザー名

レスポンス JSON オブジェクト
  • translated (int) -- ユーザーごとの翻訳数

  • suggested (int) -- ユーザーごとの提案数

  • uploaded (int) -- ユーザーごとのアップロード数

  • commented (int) -- ユーザーごとのコメント数

  • languages (int) -- ユーザーごとの翻訳可能な言語数

GET /api/users/(str: username)/notifications/

ユーザーのサブスクリプションを一覧表示します。

パラメータ
  • username (string) -- ユーザーのユーザー名

POST /api/users/(str: username)/notifications/

ユーザーにサブスクリプションを関連付けます。

パラメータ
  • username (string) -- ユーザーのユーザー名

リクエスト JSON オブジェクト
  • notification (string) -- 登録中の通知の名前

  • scope (int) -- 選択肢の中で有効な通知する範囲

  • frequency (int) -- 通知の頻度の選択

GET /api/users/(str: username)/notifications/(int: subscription_id)/

ユーザーに設定中のサブスクリプションを取得します。

パラメータ
  • username (string) -- ユーザーのユーザー名

  • subscription_id (int) -- 登録中の通知 ID

PUT /api/users/(str: username)/notifications/(int: subscription_id)/

ユーザーに設定されたサブスクリプションを編集します。

パラメータ
  • username (string) -- ユーザーのユーザー名

  • subscription_id (int) -- 登録中の通知 ID

リクエスト JSON オブジェクト
  • notification (string) -- 登録中の通知の名前

  • scope (int) -- 選択肢の中で有効な通知する範囲

  • frequency (int) -- 通知の頻度の選択

PATCH /api/users/(str: username)/notifications/(int: subscription_id)/

ユーザーに設定されたサブスクリプションを編集します。

パラメータ
  • username (string) -- ユーザーのユーザー名

  • subscription_id (int) -- 登録中の通知 ID

リクエスト JSON オブジェクト
  • notification (string) -- 登録中の通知の名前

  • scope (int) -- 選択肢の中で有効な通知する範囲

  • frequency (int) -- 通知の頻度の選択

DELETE /api/users/(str: username)/notifications/(int: subscription_id)/

ユーザーに設定されたサブスクリプションを削除します。

パラメータ
  • username (string) -- ユーザーのユーザー名

  • subscription_id -- 登録中の通知の名前

  • subscription_id -- int

グループ

バージョン 4.0 で追加.

GET /api/groups/

返り値は、グループの管理権限がある場合は、グループの一覧です。権限がない場合は、指定したユーザーが所属しているグループのみになります。

参考

グループ オブジェクトの属性については、GET /api/groups/(int:id)/ にドキュメントがあります。

POST /api/groups/

新しいグループを作成します。

パラメータ
  • name (string) -- グループ名

  • project_selection (int) -- 指定した選択肢から選択したプロジェクトのグループ

  • language_selection (int) -- 指定した選択肢から選択した言語のグループ

GET /api/groups/(int: id)/

返り値は、グループの情報です。

パラメータ
  • id (int) -- グループ ID

レスポンス JSON オブジェクト

JSON データの例:

{
    "name": "Guests",
    "project_selection": 3,
    "language_selection": 1,
    "url": "http://example.com/api/groups/1/",
    "roles": [
        "http://example.com/api/roles/1/",
        "http://example.com/api/roles/2/"
    ],
    "languages": [
        "http://example.com/api/languages/en/",
        "http://example.com/api/languages/cs/",
    ],
    "projects": [
        "http://example.com/api/projects/demo1/",
        "http://example.com/api/projects/demo/"
    ],
    "componentlist": "http://example.com/api/component-lists/new/",
    "components": [
        "http://example.com/api/components/demo/weblate/"
    ]
}
PUT /api/groups/(int: id)/

グループ パラメータを変更します。

パラメータ
  • id (int) -- グループ ID

レスポンス JSON オブジェクト
  • name (string) -- グループ名

  • project_selection (int) -- 整数 プロジェクトのグループ番号

  • language_selection (int) -- 整数 言語のグループ番号

PATCH /api/groups/(int: id)/

グループ パラメータを変更します。

パラメータ
  • id (int) -- グループ ID

レスポンス JSON オブジェクト
  • name (string) -- グループ名

  • project_selection (int) -- 整数 プロジェクトのグループ番号

  • language_selection (int) -- 整数 言語のグループ番号

DELETE /api/groups/(int: id)/

グループを削除します。

パラメータ
  • id (int) -- グループ ID

POST /api/groups/(int: id)/roles/

グループにロールを関連付けます。

パラメータ
  • id (int) -- グループ ID

フォーム パラメーター
  • string role_id -- 固有のロール ID

POST /api/groups/(int: id)/components/

グループにコンポーネントを関連付けます。

パラメータ
  • id (int) -- グループ ID

フォーム パラメーター
  • string component_id -- 固有のコンポーネント ID

DELETE /api/groups/(int: id)/components/(int: component_id)

グループからコンポーネントを削除します。

パラメータ
  • id (int) -- グループ ID

  • component_id (int) -- 固有のコンポーネント ID

POST /api/groups/(int: id)/projects/

グループにプロジェクトを関連付けます。

パラメータ
  • id (int) -- グループ ID

フォーム パラメーター
  • string project_id -- 固有のプロジェクト ID

DELETE /api/groups/(int: id)/projects/(int: project_id)

プロジェクトをグループから削除します。

パラメータ
  • id (int) -- グループ ID

  • project_id (int) -- 固有のプロジェクト ID

POST /api/groups/(int: id)/languages/

グループに言語を関連付けます。

パラメータ
  • id (int) -- グループ ID

フォーム パラメーター
  • string language_code -- 固有の言語コード

DELETE /api/groups/(int: id)/languages/(string: language_code)

言語をグループから削除します。

パラメータ
  • id (int) -- グループ ID

  • language_code (string) -- 固有の言語コード

POST /api/groups/(int: id)/componentlists/

コンポーネント リストをグループに関連付けます。

パラメータ
  • id (int) -- グループ ID

フォーム パラメーター
  • string component_list_id -- 固有のコンポーネントリスト ID

DELETE /api/groups/(int: id)/componentlists/(int: component_list_id)

コンポーネントリストをグループから削除します。

パラメータ
  • id (int) -- グループ ID

  • component_list_id (int) -- 固有のコンポーネントリスト ID

ロール

GET /api/roles/

返り値は、ユーザーに関連付けられたすべてのロールのリストです。ユーザーがスーパーユーザーの場合は、既存のすべてのロールのリストになります。

参考

ロールオブジェクトの属性については、GET /api/roles/(int:id)/ にドキュメントがあります。

POST /api/roles/

新しいロールを作成します。

パラメータ
  • name (string) -- ロール名

  • permissions (array) -- アクセス権のコードネーム リスト

GET /api/roles/(int: id)/

返り値は、ロールの情報です。

パラメータ
  • id (int) -- ロール ID

レスポンス JSON オブジェクト
  • name (string) -- ロール名

  • permissions (array) -- アクセス権のコードネーム リスト

JSON データの例:

{
    "name": "Access repository",
    "permissions": [
        "vcs.access",
        "vcs.view"
    ],
    "url": "http://example.com/api/roles/1/",
}
PUT /api/roles/(int: id)/

ロールのパラメータを変更します。

パラメータ
  • id (int) -- ロール ID

レスポンス JSON オブジェクト
  • name (string) -- ロール名

  • permissions (array) -- アクセス権のコードネーム リスト

PATCH /api/roles/(int: id)/

ロールのパラメータを変更します。

パラメータ
  • id (int) -- ロール ID

レスポンス JSON オブジェクト
  • name (string) -- ロール名

  • permissions (array) -- アクセス権のコードネーム リスト

DELETE /api/roles/(int: id)/

ロールを削除します。

パラメータ
  • id (int) -- ロール ID

言語

GET /api/languages/

返り値は、すべての言語のリストです。

参考

言語オブジェクトの属性については、GET /api/languages/(string:language)/ にドキュメントがあります。

POST /api/languages/

新しい言語を作成します。

パラメータ
  • code (string) -- 言語名

  • name (string) -- 言語名

  • direction (string) -- テキストの方向

  • plural (object) -- 言語の複数形と数

GET /api/languages/(string: language)/

返り値は、言語の情報です。

パラメータ
  • language (string) -- 言語コード

レスポンス JSON オブジェクト
  • code (string) -- 言語コード

  • direction (string) -- テキストの方向

  • plural (object) -- 言語の複数形の情報についてのオブジェクト

  • aliases (array) -- 言語のエイリアスの配列

JSON データの例:

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

言語パラメータを変更します。

パラメータ
  • language (string) -- 言語コード

リクエスト JSON オブジェクト
  • name (string) -- 言語名

  • direction (string) -- テキストの方向

  • plural (object) -- 言語の複数形の詳細

PATCH /api/languages/(string: language)/

言語パラメータを変更します。

パラメータ
  • language (string) -- 言語コード

リクエスト JSON オブジェクト
  • name (string) -- 言語名

  • direction (string) -- テキストの方向

  • plural (object) -- 言語の複数形の詳細

DELETE /api/languages/(string: language)/

言語を削除します。

パラメータ
  • language (string) -- 言語コード

GET /api/languages/(string: language)/statistics/

返り値は、言語の統計情報です。

パラメータ
  • language (string) -- 言語コード

レスポンス JSON オブジェクト
  • total (int) -- 文字列の総数

  • total_words (int) -- 単語の総数

  • last_change (timestamp) -- 言語での最後の変更

  • recent_changes (int) -- 変更の総数

  • translated (int) -- 翻訳済み文字列の数

  • translated_percent (float) -- 翻訳済みの文字列の割合

  • translated_words (int) -- 翻訳済みの単語の数

  • translated_words_percent (int) -- 翻訳済みの単語の割合

  • translated_chars (int) -- 翻訳済みの文字数

  • translated_chars_percent (int) -- 翻訳済みの文字の割合

  • total_chars (int) -- 合計文字数

  • fuzzy (int) -- あいまいな(要編集付き)文字列の数

  • fuzzy_percent (int) -- あいまいな(要編集付き)文字列の割合

  • failing (int) -- 検査不合格の文字列数

  • failing -- 検査不合格のもの割合

プロジェクト

GET /api/projects/

返り値は、すべてのプロジェクトのリストです。

参考

プロジェクトオブジェクトの属性については、GET /api/projects/(string:project)/ にドキュメントがあります。

POST /api/projects/

バージョン 3.9 で追加.

新しいプロジェクトを作成します。

パラメータ
  • name (string) -- プロジェクト名

  • slug (string) -- プロジェクトのスラッグ

  • web (string) -- プロジェクトの Web サイト

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

返り値は、プロジェクトの情報です。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

レスポンス JSON オブジェクト

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

バージョン 4.3 で追加.

PATCH リクエストでプロジェクトを編集します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

PUT /api/projects/(string: project)/

バージョン 4.3 で追加.

PUT リクエストでプロジェクトを編集します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

DELETE /api/projects/(string: project)/

バージョン 3.9 で追加.

プロジェクトを削除します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

GET /api/projects/(string: project)/changes/

返り値は、変更されたプロジェクトの一覧です。基本的には、プロジェクトに対して同じ引数で GET /api/changes/ を実行します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

レスポンス JSON オブジェクト
GET /api/projects/(string: project)/repository/

返り値は、VCS リポジトリのステータスに関する情報です。このエンドポイントには、プロジェクトのすべてのリポジトリの全体的な概要のみが含まれています。より詳細なステータスを取得するには GET /api/components/(string:project)/(string:component)/repository/ を使用してください。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

レスポンス JSON オブジェクト
  • needs_commit (boolean) -- コミットが必要な保留中の変更があるかどうか

  • needs_merge (boolean) -- マージが必要な upstream に変更があるかどうか

  • needs_push (boolean) -- プッシュが必要なローカルに変更があるかどうか

JSON データの例:

{
    "needs_commit": true,
    "needs_merge": false,
    "needs_push": true
}
POST /api/projects/(string: project)/repository/

VCS リポジトリで指定の操作を実行します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

リクエスト JSON オブジェクト
  • operation (string) -- 実行する操作: push, pull, commit, reset, cleanup, file-sync のいずれか一つ

レスポンス JSON オブジェクト
  • result (boolean) -- 操作の結果

CURL の例:

curl \
    -d operation=pull \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/projects/hello/repository/

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

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/

返り値は、指定したプロジェクト内の翻訳コンポーネントのリストです。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

レスポンス JSON オブジェクト
POST /api/projects/(string: project)/components/

バージョン 3.9 で追加.

バージョン 4.3 で変更: zipfile および docfile パラメータは、VCS なしのコンポーネントでも使用できるようになりました。参照: ローカル ファイル

バージョン 4.6 で変更: The cloned repositories are now automatically shared within a project using Weblate の内部 URL. Use disable_autoshare to turn off this.

指定したプロジェクトに翻訳コンポーネントを作成します。

ヒント

1 つの VCS リポジトリから複数のコンポーネントを作成するには、Weblate の内部 URL を使用します。

注釈

ほとんどのコンポーネントの作成は、バックグラウンドで実行されます。作成したコンポーネントの task_url 属性を確認し、その進捗状況を確認します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

フォーム パラメーター
  • file zipfile -- 翻訳の初期化のために Weblate にアップロードする ZIP ファイル

  • file docfile -- 翻訳するドキュメント

  • boolean disable_autoshare -- Disables automatic repository sharing via Weblate の内部 URL.

レスポンス 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.

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/

CURL JSON リクエスト例:

curl \
    --data-binary '{
        "branch": "main",
        "file_format": "po",
        "filemask": "po/*.po",
        "git_export": "",
        "license": "",
        "license_url": "",
        "name": "Weblate",
        "slug": "weblate",
        "repo": "file:///home/nijel/work/weblate-hello",
        "template": "",
        "new_base": "",
        "vcs": "git"
    }' \
    -H "Content-Type: application/json" \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/projects/hello/components/

JSON リクエストの例:

POST /api/projects/hello/components/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20

{
    "branch": "main",
    "file_format": "po",
    "filemask": "po/*.po",
    "git_export": "",
    "license": "",
    "license_url": "",
    "name": "Weblate",
    "slug": "weblate",
    "repo": "file:///home/nijel/work/weblate-hello",
    "template": "",
    "new_base": "",
    "vcs": "git"
}

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/

返り値は、プロジェクト内の全言語のページ順の統計情報です。

バージョン 3.8 で追加.

パラメータ
  • project (string) -- プロジェクト URL スラッグ

レスポンス JSON オブジェクト
  • results (array) -- 翻訳統計オブジェクトの配列

  • language (string) -- 言語名

  • code (string) -- 言語コード

  • total (int) -- 文字列の総数

  • translated (int) -- 翻訳済み文字列の数

  • translated_percent (float) -- 翻訳済みの文字列の割合

  • total_words (int) -- 単語の総数

  • translated_words (int) -- 翻訳済みの単語の数

  • words_percent (float) -- 翻訳済みの単語の割合

GET /api/projects/(string: project)/statistics/

返り値は、プロジェクトの統計情報です。

バージョン 3.8 で追加.

パラメータ
  • project (string) -- プロジェクト URL スラッグ

レスポンス JSON オブジェクト
  • total (int) -- 文字列の総数

  • translated (int) -- 翻訳済み文字列の数

  • translated_percent (float) -- 翻訳済みの文字列の割合

  • total_words (int) -- 単語の総数

  • translated_words (int) -- 翻訳済みの単語の数

  • words_percent (float) -- 翻訳済みの単語の割合

コンポーネント

GET /api/components/

返り値は、翻訳コンポーネントのリストです。

参考

コンポーネント オブジェクトの属性については、 GET /api/components/(string:project)/(string:component)/ にドキュメントがあります。

GET /api/components/(string: project)/(string: component)/

返り値は、翻訳コンポーネントに関する情報です。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

レスポンス JSON オブジェクト

JSON データの例:

{
    "branch": "main",
    "file_format": "po",
    "filemask": "po/*.po",
    "git_export": "",
    "license": "",
    "license_url": "",
    "name": "Weblate",
    "slug": "weblate",
    "project": {
        "name": "Hello",
        "slug": "hello",
        "source_language": {
            "code": "en",
            "direction": "ltr",
            "name": "English",
            "url": "http://example.com/api/languages/en/",
            "web_url": "http://example.com/languages/en/"
        },
        "url": "http://example.com/api/projects/hello/",
        "web": "https://weblate.org/",
        "web_url": "http://example.com/projects/hello/"
    },
    "source_language": {
        "code": "en",
        "direction": "ltr",
        "name": "English",
        "url": "http://example.com/api/languages/en/",
        "web_url": "http://example.com/languages/en/"
    },
    "repo": "file:///home/nijel/work/weblate-hello",
    "template": "",
    "new_base": "",
    "url": "http://example.com/api/components/hello/weblate/",
    "vcs": "git",
    "web_url": "http://example.com/projects/hello/weblate/"
}
PATCH /api/components/(string: project)/(string: component)/

PATCH リクエストでコンポーネントを編集します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • source_language (string) -- プロジェクトの原文の言語コード(オプション)

リクエスト JSON オブジェクト
  • name (string) -- コンポーネント名

  • slug (string) -- コンポーネントのスラッグ

  • repo (string) -- VCS リポジトリ URL

CURL の例:

curl \
    --data-binary '{"name": "new name"}' \
    -H "Content-Type: application/json" \
    -H "Authorization: Token TOKEN" \
    PATCH http://example.com/api/projects/hello/components/

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

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

PUT リクエストでコンポーネントを編集します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

リクエスト JSON オブジェクト
  • branch (string) -- VCS リポジトリ ブランチ

  • file_format (string) -- 翻訳のファイル形式

  • filemask (string) -- リポジトリ内の翻訳ファイルのマスク

  • name (string) -- コンポーネント名

  • slug (string) -- コンポーネントのスラッグ

  • repo (string) -- VCS リポジトリ URL

  • template (string) -- 単一言語翻訳用の基本ファイル

  • new_base (string) -- 新しい翻訳を追加するための基本ファイル

  • vcs (string) -- バージョン管理システム

DELETE /api/components/(string: project)/(string: component)/

バージョン 3.9 で追加.

コンポーネントを削除します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

GET /api/components/(string: project)/(string: component)/changes/

コンポーネントの変更点の一覧を返します。これは基本的に、コンポーネントを対象とした GET /api/changes/ で、同じパラメータを受け取ります。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

レスポンス JSON オブジェクト
GET /api/components/(string: project)/(string: component)/screenshots/

返り値は、コンポーネントのスクリーンショットの一覧です。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

レスポンス JSON オブジェクト
GET /api/components/(string: project)/(string: component)/lock/

返り値は、コンポーネントのロック状態です。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

レスポンス JSON オブジェクト
  • locked (boolean) -- コンポーネントが更新のためにロックされているかどうか

JSON データの例:

{
    "locked": false
}
POST /api/components/(string: project)/(string: component)/lock/

コンポーネントのロック状態を設定します。

レスポンスは GET /api/components/(string:project)/(string:component)/lock/ と同じです。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

リクエスト JSON オブジェクト
  • lock -- ロックするかどうかのブール値。

CURL の例:

curl \
    -d lock=true \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/components/hello/weblate/repository/

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}

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/

返り値は、VCS リポジトリの状態の情報です。

レスポンスは GET /api/projects/(string:project)/repository/ の場合と同じです。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

レスポンス JSON オブジェクト
  • needs_commit (boolean) -- コミットが必要な保留中の変更があるかどうか

  • needs_merge (boolean) -- マージが必要な upstream に変更があるかどうか

  • needs_push (boolean) -- プッシュが必要なローカルに変更があるかどうか

  • remote_commit (string) -- リモート コミット情報

  • status (string) -- VCS が報告した VCS リポジトリの状況

  • merge_failure -- マージの失敗を説明するテキストまたは null(存在しない場合)

POST /api/components/(string: project)/(string: component)/repository/

VCS リポジトリで指定された操作を実行します。

ドキュメントは、POST /api/projects/(string:project)/repository/ を確認してください。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

リクエスト JSON オブジェクト
  • operation (string) -- 実行する操作: push, pull, commit, reset, cleanup のいずれか一つ

レスポンス JSON オブジェクト
  • result (boolean) -- 操作の結果

CURL の例:

curl \
    -d operation=pull \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/components/hello/weblate/repository/

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

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/

単一言語翻訳用の基本ファイルをダウンロードします。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

GET /api/components/(string: project)/(string: component)/new_template/

新しい翻訳用のテンプレート ファイルをダウンロードします。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

GET /api/components/(string: project)/(string: component)/translations/

返り値は、指定してコンポーネント内の翻訳オブジェクト一覧です。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

レスポンス JSON オブジェクト
POST /api/components/(string: project)/(string: component)/translations/

指定したコンポーネントに新しい翻訳を作成します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

リクエスト JSON オブジェクト
レスポンス JSON オブジェクト
  • result (object) -- 新しい翻訳オブジェクトが作成される

CURL の例:

curl \
    -d language_code=cs \
    -H "Authorization: Token TOKEN" \
    http://example.com/api/projects/hello/components/

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

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/

コンポーネント内のすべての翻訳について、ページ化して統計情報を返します。

バージョン 2.7 で追加.

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

レスポンス JSON オブジェクト

コンポーネントにリンクしたプロジェクトを返します。

バージョン 4.5 で追加.

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

レスポンス JSON オブジェクト
POST /api/components/(string: project)/(string: component)/links/

プロジェクトをコンポーネントに関連付けます。

バージョン 4.5 で追加.

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

フォーム パラメーター
  • string project_slug -- プロジェクトのスラッグ

コンポーネントとプロジェクトの関連付けを削除します。

バージョン 4.5 で追加.

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • project_slug (string) -- プロジェクトを削除するスラッグ

翻訳

GET /api/translations/

返り値は、翻訳の一覧です。

参考

翻訳オブジェクトの属性は、GET /api/translations/(string:project)/(string:component)/(string:language)/ に記載されています。

GET /api/translations/(string: project)/(string: component)/(string: language)/

返り値は、翻訳に関する情報です。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

レスポンス JSON オブジェクト
  • component (object) -- コンポーネント オブジェクト。参照: GET /api/components/(string:project)/(string:component)/

  • failing_checks (int) -- 検査不合格の文字列の数

  • failing_checks_percent (float) -- 検査不合格の文字列の割合

  • failing_checks_words (int) -- 検査不合格の単語の数

  • filename (string) -- 翻訳ファイル名

  • fuzzy (int) -- あいまいな(要編集付き)文字列の数

  • fuzzy_percent (float) -- あいまいな(要編集付き)文字列の割合

  • fuzzy_words (int) -- あいまいな(要編集付き)文字列の単語数

  • have_comment (int) -- コメント付き文字列の数

  • have_suggestion (int) -- 提案のある文字列の数

  • is_template (boolean) -- 翻訳が単一言語ベースかどうか

  • language (object) -- 原文の言語のオブジェクト。参照: GET /api/languages/(string:language)/

  • language_code (string) -- リポジトリで使用する言語コード。これは、言語オブジェクトの言語コードとは異なる場合があります

  • last_author (string) -- 最終著者名

  • last_change (timestamp) -- 最終変更タイムスタンプ

  • revision (string) -- ファイルのリビジョン ハッシュ

  • share_url (string) -- エンゲージメント ページにつながる共有の URL

  • total (int) -- 文字列の総数

  • total_words (int) -- 単語の総数

  • translate_url (string) -- 翻訳用 URL

  • translated (int) -- 翻訳済み文字列の数

  • translated_percent (float) -- 翻訳済みの文字列の割合

  • translated_words (int) -- 翻訳済みの単語の数

  • repository_url (string) -- リポジトリ状況への URL。参照: GET /api/translations/(string:project)/(string:component)/(string:language)/repository/

  • file_url (string) -- ファイル オブジェクトへの URL。参照: GET /api/translations/(string:project)/(string:component)/(string:language)/file/

  • changes_list_url (string) -- 変更リストへの URL。参照: GET /api/translations/(string:project)/(string:component)/(string:language)/changes/

  • units_list_url (string) -- 文字列リストへの URL。参照: GET /api/translations/(string:project)/(string:component)/(string:language)/units/

JSON データの例:

{
    "component": {
        "branch": "main",
        "file_format": "po",
        "filemask": "po/*.po",
        "git_export": "",
        "license": "",
        "license_url": "",
        "name": "Weblate",
        "new_base": "",
        "project": {
            "name": "Hello",
            "slug": "hello",
            "source_language": {
                "code": "en",
                "direction": "ltr",
                "name": "English",
                "url": "http://example.com/api/languages/en/",
                "web_url": "http://example.com/languages/en/"
            },
            "url": "http://example.com/api/projects/hello/",
            "web": "https://weblate.org/",
            "web_url": "http://example.com/projects/hello/"
        },
        "repo": "file:///home/nijel/work/weblate-hello",
        "slug": "weblate",
        "template": "",
        "url": "http://example.com/api/components/hello/weblate/",
        "vcs": "git",
        "web_url": "http://example.com/projects/hello/weblate/"
    },
    "failing_checks": 3,
    "failing_checks_percent": 75.0,
    "failing_checks_words": 11,
    "filename": "po/cs.po",
    "fuzzy": 0,
    "fuzzy_percent": 0.0,
    "fuzzy_words": 0,
    "have_comment": 0,
    "have_suggestion": 0,
    "is_template": false,
    "language": {
        "code": "cs",
        "direction": "ltr",
        "name": "Czech",
        "url": "http://example.com/api/languages/cs/",
        "web_url": "http://example.com/languages/cs/"
    },
    "language_code": "cs",
    "last_author": "Weblate Admin",
    "last_change": "2016-03-07T10:20:05.499",
    "revision": "7ddfafe6daaf57fc8654cc852ea6be212b015792",
    "share_url": "http://example.com/engage/hello/cs/",
    "total": 4,
    "total_words": 15,
    "translate_url": "http://example.com/translate/hello/weblate/cs/",
    "translated": 4,
    "translated_percent": 100.0,
    "translated_words": 15,
    "url": "http://example.com/api/translations/hello/weblate/cs/",
    "web_url": "http://example.com/projects/hello/weblate/cs/"
}
DELETE /api/translations/(string: project)/(string: component)/(string: language)/

バージョン 3.9 で追加.

翻訳を削除します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

GET /api/translations/(string: project)/(string: component)/(string: language)/changes/

返り値は、変更された翻訳の一覧です。基本的には、翻訳に対して同じ引数で GET /api/changes/ を実行します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

レスポンス JSON オブジェクト
GET /api/translations/(string: project)/(string: component)/(string: language)/units/

返り値は、翻訳単位の一覧です。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

  • q (string) -- 検索クエリ文字列 検索 (オプション)

レスポンス JSON オブジェクト
POST /api/translations/(string: project)/(string: component)/(string: language)/units/

新しい単一言語ユニットを追加します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

リクエスト JSON オブジェクト
  • key (string) -- 翻訳ユニットの名称

  • value (string) -- 翻訳単位の値

POST /api/translations/(string: project)/(string: component)/(string: language)/autotranslate/

自動翻訳を起動します。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

リクエスト JSON オブジェクト
  • mode (string) -- 自動翻訳モード

  • filter_type (string) -- 自動翻訳フィルターの種類

  • auto_source (string) -- 自動翻訳の参照元 - mt または others

  • component (string) -- プロジェクトの共有翻訳メモリに協力を有効にして、追加コンポーネントにアクセスします。

  • engines (array) -- 機械翻訳エンジン

  • threshold (string) -- スコアしきい値

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 翻訳のダウンロード).

注釈

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.

クエリ パラメータ
  • 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

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

POST /api/translations/(string: project)/(string: component)/(string: language)/file/

翻訳を含む新しいファイルをアップロードします。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

フォーム パラメーター
  • string conflicts -- 競合への対処方法(ignorereplace-translatedreplace-approved

  • file file -- アップロードしたファイル

  • string email -- 翻訳者のメールアドレス

  • string author -- 翻訳者名

  • string method -- アップロード メソッド(translate, approve, suggest, fuzzy, replace, source, add)。参照: インポート方法

  • string fuzzy -- あいまい(要編集付き)文字列処理(、`` process``、`` approve``)

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/

返り値は、VCS リポジトリの状態の情報です。

レスポンスは GET /api/components/(string:project)/(string:component)/repository/ の場合と同じです。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

POST /api/translations/(string: project)/(string: component)/(string: language)/repository/

VCS リポジトリで指定の操作を実行します。

ドキュメントは、POST /api/projects/(string:project)/repository/ を確認してください。

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

リクエスト JSON オブジェクト
  • operation (string) -- 実行する操作: push, pull, commit, reset, cleanup のいずれか一つ

レスポンス JSON オブジェクト
  • result (boolean) -- 操作の結果

GET /api/translations/(string: project)/(string: component)/(string: language)/statistics/

返り値は、翻訳の詳細な統計情報です。

バージョン 2.7 で追加.

パラメータ
  • project (string) -- プロジェクト URL スラッグ

  • component (string) -- コンポーネント URL スラッグ

  • language (string) -- 翻訳言語コード

レスポンス JSON オブジェクト
  • code (string) -- 言語コード

  • failing (int) -- 検査不合格数

  • failing_percent (float) -- 検査不合格の割合

  • fuzzy (int) -- あいまいな(要編集付き)文字列の数

  • fuzzy_percent (float) -- あいまいな(要編集付き)文字列の割合

  • total_words (int) -- 単語の総数

  • translated_words (int) -- 翻訳済みの単語の数

  • last_author (string) -- 最終著者名

  • last_change (timestamp) -- 最終変更日

  • name (string) -- 言語名

  • total (int) -- 文字列の総数

  • translated (int) -- 翻訳済み文字列の数

  • translated_percent (float) -- 翻訳済みの文字列の割合

  • url (string) -- 翻訳にアクセスするための URL(概要ページの URL)

  • url_translate (string) -- 翻訳にアクセスするための URL(実際の翻訳 URL)

ユニット

unit とは、原文と対応する翻訳文をペアにして、関連する情報も含む翻訳データの 1 つの部分です。この用語は Translate Toolkit と XLIFF から派生したものです。

バージョン 2.10 で追加.

GET /api/units/

返り値は、翻訳ユニットの一覧です。

参考

ユニット オブジェクトの属性は、GET /api/units/(int:id)/ で説明されています。

GET /api/units/(int: id)/

バージョン 4.3 で変更: targetsource は、複数形の文字列を適切に処理するための配列になりました。

返り値は、翻訳ユニットの情報です。

パラメータ
  • id (int) -- ユニット ID

レスポンス JSON オブジェクト
  • translation (string) -- 関連する翻訳オブジェクトの URL

  • source (array) -- 原文

  • previous_source (string) -- あいまい一致に使用される前の原文

  • target (array) -- 対象文字列

  • id_hash (string) -- ユニットの固有識別子

  • content_hash (string) -- 原文の固有識別子

  • location (string) -- ソースコード内のユニットの場所

  • context (string) -- 翻訳ユニットのコンテキスト

  • note (string) -- 翻訳ユニットの注記

  • flags (string) -- 翻訳ユニットのフラグ

  • state (int) -- ユニットの状態、0 - 未翻訳、10 - 要編集、20 - 翻訳済、30 - 承認済、100 - 編集不可

  • fuzzy (boolean) -- ユニットが "fuzzy" もしは査読用にマークされているか

  • translated (boolean) -- ユニットが翻訳されているかどうか

  • approved (boolean) -- 翻訳が承認されているかどうか

  • position (int) -- 翻訳ファイル内のユニットの位置

  • has_suggestion (boolean) -- ユニットに提案が含まれるかどうか

  • has_comment (boolean) -- ユニットにコメントが含まれるかどうか

  • has_failing_check (boolean) -- ユニットに検査で不合格が含まれるかどうか

  • num_words (int) -- 原文の単語の数

  • priority (int) -- 翻訳の優先度。デフォルトは 100 です

  • id (int) -- ユニット識別子

  • explanation (string) -- 文字列の説明、原文ユニットで利用可能、参照: Additional info on source strings

  • extra_flags (string) -- 原文ユニットで使用可能な追加の文字列フラグ、参照: フラグを使用した動作の設定

  • web_url (string) -- ユニットを編集する URL

  • souce_unit (string) -- 原文ユニットのリンク。参照: GET /api/units/(int:id)/

PATCH /api/units/(int: id)/

バージョン 4.3 で追加.

翻訳ユニットを部分的に更新します。

パラメータ
  • id (int) -- ユニット ID

リクエスト JSON オブジェクト
  • state (int) -- ユニットの状態、0 - 未翻訳、10 - 要編集、20 - 翻訳済、30 - 承認済(査読ワークフローを有効にすることが必要。参照: 専任の査読者

  • target (array) -- 対象文字列

  • explanation (string) -- 文字列の説明、原文ユニットで利用可能、参照: Additional info on source strings

  • extra_flags (string) -- 原文ユニットで使用可能な追加の文字列フラグ、参照: フラグを使用した動作の設定

PUT /api/units/(int: id)/

バージョン 4.3 で追加.

翻訳ユニットをすべて更新します。

パラメータ
  • id (int) -- ユニット ID

リクエスト JSON オブジェクト
  • state (int) -- ユニットの状態、0 - 未翻訳、10 - 要編集、20 - 翻訳済、30 - 承認済(査読ワークフローを有効にすることが必要。参照: 専任の査読者

  • target (array) -- 対象文字列

  • explanation (string) -- 文字列の説明、原文ユニットで利用可能、参照: Additional info on source strings

  • extra_flags (string) -- 原文ユニットで使用可能な追加の文字列フラグ、参照: フラグを使用した動作の設定

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

バージョン 4.3 で追加.

翻訳ユニットを削除します。

パラメータ
  • id (int) -- ユニット ID

変更

バージョン 2.10 で追加.

GET /api/changes/

バージョン 4.1 で変更: 変更のフィルター処理は 4.1 リリースで導入しました。

返り値は、変更された翻訳の一覧です。

参考

変更オブジェクト属性は、GET /api/changes/(int:id)/ で説明されています。

クエリ パラメータ
  • user (string) -- フィルタするユーザーのユーザー名

  • action (int) -- フィルタするアクション、複数回使用可能

  • timestamp_after (timestamp) -- 変更後のリストを ISO 8601 形式のタイムスタンプで表示

  • timestamp_before (timestamp) -- 変更前のリストを ISO 8601 形式のタイムスタンプで表示

GET /api/changes/(int: id)/

返り値は、翻訳の変更情報です。

パラメータ
  • id (int) -- 変更 ID

レスポンス JSON オブジェクト
  • unit (string) -- 関連するユニット オブジェクトの URL

  • translation (string) -- 関連する翻訳オブジェクトの URL

  • component (string) -- 関連コンポーネント オブジェクトの URL

  • user (string) -- 関連するユーザー オブジェクトの URL

  • author (string) -- 関連する著作者オブジェクトの URL

  • timestamp (timestamp) -- イベントのタイムスタンプ

  • action (int) -- アクションの数値識別子

  • action_name (string) -- アクションのテキスト説明

  • target (string) -- イベントで変更されたテキストや詳細

  • id (int) -- 識別子の変更

スクリーンショット

バージョン 2.14 で追加.

GET /api/screenshots/

返り値は、スクリーンショットの文字列情報の一覧です。

参考

スクリーンショット オブジェクトの属性は、GET /api/screenshots/(int:id)/ で説明されています。

GET /api/screenshots/(int: id)/

返り値は、スクリーンショットの情報です。

パラメータ
  • id (int) -- スクリーンショット ID

レスポンス JSON オブジェクト
  • name (string) -- スクリーンショット名

  • component (string) -- 関連コンポーネント オブジェクトの URL

  • file_url (string) -- ファイルをダウンロードするための URL。参照: GET /api/screenshots/(int:id)/file/

  • units (array) -- 関連する原文情報へのリンク。参照: GET /api/units/(int:id)/

GET /api/screenshots/(int: id)/file/

スクリーンショット画像をダウンロードします。

パラメータ
  • id (int) -- スクリーンショット ID

POST /api/screenshots/(int: id)/file/

スクリーンショット画像を置き換えます。

パラメータ
  • id (int) -- スクリーンショット ID

フォーム パラメーター
  • file image -- アップロードしたファイル

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/

原文をスクリーンショットに関連付けます。

パラメータ
  • id (int) -- スクリーンショット ID

フォーム パラメーター
  • string unit_id -- ユニット ID

レスポンス JSON オブジェクト
  • name (string) -- スクリーンショット名

  • translation (string) -- 関連する翻訳オブジェクトの URL

  • file_url (string) -- ファイルをダウンロードするための URL。参照: GET /api/screenshots/(int:id)/file/

  • units (array) -- 関連する原文情報へのリンク。参照: GET /api/units/(int:id)/

DELETE /api/screenshots/(int: id)/units/(int: unit_id)

スクリーンショットと原文の関連付けを削除します。

パラメータ
  • id (int) -- スクリーンショット ID

  • unit_id -- 原文ユニット ID

POST /api/screenshots/

新しいスクリーンショットを作成します。

フォーム パラメーター
  • file image -- アップロードしたファイル

  • string name -- スクリーンショットの名前

  • string project_slug -- プロジェクトのスラッグ

  • string component_slug -- コンポーネントのスラッグ

  • string language_code -- 言語コード

レスポンス JSON オブジェクト
  • name (string) -- スクリーンショット名

  • component (string) -- 関連コンポーネント オブジェクトの URL

  • file_url (string) -- ファイルをダウンロードするための URL。参照: GET /api/screenshots/(int:id)/file/

  • units (array) -- 関連する原文情報へのリンク。参照: GET /api/units/(int:id)/

PATCH /api/screenshots/(int: id)/

スクリーンショットに関する部分的な情報を編集します。

パラメータ
  • id (int) -- スクリーンショット ID

レスポンス JSON オブジェクト
  • name (string) -- スクリーンショット名

  • component (string) -- 関連コンポーネント オブジェクトの URL

  • file_url (string) -- ファイルをダウンロードするための URL。参照: GET /api/screenshots/(int:id)/file/

  • units (array) -- 関連する原文情報へのリンク。参照: GET /api/units/(int:id)/

PUT /api/screenshots/(int: id)/

スクリーンショットのすべての情報を編集します。

パラメータ
  • id (int) -- スクリーンショット ID

レスポンス JSON オブジェクト
  • name (string) -- スクリーンショット名

  • component (string) -- 関連コンポーネント オブジェクトの URL

  • file_url (string) -- ファイルをダウンロードするための URL。参照: GET /api/screenshots/(int:id)/file/

  • units (array) -- 関連する原文情報へのリンク。参照: GET /api/units/(int:id)/

DELETE /api/screenshots/(int: id)/

スクリーンショットを削除します。

パラメータ
  • id (int) -- スクリーンショット ID

アドオン

バージョン 4.4.1 で追加.

GET /api/addons/

アドオンの一覧を返します。

参考

アドオン オブジェクトの属性は、GET /api/addons/(int:id)/ にドキュメントがあります。

GET /api/addons/(int: id)/

アドオン情報に関する情報を返します。

パラメータ
  • id (int) -- アドオン ID

レスポンス JSON オブジェクト
  • name (string) -- アドオンの名前

  • component (string) -- 関連コンポーネント オブジェクトの URL

  • configuration (object) -- オプションのアドオン設定

参考

アドオン

POST /api/components/(string: project)/(string: component)/addons/

新しいアドオンを作成します。

パラメータ
  • project_slug (string) -- プロジェクトのスラッグ

  • component_slug (string) -- コンポーネントのスラッグ

リクエスト JSON オブジェクト
  • name (string) -- アドオンの名前

  • configuration (object) -- オプションのアドオン設定

PATCH /api/addons/(int: id)/

アドオンに関する部分的な情報を編集します。

パラメータ
  • id (int) -- アドオン ID

レスポンス JSON オブジェクト
  • configuration (object) -- オプションのアドオン設定

PUT /api/addons/(int: id)/

アドオンに関する完全な情報を編集します。

パラメータ
  • id (int) -- アドオン ID

レスポンス JSON オブジェクト
  • configuration (object) -- オプションのアドオン設定

DELETE /api/addons/(int: id)/

アドオンを削除します。

パラメータ
  • id (int) -- アドオン ID

複数のコンポーネント リスト

バージョン 4.0 で追加.

GET /api/component-lists/

すべてのコンポーネント リストのリストを返します。

参考

コンポーネント リストのオブジェクト属性は、GET /api/component-lists/(str:slug)/ にドキュメントがあります。

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

コンポーネント リストに関する情報を返します。

パラメータ
  • slug (string) -- コンポーネント リストのスラッグ

レスポンス JSON オブジェクト
  • name (string) -- コンポーネント リストの名前

  • slug (string) -- コンポーネント リストのスラッグ

  • show_dashboard (boolean) -- ダッシュボードに表示するかどうか

  • components (array) -- 関連するコンポーネントへのリンク。参照: GET /api/components/(string:project)/(string:component)/

  • auto_assign (array) -- 自動割り当て規則

PUT /api/component-lists/(str: slug)/

コンポーネント リストのパラメータを変更します。

パラメータ
  • slug (string) -- コンポーネント リストのスラッグ

リクエスト JSON オブジェクト
  • name (string) -- コンポーネント リストの名前

  • slug (string) -- コンポーネント リストのスラッグ

  • show_dashboard (boolean) -- ダッシュボードに表示するかどうか

PATCH /api/component-lists/(str: slug)/

コンポーネント リストのパラメータを変更します。

パラメータ
  • slug (string) -- コンポーネント リストのスラッグ

リクエスト JSON オブジェクト
  • name (string) -- コンポーネント リストの名前

  • slug (string) -- コンポーネント リストのスラッグ

  • show_dashboard (boolean) -- ダッシュボードに表示するかどうか

DELETE /api/component-lists/(str: slug)/

コンポーネント リストを削除します。

パラメータ
  • slug (string) -- コンポーネント リストのスラッグ

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

コンポーネントをコンポーネント リストに関連付けます。

パラメータ
  • slug (string) -- コンポーネント リストのスラッグ

フォーム パラメーター
  • string component_id -- コンポーネント ID

DELETE /api/component-lists/(str: slug)/components/(str: component_slug)

コンポーネント リストからコンポーネントの関連付けを解除します。

パラメータ
  • slug (string) -- コンポーネント リストのスラッグ

  • component_slug (string) -- コンポーネントのスラッグ

用語集

バージョン 4.5 で変更: 現在、用語集は普通のコンポーネントとして、翻訳と文字列を保存するようになりました。代わりに該当の API を使用してください。

タスク

バージョン 4.4 で追加.

GET /api/tasks/

タスクの一覧は現在使用できません。

GET /api/tasks/(str: uuid)/

タスクに関する情報を返します

パラメータ
  • uuid (string) -- タスク UUID

レスポンス JSON オブジェクト
  • completed (boolean) -- タスクが完了したかどうか

  • progress (int) -- タスクの進捗率

  • result (object) -- タスクの結果または進捗状況の詳細

  • log (string) -- タスクの履歴

Metrics

GET /api/metrics/

Returns server metrics.

レスポンス JSON オブジェクト
  • units (int) -- ユニット数

  • units_translated (int) -- 翻訳済みユニット数

  • users (int) -- ユーザー数

  • changes (int) -- 変更箇所の数

  • projects (int) -- プロジェクト数

  • components" (int) -- コンポーネントの数

  • translations" (int) -- 翻訳の数

  • languages" (int) -- 使用言語数

  • checks" (int) -- 実行された品質検査数

  • configuration_errors" (int) -- 設定エラー数

  • suggestions" (int) -- 保留中の提案数

  • celery_queues (object) -- Celery キューの長さ。参照: Celery を使用するバックグラウンド タスク

  • name (string) -- 設定済みサーバー名

通知フック

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

バージョン 2.6 で非推奨: Please use POST /api/components/(string:project)/(string:component)/repository/ instead which works properly with authentication for ACL limited projects.

コンポーネントの更新を起動します(VCS からプルし、変更された翻訳をスキャンします)。

GET /hooks/update/(string: project)/

バージョン 2.6 で非推奨: Please use POST /api/projects/(string:project)/repository/ instead which works properly with authentication for ACL limited projects.

プロジェクト内のすべてのコンポーネントの更新を起動します(VCS からプルし、変更された翻訳をスキャンします)。

POST /hooks/github/

Special hook for handling GitHub notifications and automatically updating matching components.

注釈

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.

参考

Automatically receiving changes from GitHub

For instruction on setting up GitHub integration

https://docs.github.com/en/github/extending-github/about-webhooks

Generic information about GitHub Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/gitlab/

Special hook for handling GitLab notifications and automatically updating matching components.

参考

Automatically receiving changes from GitLab

For instruction on setting up GitLab integration

https://docs.gitlab.com/ce/user/project/integrations/webhooks.html

Generic information about GitLab Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/bitbucket/

Special hook for handling Bitbucket notifications and automatically updating matching components.

参考

Automatically receiving changes from Bitbucket

For instruction on setting up Bitbucket integration

https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/

Generic information about Bitbucket Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/pagure/

バージョン 3.3 で追加.

Pagure 通知を処理し、一致するコンポーネントを自動的に更新するための特別なフック。

参考

Pagure からの変更を自動的に受信

Pagure 統合の設定方法について

https://docs.pagure.org/pagure/usage/using_webhooks.html

Pagure WEB フックに関する一般的な情報

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/azure/

バージョン 3.8 で追加.

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

参考

Automatically receiving changes from Azure Repos

For instruction on setting up Azure integration

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

Generic information about Azure Repos Web Hooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/gitea/

バージョン 3.9 で追加.

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

参考

Automatically receiving changes from Gitea Repos

For instruction on setting up Gitea integration

https://docs.gitea.io/en-us/webhooks/

Generic information about Gitea Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

POST /hooks/gitee/

バージョン 3.9 で追加.

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

参考

Automatically receiving changes from Gitee Repos

For instruction on setting up Gitee integration

https://gitee.com/help/categories/40

Generic information about Gitee Webhooks

ENABLE_HOOKS

For enabling hooks for whole Weblate

Exports

Weblate provides various exports to allow you to further process the data.

GET /exports/stats/(string: project)/(string: component)/
クエリ パラメータ
  • format (string) -- Output format: either json or csv

バージョン 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.

Example request:

GET /exports/stats/weblate/main/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript

Example response:

HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json

[
    {
        "code": "cs",
        "failing": 0,
        "failing_percent": 0.0,
        "fuzzy": 0,
        "fuzzy_percent": 0.0,
        "last_author": "Michal Čihař",
        "last_change": "2012-03-28T15:07:38+00:00",
        "name": "Czech",
        "total": 436,
        "total_words": 15271,
        "translated": 436,
        "translated_percent": 100.0,
        "translated_words": 3201,
        "url": "http://hosted.weblate.org/engage/weblate/cs/",
        "url_translate": "http://hosted.weblate.org/projects/weblate/main/cs/"
    },
    {
        "code": "nl",
        "failing": 21,
        "failing_percent": 4.8,
        "fuzzy": 11,
        "fuzzy_percent": 2.5,
        "last_author": null,
        "last_change": null,
        "name": "Dutch",
        "total": 436,
        "total_words": 15271,
        "translated": 319,
        "translated_percent": 73.2,
        "translated_words": 3201,
        "url": "http://hosted.weblate.org/engage/weblate/nl/",
        "url_translate": "http://hosted.weblate.org/projects/weblate/main/nl/"
    },
    {
        "code": "el",
        "failing": 11,
        "failing_percent": 2.5,
        "fuzzy": 21,
        "fuzzy_percent": 4.8,
        "last_author": null,
        "last_change": null,
        "name": "Greek",
        "total": 436,
        "total_words": 15271,
        "translated": 312,
        "translated_percent": 71.6,
        "translated_words": 3201,
        "url": "http://hosted.weblate.org/engage/weblate/el/",
        "url_translate": "http://hosted.weblate.org/projects/weblate/main/el/"
    }
]

RSS フィード

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.