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은 대소문자를 구분합니다. 조회당 최대 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이 없는 오류입니다.
|
조회 전략
열거형 |
FETCH_LIVE_DOC |
FETCH_LIVE_DOC 전략에는 색인에서 찾을 수 없는 URL의 실시간 문서 가져오기가 포함됩니다. 색인에서 찾을 수 없는 요청 URL은 상응하는 AMP URL이 있는지 확인하기 위해 실시간으로 크롤링됩니다. 이 전략은 적용 범위가 넓지만 실시간 크롤링을 통해 지연 시간이 추가되었습니다. 기본 전략입니다. 이 전략을 사용하는 애플리케이션은 API 호출의 HTTP 제한 시간을 더 높게 설정해야 합니다. |
IN_INDEX_DOC |
IN_INDEX_DOC 전략은 색인에서 찾을 수 없는 URL의 실시간 문서 가져오기를 건너뜁니다. 지연 시간이 짧은 애플리케이션의 경우 IN_INDEX_DOC 전략을 사용하는 것이 좋습니다. |
AMP URL
요청된 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입니다.
|
AMP URL 오류
요청된 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이 아님을 나타냅니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2023-08-30(UTC)
[null,null,["최종 업데이트: 2023-08-30(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-------"]]