यह कुकी, पाथ के हिसाब से पोस्ट को वापस लाती है. इसे अभी आज़माएं या उदाहरण देखें.
अगर पोस्ट किसी ऐसे ब्लॉग पर है जिसे निजी के तौर पर सेट किया गया है, तो अनुमति ज़रूरी है.
पोस्ट का पाथ, पोस्ट के यूआरएल का वह हिस्सा होता है जो होस्ट के बाद आता है. उदाहरण के लिए, http://code.blogger.com/2011/09/blogger-json-api-now-available.html
यूआरएल वाली ब्लॉग पोस्ट का पाथ /2011/09/blogger-json-api-now-available.html
है.
अनुरोध
एचटीटीपी अनुरोध
GET https://www.googleapis.com/blogger/v3/blogs/blogId/posts/bypath
पैरामीटर
पैरामीटर का नाम | मान | ब्यौरा |
---|---|---|
ज़रूरी पैरामीटर | ||
blogId |
string |
उस ब्लॉग का आईडी जिससे पोस्ट को फ़ेच करना है. |
path |
string |
पोस्ट का पाथ, जिसे वापस पाना है. |
वैकल्पिक पैरामीटर | ||
maxComments |
unsigned integer |
किसी पोस्ट के लिए, ज़्यादा से ज़्यादा टिप्पणियां पाने की संख्या. अगर इस पैरामीटर को तय नहीं किया जाता है, तो पोस्ट रिसॉर्स के हिस्से के तौर पर कोई टिप्पणी नहीं दिखाई जाएगी. |
view |
string |
इन वैल्यू का इस्तेमाल किया जा सकता है:
|
अनुरोध का मुख्य भाग
इस तरीके के साथ अनुरोध का मुख्य हिस्सा न दें.
जवाब
अगर यह तरीका काम करता है, तो जवाब के मुख्य हिस्से में Posts resource दिखता है.
उदाहरण
ध्यान दें: इस तरीके के लिए दिए गए कोड के उदाहरणों में इसके साथ काम करने वाली सभी प्रोग्रामिंग भाषाएं नहीं दिखाई गई हैं (इसके साथ काम करने वाली भाषाओं की सूची के लिए क्लाइंट लाइब्रेरी वाला पेज देखें).
Java
Java क्लाइंट लाइब्रेरी का इस्तेमाल करता है
// The BlogId for the http://buzz.blogger.com/ blog.
String BUZZ_BLOG_ID = "2399
953"; // The URL path component for a
buzz post.String BUZZ_POST_PATH = "/2012/01/engage-with-your-readers
-through.html"; // 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-Pos
tsGetByPath-Snippet/1.0") .setHttpRequestIn
itializer(credential).b
uild(); // The request action.GetByPath postsGetByPathAction = blogger.po
sts().getByPath(BUZZ_BLOG_ID);postsGetByPathA
ction.setPath(BUZZ_POST_PATH); // Restrict the result con
tent to just the data we need.postsGetByPathAction.setFiel
ds("content,published,title"); // Th
is step sends the request to the server.Pos
t post = postsGetByPathAction.execute
(); // Now we can navigate the response.System.o
ut.println("Title: " + post.getTitle());System
.out.println("Published: " + post.getPublished());System.out.println("Content: " + post.getContent());
इसे आज़माएं!
लाइव डेटा पर इस तरीके को कॉल करने और जवाब देखने के लिए, यहां दिए गए एपीआई एक्सप्लोरर का इस्तेमाल करें.