Страницы: список
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Получает список страниц блога . Попробуйте сейчас или посмотрите пример .
Авторизация требуется, если страницы находятся в приватном блоге. Если страницы находятся в общедоступном блоге, то этот метод можно вызвать без авторизации.
Запрос
HTTP-запрос
GET https://www.googleapis.com/blogger/v3/blogs/blogId/pages
Параметры
Имя параметра | Ценить | Описание |
---|
Обязательные параметры |
blogId | string | Идентификатор блога, из которого нужно получить страницы. |
Дополнительные параметры |
fetchBodies | boolean | Получать ли тела страниц. |
status | string |
Приемлемые значения:- «
draft »: Черновик (неопубликованные) страницы - «
imported »: страницы, содержимое которых было удалено. - «
live »: страницы, доступные для публичного просмотра.
|
view | string |
Приемлемые значения:- «
ADMIN »: сведения об уровне администратора. - «
AUTHOR »: детализация уровня автора. - «
READER »: Подробности на уровне администратора.
|
Тело запроса
Не предоставляйте тело запроса с помощью этого метода.
Ответ
В случае успеха этот метод возвращает тело ответа следующей структуры:
{
"kind": "blogger#pageList",
"items": [
pages Resource
]
}
Имя свойства | Ценить | Описание | Примечания |
---|
kind | string | Вид этой сущности. Всегда blogger#pageList | |
items[] | list | Список ресурсов страниц для указанного блога. | |
Примеры
Примечание. Примеры кода, доступные для этого метода, не представляют все поддерживаемые языки программирования (список поддерживаемых языков см. на странице клиентских библиотек ).
Ява
Использует клиентскую библиотеку Java
// The BlogId for the http://buzz.blogger.com/ blog.
String BUZZ_BLOG_ID = "2399953";
// Configure the Java API Client for Installed Native App
HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
JsonFactory JSON_FACTORY = new JacksonFactory();
// Configure the Installed App OAuth2 flow.
Credential credential = OAuth2Native.authorize(HTTP_TRANSPORT,
JSON_FACTORY, new LocalServerReceiver(),
Arrays.asList(BloggerScopes.BLOGGER));
// Construct the Blogger API access facade object.
Blogger blogger = Blogger.builder(HTTP_TRANSPORT, JSON_FACTORY)
.setApplicationName("Blogger-PagesList-Snippet/1.0")
.setHttpRequestInitializer(credential).build();
// The request action.
List pagesListAction = blogger.pages().list(BUZZ_BLOG_ID);
// Restrict the result content to just the data we need.
pagesListAction.setFields("items(content,title,updated,url)");
// This step sends the request to the server.
PageList pages = pagesListAction.execute();
// Now we can navigate the response.
if (pages.getItems() != null && !pages.getItems().isEmpty()) {
for (Page page : pages.getItems()) {
System.out.println("Title: " + page.getTitle());
System.out.println("URL: " + page.getUrl());
System.out.println("Last Updated:" + page.getUpdated());
System.out.println("Content: " + page.getContent());
}
}
Попробуйте!
Используйте API-интерфейс ниже, чтобы вызвать этот метод для реальных данных и просмотреть ответ.
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-01-20 UTC.
[null,null,["Последнее обновление: 2025-01-20 UTC."],[[["\u003cp\u003eRetrieves a list of pages for a specified blog, including title, content, URL, and last updated date.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization for private blogs but not for public blogs.\u003c/p\u003e\n"],["\u003cp\u003eAllows filtering of results by page status (draft, imported, live) and level of detail (admin, author, reader).\u003c/p\u003e\n"],["\u003cp\u003eProvides options to fetch page bodies and specify desired fields in the response.\u003c/p\u003e\n"],["\u003cp\u003eOffers code examples in Java for utilizing the API.\u003c/p\u003e\n"]]],[],null,["# Pages: list\n\nRetrieves the list of [pages](/blogger/docs/3.0/reference/pages) for a [blog](/blogger/docs/3.0/reference/blogs#resource).\n[Try it now](#try-it) or [see an example](#examples).\n\n[Authorization](/blogger/docs/3.0/using#auth) is required if the pages are on a blog that is private. If the pages are on a blog that is public, then this method can be called without authorization.\n\nRequest\n-------\n\n### HTTP request\n\n```\nGET https://www.googleapis.com/blogger/v3/blogs/blogId/pages\n```\n\n### Parameters\n\n| Parameter name | Value | Description |\n|----------------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Required parameters** |||\n| `blogId` | `string` | The ID of the blog to fetch pages from. |\n| **Optional parameters** |||\n| `fetchBodies` | `boolean` | Whether to retrieve the Page bodies. |\n| `status` | `string` | Acceptable values are: - \"`draft`\": Draft (unpublished) Pages - \"`imported`\": Pages that have had their content removed - \"`live`\": Pages that are publicly visible |\n| `view` | `string` | Acceptable values are: - \"`ADMIN`\": Admin level detail - \"`AUTHOR`\": Author level detail - \"`READER`\": Admin level detail |\n\n### Request body\n\nDo not supply a request body with this method.\n\nResponse\n--------\n\nIf successful, this method returns a response body with the following structure:\n\n```objective-c\n{\n \"kind\": \"blogger#pageList\",\n \"items\": [\n pages Resource\n ]\n}\n```\n\n| Property name | Value | Description | Notes |\n|---------------|----------|-----------------------------------------------------|-------|\n| `kind` | `string` | The kind of this entity. Always `blogger#pageList` | |\n| `items[]` | `list` | The list of Pages Resources for the specified blog. | |\n\nExamples\n--------\n\n**Note:** The code examples available for this method do not represent all supported programming languages (see the [client libraries page](/blogger/docs/3.0/libraries) for a list of supported languages). \n\n### Java\n\nUses the [Java client library](http://code.google.com/p/google-api-java-client/) \n\n```java\n// The BlogId for the http://buzz.blogger.com/ blog.\nString BUZZ_BLOG_ID = \"2399953\";\n\n// Configure the Java API Client for Installed Native App\nHttpTransport HTTP_TRANSPORT = new NetHttpTransport();\nJsonFactory JSON_FACTORY = new JacksonFactory();\n\n// Configure the Installed App OAuth2 flow.\nCredential credential = OAuth2Native.authorize(HTTP_TRANSPORT,\n\tJSON_FACTORY, new LocalServerReceiver(),\n\tArrays.asList(BloggerScopes.BLOGGER));\n\n// Construct the Blogger API access facade object.\nBlogger blogger = Blogger.builder(HTTP_TRANSPORT, JSON_FACTORY)\n\t.setApplicationName(\"Blogger-PagesList-Snippet/1.0\")\n\t.setHttpRequestInitializer(credential).build();\n\n// The request action.\nList pagesListAction = blogger.pages().list(BUZZ_BLOG_ID);\n\n// Restrict the result content to just the data we need.\npagesListAction.setFields(\"items(content,title,updated,url)\");\n\n// This step sends the request to the server.\nPageList pages = pagesListAction.execute();\n\n// Now we can navigate the response.\nif (pages.getItems() != null && !pages.getItems().isEmpty()) {\n\tfor (Page page : pages.getItems()) {\n\t\tSystem.out.println(\"Title: \" + page.getTitle());\n\t\tSystem.out.println(\"URL: \" + page.getUrl());\n\t\tSystem.out.println(\"Last Updated:\" + page.getUpdated());\n\t\tSystem.out.println(\"Content: \" + page.getContent());\n\t}\n}\n```\n\nTry it!\n-------\n\n\nUse the APIs Explorer below to call this method on live data and see the response."]]