Weblate の REST API

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

The API is also documented using OpenAPI 3.0 on the /api/schema/ URL, you can browse at /api/docs/.

注釈

OpenAPI is available as a feature preview. The documentation is most likely incomplete at this point and subject to change. Please consult the documentation below for more detailed information on the API.

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

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

ANY /

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

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

  • page -- ページ分割された結果のページを返す(自動ナビゲーションの実現に next フィールドと previous フィールドを使用する)。

  • page_size -- リクエストの返り値の項目数を指定します。デフォルトは 50 で、最大値は 1000 です。units エンドポイントの場合、デフォルトは 100 で、最大値は 10000 です。デフォルト値は、PAGE_SIZE 設定を使用して設定することもできます。

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

  • Authorization -- 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 -- スロットルが設定されている場合

認証トークン

バージョン 4.10 で変更: 4.10 リリースからプロジェクトスコープのトークンが導入されました。

各ユーザーは、ユーザー プロファイルから取得できる個人用アクセス トークンを持っています。新しく生成された ユーザー トークンには、wlu_ という接頭辞が付きます。

指定したプロジェクトのみへの API アクセス用に、プロジェクト スコープのトークンを作成できます。これらのトークンは、wlp_ 接頭辞で識別できます。

認証の例

リクエストの例:

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/

コンポーネントとカテゴリ

カテゴリ 内で入れ子になっているコンポーネントにアクセスするには、カテゴリ名をスラッシュで区切られたコンポーネント名に URL エンコードすることが必要です。たとえば、docs カテゴリに配置された usagedocs%2Fusage と変換して使用してください。この場合の完全な URL は、https://example.com/api/components/hello/docs%252Fusage/repository/ のようになります。

API 接続制限

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

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

Docker コンテナでは、WEBLATE_API_RATELIMIT_ANON および WEBLATE_API_RATELIMIT_USER を使用して設定します。

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

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

ユーザー

Added in version 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) -- ユーザーが有効かどうか? (オプション)

  • is_bot (boolean) -- ユーザーがボットかどうか?(オプション)(プロジェクトスコープのトークンに使用)

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

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

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

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

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

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

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

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

  • is_bot (boolean) -- ユーザーがボットかどうか (プロジェクト スコープのトークンに使用)

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

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

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

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

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

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

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

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

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

  • is_bot (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) -- ユーザーが有効かどうか

  • is_bot (boolean) -- ユーザーがボットかどうか (プロジェクト スコープのトークンに使用)

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

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

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

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

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

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

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

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

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

Added in version 4.13.1.

グループからユーザーを削除する。

パラメータ:
  • 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

グループ

Added in version 4.0.

GET /api/groups/

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

参考

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

POST /api/groups/

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

パラメータ:
GET /api/groups/(int: id)/

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

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

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

JSON データの例:

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

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

パラメータ:
  • 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

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

Added in version 5.5.

ユーザーをチーム管理者に追加します。

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

フォーム パラメーター:
  • string user_id -- ユーザー ID

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

Added in version 5.5.

ユーザーをチーム管理者から削除します。

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

  • user_id (integer) -- ユーザー 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) -- テキストの方向

  • population (int) -- 言語の使用人数

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

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

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

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

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

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

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

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

リクエスト JSON オブジェクト:
  • population (int) -- 言語の使用人数

JSON データの例:

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

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

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

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

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

  • population (int) -- 言語の使用人数

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

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

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

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

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

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

  • population (int) -- 言語の使用人数

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

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

言語を削除します。

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

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

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

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

参考

返される属性については、統計データ を確認してください。

プロジェクト

GET /api/projects/

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

参考

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

POST /api/projects/

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

パラメータ:
  • 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)/

Added in version 4.3.

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

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

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

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

Added in version 4.3.

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

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

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

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

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

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

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

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

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

Added in version 5.5.

プロジェクトに関連するすべての使用可能な翻訳ファイルを、指定した形式と言語でアーカイブファイルとしてダウンロードします。

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

クエリ パラメータ:
  • format (string) -- 使用する圧縮形式; 指定しない場合は、デフォルトで zip; 対応している形式: zip および zip:CONVERSION ここで CONVERSION は、翻訳のダウンロード にリストされているコンバータの 1 つです。

  • language_code (string) -- ダウンロードする言語コード。未指定の場合、全ての言語が含まれます。

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) -- マージが必要な変更が上流にあるかどうか

  • 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-syncfile-scan のいずれか一つ

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

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

