पोस्ट: अपडेट

इसके लिए, अनुमति देना ज़रूरी है

पोस्ट को अपडेट करता है. इसे अभी आज़माएं या उदाहरण देखें.

अनुरोध करें

एचटीटीपी अनुरोध

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

पैरामीटर

पैरामीटर का नाम वैल्यू जानकारी
ज़रूरी पैरामीटर
blogId string ब्लॉग का आईडी.
postId string पोस्ट का आईडी.

अनुमति देना

इस अनुरोध के लिए, इनमें से कम से कम एक दायरे की अनुमति लेना ज़रूरी है. पुष्टि करने और अनुमति देने के बारे में ज़्यादा जानें.

अनुमति देने का
https://www.googleapis.com/auth/blogger

अनुरोध का मुख्य भाग

अनुरोध के मुख्य हिस्से में, पोस्ट संसाधन उपलब्ध कराएं.

जवाब

अगर यह तरीका काम करता है, तो रिस्पॉन्स के मुख्य भाग में पोस्ट का रिसॉर्स दिखता है.

उदाहरण

ध्यान दें: इस तरीके के लिए दिए गए कोड के उदाहरणों में इसके साथ काम करने वाली सभी प्रोग्रामिंग भाषाएं नहीं दिखाई गई हैं (इसके साथ काम करने वाली भाषाओं की सूची के लिए क्लाइंट लाइब्रेरी वाला पेज देखें).

Java

Java क्लाइंट लाइब्रेरी का इस्तेमाल करता है

// The BlogId of a test blog.
String TEST_BLOG_ID = "8070105920543249955";
// The PostId of a post.
String POST_ID = "4883581657838685651";
// 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-PostsUpdate-Snippet/1.0")
.setHttpRequestInitializer(credential).build();
// Construct the post update body
Post content = new Post();
content.setId(Long.parseLong(POST_ID));
content.setTitle("A test post, updated");
content.setContent("With <emph>exciting</emph> <code>HTML</code> content");
// The request action.
Update postsUpdateAction = blogger.posts().update(TEST_BLOG_ID, POST_ID, content);
// Restrict the result content to just the data we need.
postsUpdateAction.setFields("author/displayName,content,published,title,url"); // This step sends the request to the server. Post post = postsUpdateAction.execute(); // Now we can navigate the response. System.out.println("Title: " + post.getTitle()); System.out.println("Author: " + post.getAuthor().getDisplayName()); System.out.println("Published: " + post.getPublished());
System.out.println("URL: " + post.getUrl());
System.out.println("Content: " + post.getContent());

इसे आज़माएं!

इस तरीके को लाइव डेटा पर कॉल करने और जवाब देखने के लिए, नीचे दिए गए एपीआई एक्सप्लोरर का इस्तेमाल करें.