דפים: רשימה
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
אחזור רשימת הדפים של בלוג.
רוצים לנסות? או לעיון בדוגמה
הרשאה נדרשת אם הדפים נמצאים בבלוג פרטי. אם הדפים נמצאים בבלוג שגלוי לכולם, אפשר להפעיל את השיטה הזו בלי הרשאה.
בקשה
בקשת 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 ': פרטים ברמת האדמין
|
גוף הבקשה
אין לספק גוף בקשה בשיטה הזו.
תשובה
אם הפעולה בוצעה ללא שגיאות, ה-method מחזיר גוף תגובה עם המבנה הבא:
{
"kind": "blogger#pageList",
"items": [
pages Resource
]
}
שם הנכס |
ערך |
תיאור |
הערות |
kind |
string |
הסוג של הישות. תמיד blogger#pageList |
|
items[] |
list |
רשימת המשאבים של הדפים בבלוג שצוין. |
|
דוגמאות
הערה: דוגמאות הקוד הזמינות לשיטה זו לא מייצגות את כל שפות התכנות הנתמכות (רשימת השפות הנתמכות זמינה בדף של ספריות המשתמשים).
Java
שימוש בספריית הלקוח של 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 Explorer שבהמשך כדי להפעיל את השיטה הזו על נתונים פעילים ולראות את התגובה.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2024-11-23 (שעון UTC).
[null,null,["עדכון אחרון: 2024-11-23 (שעון 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."]]