โพสต์: ลบ

ต้องมีการให้สิทธิ์

ลบโพสต์ตามรหัส ลองใช้เลยหรือดูตัวอย่าง

ส่งคำขอ

คำขอ HTTP

DELETE https://www.googleapis.com/blogger/v3/blogs/blogId/posts/postId

พารามิเตอร์

ชื่อพารามิเตอร์ ค่า คำอธิบาย
พารามิเตอร์ที่จำเป็น
blogId string รหัสของบล็อก
postId string รหัสของโพสต์
useTrash boolean ย้ายไปที่ถังขยะหากเป็นไปได้ โปรดทราบว่ามีเพียงโพสต์ที่เผยแพร่อยู่และโพสต์ที่กำหนดเวลาไว้เท่านั้นที่จะย้ายไปยังถังขยะได้

การให้สิทธิ์

คำขอนี้ต้องมีการให้สิทธิ์ด้วยขอบเขตต่อไปนี้อย่างน้อย 1 รายการ (อ่านเพิ่มเติมเกี่ยวกับการรับรองและการให้สิทธิ์)

ขอบเขต
https://www.googleapis.com/auth/blogger

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

อย่าระบุเนื้อหาคำขอด้วยเมธอดนี้

คำตอบ

หากดำเนินการสำเร็จ วิธีการนี้จะแสดงผลลัพธ์เป็นเนื้อหาการตอบกลับที่ว่างเปล่า

ตัวอย่าง

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

Java

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

// The BlogId of a test blog.
String TEST_BLOG_ID = "8070105920543249
955";
// The PostId of a post
to deleteString POST_ID = "344535
5871727114160";
// Configure the Java API Client for
Installed Native AppHttpTransport HTTP_TRANSPORT = new
NetHttpTransport();JsonFactory JSON_FACTORY = n
ew JacksonFactory();
// Configure the Instal
led App OAuth2 flow.Credential credential = OAuth2Native.autho
rize(HTTP_TRANSPORT, JSON_FACTORY, new Lo
calServerReceiver(), Arrays.asList(Blog
gerScopes.BLOGGER)); // Construct the Blogger API a
ccess facade object.Blogger blogger = Blogger.builder(HTTP_TRAN
SPORT, JSON_FACTORY) .setApplicationName("Blogger-
PostsDelete-Snippet/1.0") .setHttpRequestIn
itializer(credential).b
uild();
// The request action.Delete postsDeleteAction = blogger.posts().
delete(TEST_BLOG_ID, POST_ID);
// This step se
nds {
the request to the server.try
postsDeleteAction.execute(); System.out.println("Deleting
} post " + POST_ID {
+ " succeeded."); catch (IOException e) System.out.prin
}tln("Deleting post " + POST_ID + " failed: " + e);

ลองใช้งาน

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