Recupera uma postagem por caminho. Faça um teste agora ou veja um exemplo.
A autorização é necessária se a postagem estiver em um blog particular.
O caminho de uma postagem é a parte do URL após o host. Por exemplo, uma postagem de blog com o URL http://code.blogger.com/2011/09/blogger-json-api-now-available.html
tem o caminho /2011/09/blogger-json-api-now-available.html
.
Solicitação
Solicitação HTTP
GET https://www.googleapis.com/blogger/v3/blogs/blogId/posts/bypath
Parâmetros
Nome do parâmetro | Valor | Descrição |
---|---|---|
Parâmetros obrigatórios | ||
blogId |
string |
O ID do blog de onde a postagem será buscada. |
path |
string |
Caminho da postagem a ser recuperada. |
Parâmetros opcionais | ||
maxComments |
unsigned integer |
Número máximo de comentários a serem recuperados para uma postagem. Se esse parâmetro não for especificado, nenhum comentário será retornado como parte do recurso de postagem. |
view |
string |
Os valores aceitáveis são:
|
Corpo da solicitação
Não forneça um corpo de solicitação com este método.
Resposta
Se for bem-sucedido, esse método vai retornar um recurso Posts no corpo da resposta.
Exemplos
Observação: os exemplos de código disponíveis para esse método não representam todas as linguagens de programação compatíveis. Consulte a página de bibliotecas cliente para ver uma lista de linguagens compatíveis.
Java
Usa a biblioteca cliente de 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());
Confira!
Use o APIs Explorer abaixo para chamar esse método em dados ativos e ver a resposta.