หน้า: รับ

ดึงทรัพยากรหน้าเว็บ 1 รายการตามรหัสหน้า ลองเลยหรือดูตัวอย่าง

ต้องระบุการให้สิทธิ์หากหน้าอยู่ในบล็อกส่วนตัว ถ้าหน้าเว็บนั้นอยู่ในบล็อกสาธารณะ จะสามารถเรียกใช้วิธีการนี้โดยไม่ได้รับอนุญาต

ส่งคำขอ

คำขอ HTTP

GET https://www.googleapis.com/blogger/v3/blogs/blogId/pages/pageId

พารามิเตอร์

ชื่อพารามิเตอร์ ค่า คำอธิบาย
พารามิเตอร์ที่จำเป็น
blogId string รหัสของบล็อกที่มีหน้าเว็บนั้น
pageId string รหัสของหน้าเว็บที่จะรับ
พารามิเตอร์ที่ไม่บังคับ
view string

ค่าที่ยอมรับได้ มีดังนี้
  • "ADMIN": รายละเอียดระดับผู้ดูแลระบบ
  • "AUTHOR": รายละเอียดระดับผู้เขียน
  • "READER": รายละเอียดระดับผู้ดูแลระบบ

เนื้อหาของคำขอ

โปรดอย่าให้เนื้อหาคำขอตามวิธีการนี้

คำตอบ

หากทำสำเร็จ เมธอดนี้จะแสดงทรัพยากรหน้าเว็บในเนื้อหาการตอบกลับ

ตัวอย่าง

หมายเหตุ: ตัวอย่างโค้ดที่มีสำหรับวิธีการนี้ไม่ได้แสดงถึงภาษาโปรแกรมที่รองรับทั้งหมด (ดูรายการภาษาที่รองรับได้ในหน้าไลบรารีของไคลเอ็นต์)

Java

ใช้ไลบรารีของไคลเอ็นต์ Java

// The BlogId for the http://buzz.blogger.com/ blog.
String BUZZ_BLOG_ID = "2399953";
// The PageId for a buzz page.
String BUZZ_PAGE_ID = "8251768148820290538";
// 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-PagesGet-Snippet/1.0")
.setHttpRequestInitializer(credential).build();
// The request action.
Get pagesGetAction = blogger.pages().get(BUZZ_BLOG_ID, BUZZ_PAGE_ID);
// Restrict the result content to just the data we need.
pagesGetAction.setFields("content,published,updated,title,url");
// This step sends the request to the server.
Page page = pagesGetAction.execute();
// Now we can navigate the response.
System.out.println("Title: " + page.getTitle());
System.out.println("Publised: " + page.getPublished());
System.out.println("Updated: " + page.getUpdated());
System.out.println("URL: " + page.getUrl());
System.out.println("Content: " + page.getContent());

ลองใช้เลย

ใช้ API Explorer ด้านล่างเพื่อเรียกใช้เมธอดนี้กับข้อมูลแบบสดและดูการตอบกลับ