Method: ampUrls.batchGet
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
HTTP リクエスト
POST https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet
この URL は Google API HTTP アノテーション構文を使用します。
リクエストの本文
リクエストの本文には次の構造のデータが含まれます。
JSON 表現 |
{
"urls": [
string
]
"lookupStrategy": enum(LookupStrategy),
} |
項目 |
urls[] |
string
ペア設定された AMP URL をルックアップするための URL のリスト。URL の大文字と小文字は区別されます。1 回で最大 50 個の URL をルックアップできます(使用制限を参照)。
|
lookupStrategy |
enum(LookupStrategy )
リクエスト対象の lookupStrategy。
|
レスポンスの本文
成功すると、レスポンスの本文に次の構造のデータが含まれます。
JSON 表現 |
{
"ampUrls": [
{
object(AmpUrl)
}
],
"urlErrors": [
{
object(AmpUrlError)
}
],
}
|
項目 |
ampUrls[] |
object(AmpUrl )
BatchAmpUrlsRequest の各 URL に対する URL レスポンス。レスポンスはバッチ リクエストの URL の順序と同じにならない場合があります。BatchAmpUrlsRequest に重複する URL が含まれている場合、AmpUrl は一度だけ生成されます。
|
urlErrors[] |
object(AmpUrlError )
リクエストの URL に AMP URL が含まれていないエラー。
|
LookupStrategy
列挙型 |
FETCH_LIVE_DOC |
FETCH_LIVE_DOC 戦略では、インデックス内に見つからない URL のライブ ドキュメントの取得が行われます。インデックス内に見つからないリクエスト URL はすべてリアルタイムでクロールされ、対応する AMP URL が存在するかどうかが検証されます。この戦略の範囲は広範にわたりますが、リアルタイムのクロールによって余分な遅延が生じます。これがデフォルトの戦略です。この戦略を使用するアプリでは、API 呼び出しの HTTP タイムアウトを長く設定する必要があります。 |
IN_INDEX_DOC |
IN_INDEX_DOC 戦略では、インデックス内に見つからない URL のライブ ドキュメントの取得がスキップされます。低遅延が求められるアプリでは、IN_INDEX_DOC 戦略を使用することをおすすめします。 |
AmpUrl
リクエストの URL に対する AMP URL レスポンス。
JSON 表現 |
{
"originalUrl": string,
"ampUrl": string,
"cdnAmpUrl": string,
} |
項目 |
originalUrl |
string
元の非 AMP URL。
|
ampUrl |
string
サイト運営者のウェブサーバーを指す AMP URL。
|
cdnAmpUrl |
string
Google AMP Cache 内にキャッシュされたドキュメントを指す AMP Cache URL。
|
AmpUrlError
リクエストの URL が見つからなかった場合の AMP URL エラーのリソース。
JSON 表現 |
{
"errorCode": enum(ErrorCode),
"errorMessage": string,
"originalUrl": string,
} |
項目 |
errorCode |
enum(ErrorCode )
API 呼び出しのエラーコード。
|
errorMessage |
string
説明的なエラー メッセージ(オプション)。
|
originalUrl |
string
元の非 AMP URL。
|
ErrorCode
AMP URL のバッチ ルックアップのエラーコード。
列挙型 |
ERROR_CODE_UNSPECIFIED |
未指定のエラー。 |
INPUT_URL_NOT_FOUND |
リクエストの URL がインデックス内に見つからないことを示します。原因としては、URL が見つからない、Googlebot がアクセスできない、その他のなんらかのエラーが考えられます。 |
NO_AMP_URL |
リクエストの URL に対応する AMP URL が見つからなかったことを示します。 |
APPLICATION_ERROR |
サーバーでなんらかのアプリケーション エラーが発生し、クライアントから再試行するよう忠告されたことを示します。 |
URL_IS_VALID_AMP |
廃止: リクエストの URL が有効な AMP URL であることを示します。これはエラー状態ではないため、成功または失敗のしるしとして使用しないでください。このエラーコードは API の将来のバージョンで削除される予定です。 |
URL_IS_INVALID_AMP |
リクエスト URL に対応する AMP URL が見つかったものの、有効な AMP HTML ではないことを示します。 |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-04 UTC。
[null,null,["最終更新日 2025-08-04 UTC。"],[[["\u003cp\u003eReturns AMP URLs and their corresponding AMP Cache URLs for given input URLs.\u003c/p\u003e\n"],["\u003cp\u003eUses a batch request containing up to 50 URLs and a lookup strategy (FETCH_LIVE_DOC or IN_INDEX_DOC).\u003c/p\u003e\n"],["\u003cp\u003eThe response includes the AMP URL and AMP Cache URL for successful lookups and error details for unsuccessful ones.\u003c/p\u003e\n"],["\u003cp\u003ePossible error codes include URL not found, no corresponding AMP URL, application error, and invalid AMP HTML.\u003c/p\u003e\n"],["\u003cp\u003eLeverages the Google AMP Cache for faster delivery of AMP content.\u003c/p\u003e\n"]]],["This API facilitates retrieving AMP URLs and their corresponding Google AMP Cache URLs. It uses a `POST` request to `ampUrls:batchGet`, taking a list of up to 50 URLs and a `lookupStrategy` (either `FETCH_LIVE_DOC` or `IN_INDEX_DOC`) in the request body. The response contains an array of `ampUrls` (with original, AMP, and cache URLs) and `urlErrors` (with error codes and messages). Error codes are specified for issues like \"URL not found\" and \"no AMP URL found.\"\n"],null,["# Method: ampUrls.batchGet\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n - [JSON representation](#body.BatchGetAmpUrlsResponse.SCHEMA_REPRESENTATION)\n- [LookupStrategy](#LookupStrategy)\n- [AmpUrl](#AmpUrl)\n - [JSON representation](#AmpUrl.SCHEMA_REPRESENTATION)\n- [AmpUrlError](#AmpUrlError)\n - [JSON representation](#AmpUrlError.SCHEMA_REPRESENTATION)\n- [ErrorCode](#ErrorCode)\n- [Try it!](#try-it)\n\nReturns AMP URL(s) and equivalent [AMP Cache URL(s)](/amp/cache/overview#amp-cache-url-format).\n\n### HTTP request\n\n`POST https://acceleratedmobilepageurl.googleapis.com/v1/ampUrls:batchGet`\n\nThe URL uses [Google API HTTP annotation](https://github.com/googleapis/googleapis/blob/master/google/api/http.proto) syntax.\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation ||\n|--------------------------------------------------------------------------------|---|\n| ```gdscript { \"urls\": [ string ] \"lookupStrategy\": enum(LookupStrategy), } ``` |\n\n| Fields ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `urls[]` | `string` List of URLs to look up for the paired AMP URLs. The URLs are case-sensitive. Up to 50 URLs per lookup (see [Usage Limits](/amp/cache/reference/limits)). |\n| `lookupStrategy` | `enum(`[LookupStrategy](/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#LookupStrategy)`)` The lookupStrategy being requested. |\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\nBatch AMP URL response.\n\n| JSON representation ||\n|----------------------------------------------------------------------------------------------|---|\n| ```text { \"ampUrls\": [ { object(AmpUrl) } ], \"urlErrors\": [ { object(AmpUrlError) } ], } ``` |\n\n| Fields ||\n|---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ampUrls[]` | `object(`[AmpUrl](/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#AmpUrl)`)` For each URL in BatchAmpUrlsRequest, the URL response. The response might not be in the same order as URLs in the batch request. If BatchAmpUrlsRequest contains duplicate URLs, AmpUrl is generated only once. |\n| `urlErrors[]` | `object(`[AmpUrlError](/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#AmpUrlError)`)` The errors for requested URLs that have no AMP URL. |\n\nLookupStrategy\n--------------\n\n| Enums ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `FETCH_LIVE_DOC` | FETCH_LIVE_DOC strategy involves live document fetch of URLs not found in the index. Any request URL not found in the index is crawled in realtime to validate if there is a corresponding AMP URL. This strategy has higher coverage but with extra latency introduced by realtime crawling. This is the default strategy. Applications using this strategy should set higher HTTP timeouts of the API calls. |\n| `IN_INDEX_DOC` | IN_INDEX_DOC strategy skips fetching live documents of URL(s) not found in index. For applications which need low latency use of IN_INDEX_DOC strategy is recommended. |\n\nAmpUrl\n------\n\nAMP URL response for a requested URL.\n\n| JSON representation ||\n|-------------------------------------------------------------------------------|---|\n| ```text { \"originalUrl\": string, \"ampUrl\": string, \"cdnAmpUrl\": string, } ``` |\n\n| Fields ||\n|---------------|---------------------------------------------------------------------------------------------------------------------------------|\n| `originalUrl` | `string` The original non-AMP URL. |\n| `ampUrl` | `string` The AMP URL pointing to the publisher's web server. |\n| `cdnAmpUrl` | `string` The [AMP Cache URL](/amp/cache/overview#amp-cache-url-format) pointing to the cached document in the Google AMP Cache. |\n\nAmpUrlError\n-----------\n\nAMP URL Error resource for a requested URL that couldn't be found.\n\n| JSON representation ||\n|--------------------------------------------------------------------------------------------------|---|\n| ```gdscript { \"errorCode\": enum(ErrorCode), \"errorMessage\": string, \"originalUrl\": string, } ``` |\n\n| Fields ||\n|----------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| `errorCode` | `enum(`[ErrorCode](/amp/cache/reference/acceleratedmobilepageurl/rest/v1/ampUrls/batchGet#ErrorCode)`)` The error code of an API call. |\n| `errorMessage` | `string` An optional descriptive error message. |\n| `originalUrl` | `string` The original non-AMP URL. |\n\nErrorCode\n---------\n\nError codes for a batch AMP URL lookup.\n\n| Enums ||\n|--------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ERROR_CODE_UNSPECIFIED` | Not specified error. |\n| `INPUT_URL_NOT_FOUND` | Indicates the requested URL is not found in the index, possibly because it's unable to be found, not able to be accessed by Googlebot, or some other error. |\n| `NO_AMP_URL` | Indicates no AMP URL has been found that corresponds to the requested URL. |\n| `APPLICATION_ERROR` | Indicates some kind of application error occurred at the server. Client advised to retry. |\n| `URL_IS_VALID_AMP` | DEPRECATED: Indicates the requested URL is a valid AMP URL. This is a non-error state, should not be relied upon as a sign of success or failure. It will be removed in future versions of the API. |\n| `URL_IS_INVALID_AMP` | Indicates that an AMP URL has been found that corresponds to the request URL, but it is not valid AMP HTML. |\n\nTry it!\n-------"]]