バージョン 4.6 で変更: 複製されたリポジトリは、Weblate の内部 URL を使用してプロジェクト内で自動的に共有するように変更されました。disable_autoshare を使用すると無効にできます。

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

ヒント

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

注釈

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

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

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

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

  • boolean disable_autoshare -- Weblate の内部 URL による自動リポジトリ共有を無効にする。

リクエスト JSON オブジェクト:
レスポンス JSON オブジェクト:

zipfile および docfile パラメーターを使用してファイルをアップロードする場合は JSON を使用できません。データは 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",
        "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/

Git から新しいコンポーネントを作成する 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",
    "name": "Weblate",
    "slug": "weblate",
    "repo": "https://github.com/WeblateOrg/hello.git",
    "template": "",
    "new_base": "po/hello.pot",
    "vcs": "git"
}

別のコンポーネントから新しいコンポーネントを作成する 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

{
    "file_format": "po",
    "filemask": "po/*.po",
    "name": "Weblate",
    "slug": "weblate",
    "repo": "weblate://weblate/hello",
    "template": "",
    "new_base": "po/hello.pot",
    "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",
             "population": 159034349015,
            "name": "English",
            "url": "http://example.com/api/languages/en/",
            "web_url": "http://example.com/languages/en/"
        },
        "url": "http://example.com/api/projects/hello/",
        "web": "https://weblate.org/",
        "web_url": "http://example.com/projects/hello/"
    },
    "repo": "file:///home/nijel/work/weblate-hello",
    "template": "",
    "new_base": "",
    "url": "http://example.com/api/components/hello/weblate/",
    "vcs": "git",
    "web_url": "http://example.com/projects/hello/weblate/"
}
GET /api/projects/(string: project)/languages/

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

パラメータ:
  • 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/

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

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

参考

返される属性については、統計データ を確認してください。

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

Added in version 5.0: プロジェクトのカテゴリを返します。フィールドの定義については、GET /api/categories/(int:id)/ を確認してください。

パラメータ プロジェクト:

プロジェクト URL スラッグ

タイプ プロジェクト:

string

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

Added in version 5.3: 返り値は、プロジェクトのラベルです。

パラメータ プロジェクト:

プロジェクト URL スラッグ

タイプ プロジェクト:

string

>json int id:

ラベルの ID

>json string name:

ラベル名

>json string color:

ラベルの色

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

Added in version 5.3: プロジェクトのラベルを作成します。

パラメータ プロジェクト:

プロジェクト URL スラッグ

タイプ プロジェクト:

string

<json string name:

ラベル名

<json string color:

ラベルの色

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

プロジェクトの貢献者一覧を返します。

Added in version 5.7.

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

  • start (date) -- ISO 8601 形式による最小日時(必須)

  • end (date) -- ISO 8601 形式による最大日時(必須)

  • lang (source_language) -- 検索する言語コード

レスポンス JSON オブジェクト:
  • email (string) -- 貢献者のメールアドレス

  • full_name (string) -- 貢献者のフルネーム

  • change_count (string) -- 時間範囲内で行われた変更の数

コンポーネント

ヒント

POST /api/projects/(string:project)/components/ を使用して、新しいコンポーネントを作成します。

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",
             "population": 159034349015,
            "name": "English",
            "url": "http://example.com/api/languages/en/",
            "web_url": "http://example.com/languages/en/"
        },
        "url": "http://example.com/api/projects/hello/",
        "web": "https://weblate.org/",
        "web_url": "http://example.com/projects/hello/"
    },
    "source_language": {
        "code": "en",
        "direction": "ltr",
        "population": 159034349015,
        "name": "English",
        "url": "http://example.com/api/languages/en/",
        "web_url": "http://example.com/languages/en/"
    },
    "repo": "file:///home/nijel/work/weblate-hello",
    "template": "",
    "new_base": "",
    "url": "http://example.com/api/components/hello/weblate/",
    "vcs": "git",
    "web_url": "http://example.com/projects/hello/weblate/"
}
PATCH /api/components/(string: project)/(string: component)/

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",
            "population": 159034349015,
            "name": "English",
            "url": "http://example.com/api/languages/en/",
            "web_url": "http://example.com/languages/en/"
        },
        "url": "http://example.com/api/projects/hello/",
        "web": "https://weblate.org/",
        "web_url": "http://example.com/projects/hello/"
    },
    "repo": "file:///home/nijel/work/weblate-hello",
    "template": "",
    "new_base": "",
    "url": "http://example.com/api/components/hello/weblate/",
    "vcs": "git",
    "web_url": "http://example.com/projects/hello/weblate/"
}
PUT /api/components/(string: project)/(string: component)/

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

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

