Blogs: listByUser

Requires authorization

Retrieves a list of blogs. Try it now or see an example.

Request

HTTP request

GET https://www.googleapis.com/blogger/v3/users/userId/blogs

Parameters

Parameter name Value Description
Required parameters
userId string The ID of the user whose blogs are to be fetched. Either the word self or the user's profile ID.
Optional parameters
fetchUserInfo boolean Whether the response is a list of blogs with per-user information instead of just blogs.
view string

Acceptable values are:
  • "ADMIN": Admin level detail
  • "AUTHOR": Author level detail
  • "READER": Admin level detail

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/blogger
https://www.googleapis.com/auth/blogger.readonly

Request body

Do not supply a request body with this method.

Response

If successful, this method returns a response body with the following structure:

{
  "kind": "blogger#blogList",
  "items": [
    blogs Resource
  ],
  "blogUserInfos": [
    blogUserInfos Resource
  ]
}
Property name Value Description Notes
kind string The kind of this entity. Always blogger#blogList.
items[] list The list of Blogs this user has Authorship or Admin rights for.
blogUserInfos[] list Admin level list of blog per-user information

Examples

Note: The code examples available for this method do not represent all supported programming languages (see the client libraries page for a list of supported languages).

Java

Uses the Java client library

// 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.
Blogger blogger = Blogger.builder(HTTP_TRANSPORT, JSON_FACTORY)
.setApplicationName("Blogger-BlogListByUser-Snippet/1.0")
.setHttpRequestInitializer(credential).build();
// The request action object.
ListByUser blogListByUserAction = blogger.blogs().listByUser("self");
// Restrict the result content to just the data we need.
blogListByUserAction.setFields("items(description,name,posts/totalItems,updated)");
// This step sends the request to the server.
BlogList blogList = blogListByUserAction.execute();
// Now we can navigate the response.
if (blogList.getItems() != null && !blogList.getItems().isEmpty()) {
int blogCount = 0;
for (Blog blog : blogList.getItems()) {
System.out.println("Blog #" + ++blogCount);
System.out.println("\tName: " + blog.getName());
System.out.println("\tDescription: " + blog.getDescription());
System.out.println("\tPost Count: " + blog.getPosts().getTotalItems());
System.out.println("\tLast Updated: " + blog.getUpdated());
}
}

Try it!

Use the APIs Explorer below to call this method on live data and see the response.