需要授權
要求
HTTP 要求
DELETE https://www.googleapis.com/blogger/v3/blogs/blogId/posts/postId
參數
| 參數名稱 | 值 | 說明 |
|---|---|---|
| 必要參數 | ||
blogId |
string |
網誌的 ID。 |
postId |
string |
貼文的 ID。 |
useTrash |
boolean |
盡可能移至垃圾桶。請注意,只有直播和排定發布的貼文可以移至垃圾桶。 |
授權
這項要求需要授權,且至少包含下列其中一個範圍 (進一步瞭解驗證和授權)。
| 範圍 |
|---|
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 Explorer,針對即時資料呼叫這個方法,然後查看回應。