パラメータ:
  • 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)/file/

Added in version 4.9.

指定した形式を使用して、コンポーネントに関連付けられている使用可能なすべての翻訳を圧縮ファイルとしてダウンロードします。

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

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

クエリ パラメータ:
  • format (string) -- 使用する圧縮形式; 指定しない場合は、デフォルトで zip; 対応している形式: zip および zip:CONVERSION ここで CONVERSION は、翻訳のダウンロード にリストされているコンバータの 1 つです。

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) -- マージが必要な変更が上流にあるかどうか

  • 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",
        "population": 1303174280
        "name": "Czech",
        "url": "http://example.com/api/languages/cs/",
        "web_url": "http://example.com/languages/cs/"
    },
    "language_code": "cs",
    "id": 125,
    "last_author": null,
    "last_change": null,
    "share_url": "http://example.com/engage/hello/cs/",
    "total": 4,
    "total_words": 15,
    "translate_url": "http://example.com/translate/hello/weblate/cs/",
    "translated": 0,
    "translated_percent": 0.0,
    "translated_words": 0,
    "url": "http://example.com/api/translations/hello/weblate/cs/",
    "web_url": "http://example.com/projects/hello/weblate/cs/"
}
GET /api/components/(string: project)/(string: component)/statistics/

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

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

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

参考

返される属性については、統計データ を確認してください。

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

Added in version 4.5.

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

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

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

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

Added in version 4.5.

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

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

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

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

Added in version 4.5.

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

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

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

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

プロジェクトの貢献者一覧を返します。

Added in version 5.7.

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

  • start (date) -- ISO 8601 形式による最小日時(必須)

  • end (date) -- ISO 8601 形式による最大日時(必須)

  • lang (source_language) -- 検索する言語コード

レスポンス JSON オブジェクト:
  • email (string) -- 貢献者のメールアドレス

  • full_name (string) -- 貢献者のフルネーム

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

翻訳を削除します。

パラメータ:
  • 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 (array) -- モノリンガル翻訳: 原文(複数形を作成しない場合は単一の文字列を使用)

  • context (string) -- バイリンガル翻訳: 翻訳ユニットのコンテキスト

  • source (array) -- バイリンガル翻訳: 原文(複数形を作成しない場合は単一の文字列を使用)

  • target (array) -- バイリンガル翻訳: 対象文字列(複数形を作成しない場合は単一の文字列を使用)

  • state (int) -- 文字列の状態。参照: GET /api/units/(int:id)/

レスポンス JSON オブジェクト:
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/

VCS に保存しているままの翻訳ファイル(format パラメータを指定しないとき)、または他の形式に変換した翻訳ファイル(参照: 翻訳のダウンロード)をダウンロードします。

注釈

この API エンド ポイントは、データではなくファイル全体を操作するため、出力には他の API とは異なるロジックを使用します。受けとる format パラメータのセットは異なります。このようなパラメータがない場合は、VCS に保存された翻訳ファイルを取得します。

レスポンス ヘッダー:
  • Last-Modified -- このファイルの最終変更のタイムスタンプ。

リクエスト ヘッダー:
  • If-Modified-Since -- ファイルがその時刻以降に変更されていない場合は、応答をスキップします。

クエリ パラメータ:
  • format -- 使用するファイル形式。指定しない場合、フォーマット変換は行われません。変換に対応する形式については、翻訳のダウンロード を参照してください

  • q (string) -- ダウンロードする文字列をフィルタリングします。参照: 検索ページ。変換が行われる(format を指定した)場合にのみ適用されます。

