इस तरीके से, यूआरएल के हिसाब से ब्लॉग वापस पाया जा सकता है. इसे अभी आज़माएं या उदाहरण देखें.
अगर ब्लॉग को निजी के तौर पर सेट किया गया है, तो अनुमति ज़रूरी है. अगर ब्लॉग सार्वजनिक है, तो इस तरीके को बिना अनुमति के कॉल किया जा सकता है.
अनुरोध
एचटीटीपी अनुरोध
GET https://www.googleapis.com/blogger/v3/blogs/byurl
पैरामीटर
| पैरामीटर का नाम | वैल्यू | ब्यौरा |
|---|---|---|
| ज़रूरी पैरामीटर | ||
url |
string |
जिस ब्लॉग का डेटा वापस पाना है उसका यूआरएल. |
अनुरोध का मुख्य भाग
इस तरीके के साथ अनुरोध का मुख्य हिस्सा न दें.
जवाब
अगर अनुरोध पूरा हो जाता है, तो यह तरीका जवाब के मुख्य हिस्से में Blogs resource दिखाता है.
उदाहरण
ध्यान दें: इस तरीके के लिए दिए गए कोड के उदाहरणों में इसके साथ काम करने वाली सभी प्रोग्रामिंग भाषाएं नहीं दिखाई गई हैं (इसके साथ काम करने वाली भाषाओं की सूची के लिए क्लाइंट लाइब्रेरी वाला पेज देखें).
Java
Java क्लाइंट लाइब्रेरी का इस्तेमाल करता है
String CODE_BLOG_URL = "http://code.blogger.com/";
// 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.Blogge
r blogger = Blogger.builder(HTTP_TRANSPORT, JSON_FACTORY) .setA
pplicationName("Blogger-BlogGetByUrl-Snippet/1.0") .setH
ttpRequestInitializer(credential).build(); class="devsite-syntax-c1">// The request action object.GetByU
rl blogGetByUrlAction = blogger.blogs().getByUrl(); class="devsite-syntax-c1">// Configure which blog URL to look up.blogGe
tByUrlAction.setUrl(CODE_BLOG_URL); class="devsite-syntax-c1">// Restrict the result content to just the data we need.blogGe
tByUrlAction.setFields("description,name,posts/totalItems,updated");an> class="devsite-syntax-c1">// This step sends the request to the server.Blog b
log = blogGetByUrlAction.execute(); class="devsite-syntax-c1">// Now we can navigate the response.System
.out.println("Name: " + blog.getName());System
.out.println("Description: " + blog.getDescription());System
.out.println("Post Count: " + blog.getPosts().getTotalItems());System
.out.println("Last Updated: " + blog.getUpdated());
इसे आज़माएं!
लाइव डेटा पर इस तरीके को कॉल करने और जवाब देखने के लिए, यहां दिए गए APIs explorer का इस्तेमाल करें.