投稿: getByPath

パスで投稿を取得します。今すぐ試すまたは例を見る

投稿が非公開のブログにある場合は、承認が必要です。

投稿のパスは、投稿の URL のうちホストの後の部分です。たとえば、URL が http://code.blogger.com/2011/09/blogger-json-api-now-available.html のブログ投稿の場合、パスは /2011/09/blogger-json-api-now-available.html です。

リクエスト

HTTP リクエスト

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

パラメータ

パラメータ名 説明
必須パラメータ
blogId string 投稿を取得するブログの ID。
path string 取得する投稿のパス。
オプション パラメータ
maxComments unsigned integer 投稿で取得するコメントの最大数。このパラメータを指定しない場合、投稿リソースの一部としてコメントは返されません。
view string

有効な値は次のとおりです。
  • "ADMIN": 管理者レベルの詳細
  • "AUTHOR": 著者レベルの詳細
  • "READER": 管理者レベルの詳細

リクエストの本文

このメソッドをリクエストの本文に含めないでください。

レスポンス

成功すると、このメソッドはレスポンスの本文で Posts リソースを返します。

注: このメソッドで使用可能なコード例では、サポートされているプログラミング言語すべての例を示しているわけではありません(サポートされている言語の一覧については、クライアント ライブラリ ページをご覧ください)。

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());

試してみよう:

以下の API Explorer を使用し、ライブデータに対してこのメソッドを呼び出して、レスポンスを確認してみましょう。