パラメータ:
  • 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 -- あいまい(要編集付き)文字列処理(空文字列processapprove

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/

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

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

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

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

参考

返される属性については、統計データ を確認してください。

翻訳メモリ

Added in version 4.14.

GET /api/memory/

返り値は、メモリのリストです。

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

メモリ オブジェクトを削除します

パラメータ:
  • memory_object_id -- メモリ オブジェクト ID

ユニット

unit とは、原文と対応する翻訳文をペアにした、関連する情報をも含む翻訳の複合データです。この用語は Translate Toolkit と XLIFF に由来しています。

GET /api/units/

返り値は、翻訳ユニットのリストです。

パラメータ:
  • q (string) -- 検索クエリ文字列 検索 (オプション)

参考

ユニット オブジェクトの属性は、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) -- 翻訳ユニットのフラグ

  • labels (array) -- 翻訳単位ラベル、原文単位で使用可能

  • 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) -- 文字列の説明、原文ユニットで利用可能、参照: 原文の追加情報

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

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

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

  • pending (boolean) -- ユニットが書き込み保留中かどうか

  • timestamp (timestamp) -- 翻訳開始日

  • last_updated (timestamp) -- 文字列の最終更新日

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

Added in version 4.3.

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

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

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

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

  • explanation (string) -- 文字列の説明、原文ユニットで利用可能、参照: 原文の追加情報

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

  • labels (array) -- ラベル、原文単位で利用可能

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

Added in version 4.3.

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

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

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

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

  • explanation (string) -- 文字列の説明、原文ユニットで利用可能、参照: 原文の追加情報

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

  • labels (array) -- ラベル、原文単位で利用可能

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

Added in version 4.3.

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

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

変更

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) -- テキストが変更されたイベント

  • old (string) -- 前のテキスト

  • details (object) -- 変更に関する追加の詳細

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

スクリーンショット

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

アドオン

Added in version 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

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

Added in version 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) -- コンポーネント リストのスラッグ

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

Added in version 5.0.1: コンポーネント リスト内のコンポーネントを一覧表示します。

パラメータ スラッグ:

コンポーネント リストのスラッグ

タイプ スラッグ:

string

フォーム文字列コンポーネント ID:

コンポーネント ID

>json 配列の結果:

コンポーネント オブジェクトの配列。参照: GET /api/components/(string:project)/(string:component)/

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 を使用してください。

タスク

Added in version 4.4.

GET /api/tasks/

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

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

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

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

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

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

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

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

統計データ

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

オブジェクトごとに複数の統計エンドポイントがあり、どれも同じ構造をしています。

パラメータ:
  • object (string) -- URL パス

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  • fuzzy_words_percent (float) -- あいまいな(要編集付き)単語の割合

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

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

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

  • approved (int) -- 承認された文字列の数

  • approved_words (int) -- 承認された単語の数

  • approved_chars (int) -- 承認された文字の数

  • approved_percent (float) -- 承認された文字列の割合

  • approved_words_percent (float) -- 承認された単語の割合

  • approved_chars_percent (float) -- 承認された文字の割合

  • readonly (int) -- 翻訳禁止の文字列の数

  • readonly_words (int) -- 翻訳禁止の単語の数

  • readonly -- 翻訳禁止の文字数

  • readonly_percent (float) -- 翻訳禁止の文字列の割合

  • readonly_words_percent (float) -- 翻訳禁止の単語の割合

  • readonly_char_percent (float) -- 翻訳禁止の文字の割合

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

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

  • name (string) -- オブジェクト名

  • url (string) -- オブジェクトにアクセスするためのURL(該当する場合)

  • url_translate (string) -- 翻訳にアクセスするための URL(該当する場合)

  • code (string) -- 言語コード(該当する場合)

メトリックス

GET /api/metrics/

サーバーのメトリックスを返します。

バージョン 5.6.1 で変更: メトリックは、?format=openmetrics を使用して OpenMetrics 互換形式で公開できるようになりました。

レスポンス 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) -- 設定済みサーバー名

カテゴリ

GET /api/categories/

Added in version 5.0.

使用可能なカテゴリを一覧表示します。フィールドの定義については、GET /api/categories/(int:id)/ を確認してください。

POST /api/categories/

Added in version 5.0.

新しいカテゴリを作成します。フィールドの定義については、GET /api/categories/(int:id)/ を確認してください。

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

Added in version 5.0.

パラメータ:
  • id (int) -- カテゴリ ID

レスポンス JSON オブジェクト:
  • name (str) -- カテゴリの名前。

  • slug (str) -- カテゴリのスラッグ。

  • project (str) -- プロジェクトへのリンク。

  • category (str) -- 親カテゴリへのリンク。

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

Added in version 5.0: カテゴリに関する部分的な情報を編集します。

パラメータ ID:

カテゴリ ID

タイプ ID:

int

>json object configuration:

オプションのカテゴリ設定

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

Added in version 5.0: カテゴリに関する完全な情報を編集します。

パラメータ ID:

カテゴリ ID

