How to get blog posts by label in blogger api

谁说我不能喝 提交于 2019-12-06 14:21:47

Search query (q=) option

If you want to get posts with a specific label you could use this query:

GET https://www.googleapis.com/blogger/v3/blogs/2399953/posts/search?q=label:label1&key=THE-KEY

If you want to get posts that are labelled 'this' as well as 'that' (if one of them does not match, it's not a match) you could use:

GET https://www.googleapis.com/blogger/v3/blogs/2399953/posts/search?q=label:this+label:that&key=THE-KEY

Use quotes around labels with spaces:

GET https://www.googleapis.com/blogger/v3/blogs/15045980/posts/search?q=label%3A%22James+Whittaker%22&key=THE-KEY

Probably a better option to get posts by label

Source: https://developers.google.com/blogger/docs/3.0/reference/posts/list

HTTP-request:

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

Amongst the optional parameters there is the labels parameter:

labels string Comma-separated list of labels to search for.

Example HTTP-request (using the Google Testing Blog's blogId):

GET https://www.googleapis.com/blogger/v3/blogs/15045980/posts?labels=James+Whittaker&key=THE-KEY

Note that quotes around the label should not be included using this option.

To fetch the next page of posts store the given nextPageToken, as mentioned in the comments, and put it in the pageToken-parameter, like:

GET https://www.googleapis.com/blogger/v3/blogs/15045980/posts?labels=James+Whittaker&pageToken=CgkIChiAjpb65CUQ3KqWBw&key=THE-KEY

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!