पोस्ट: डालें

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

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

अनुरोध करें

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

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

पैरामीटर

पैरामीटर का नाम वैल्यू जानकारी
ज़रूरी पैरामीटर
blogId string उस ब्लॉग का आईडी जिसमें पोस्ट जोड़ना है.
ज़रूरी पैरामीटर
isDraft boolean पोस्ट को ड्राफ़्ट के तौर पर बनाना है या नहीं

अनुमति देना

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

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

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

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

जवाब

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

उदाहरण

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

Java

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

// The BlogId of a test blog.
String TEST_BLOG_ID = "8070105920543249955";
// 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-PostsInsert-Snippet/1.0")
.setHttpRequestInitializer(credential).build();
// Construct a post to insert
Post content = new Post();
content.setTitle("A test post");
content.setContent("With <code>HTML</code> content");
// The request action.
Insert postsInsertAction = blogger.posts()
.insert(TEST_BLOG_ID, content);
// Restrict the result content to just the data we need.
postsInsertAction.setFields("author/displayName,content,published,title,url");
// This step sends the request to the server.
Post post = postsInsertAction.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());

इसे आज़माएं!

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