タイプ ID:

int

>json object configuration:

オプションのカテゴリ設定

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

Added in version 5.0: カテゴリの削除。

パラメータ ID:

カテゴリ ID

タイプ ID:

int

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

Added in version 5.5.

返り値は、カテゴリの統計情報です。

パラメータ:
  • project (int) -- カテゴリ ID

参考

返される属性については、統計データ を確認してください。

通知フック

通知フックを使用すると、外部アプリケーションは、VCS リポジトリが更新されたことを Weblate に通知できます。

プロジェクト、コンポーネントおよび翻訳のリポジトリ エンドポイントを使用して、各リポジトリを更新できます。ドキュメントは、POST /api/projects/(string:project)/repository/ を確認してください。

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

バージョン 2.6 で非推奨: POST /api/components/(string:project)/(string:component)/repository/ を代わりに使用してください。これは、ACL で制限されたプロジェクトの認証で正しく動作します。

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

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

バージョン 2.6 で非推奨: POST /api/projects/(string:project)/repository/ を代わりに使用してください。これは、ACL で制限されたプロジェクトの認証で正しく動作します。

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

POST /hooks/github/

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

注釈

GitHub で直接対応している、Weblate 通知の設定方法: リポジトリ設定で Weblate サービスフックを有効にし、URL を Weblate インストールの URL に設定します。

参考

変更を GitHub から自動受信

GitHub 連携の設定方法

https://docs.github.com/en/get-started/customizing-your-github-workflow/exploring-integrations/about-webhooks

GitHub Webhooks についての一般的な情報

ENABLE_HOOKS

Weblate 全体のフックを有効にする場合

POST /hooks/gitlab/

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

参考

変更を GitLab から自動受信

GitLab 連携の設定方法

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

GitHub Webhooks についての一般的な情報

ENABLE_HOOKS

Weblate 全体のフックを有効にする場合

POST /hooks/bitbucket/

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

参考

変更を Bitbucket から自動受信

Bitbucket 連携の設定方法

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

Bitbucket についての一般的な情報

ENABLE_HOOKS

Weblate 全体のフックを有効にする場合

POST /hooks/pagure/

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

参考

変更を Pagure から自動受信

Pagure 連携の設定方法について

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

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

ENABLE_HOOKS

Weblate 全体のフックを有効にする場合

POST /hooks/azure/

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

注釈

送信するリソースの詳細All が設定されていることを確認してください。設定されていない場合、Weblate は Azure リポジトリと一致できなくなります。

参考

変更を Azure リポジトリから自動受信

Azure Repos についての一般的な情報

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

Azure DevOps Web フックについての一般的な情報

ENABLE_HOOKS

Weblate 全体のフックを有効にする場合

POST /hooks/gitea/

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

参考

変更を Gitea リポジトリから自動受信

Gitea 連携の設定方法

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

Gitea Web フックについての一般的な情報

ENABLE_HOOKS

Weblate 全体のフックを有効にする場合

POST /hooks/gitee/

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

参考

変更を Gitee リポジトリから自動受信

Gitee 連携の設定方法

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

Gitee についての一般的な情報

ENABLE_HOOKS

Weblate 全体のフックを有効にする場合

エクスポート

Weblate には、データをさらに処理するためのさまざまなエクスポート機能があります。

GET /exports/stats/(string: project)/(string: component)/
クエリ パラメータ:
  • format (string) -- 出力形式: json または csv

バージョン 2.6 で非推奨: GET /api/components/(string:project)/(string:component)/statistics/ および GET /api/translations/(string:project)/(string:component)/(string:language)/statistics/ を代わりに使用してください。ACL で制御するプロジェクトへのアクセスも許可します。

指定したコンポーネントの統計情報を、指定した形式で取得します。

リクエストの例:

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

レスポンスの例:

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 フィード

翻訳の変更は RSS フィードにエクスポートされます。

GET /exports/rss/(string: project)/(string: component)/(string: language)/

翻訳の最新の変更を含む RSS フィードを取得します。

GET /exports/rss/(string: project)/(string: component)/

コンポーネントの最近の変更を含む RSS フィードを取得します。

GET /exports/rss/(string: project)/

プロジェクトの最近の変更を含む RSS フィードを取得します。

GET /exports/rss/language/(string: language)/

言語の最近の変更を含む RSS フィードを取得します。

GET /exports/rss/

Weblate インスタンスの最近の変更を含む RSS フィードを取得します。