0
# Blog Management
1
2
Comprehensive blog information retrieval and content access methods. Most methods work with API key authentication, while some require OAuth authentication.
3
4
## Capabilities
5
6
### Blog Information
7
8
Gets detailed information about a specific blog.
9
10
```javascript { .api }
11
/**
12
* Gets information about a given blog
13
* @param blogIdentifier - Blog name (e.g., 'example') or full URL (e.g., 'https://example.tumblr.com')
14
* @param params - Optional field selection parameters
15
* @returns Promise resolving to blog information
16
*/
17
blogInfo(blogIdentifier: string, params?: {'fields[blogs]'?: string}): Promise<any>;
18
```
19
20
**Usage Examples:**
21
22
```javascript
23
// Get basic blog info
24
const blogInfo = await client.blogInfo('example');
25
console.log(blogInfo.blog.title);
26
console.log(blogInfo.blog.description);
27
console.log(blogInfo.blog.posts);
28
29
// Get blog info with specific fields
30
const limitedInfo = await client.blogInfo('example', {
31
'fields[blogs]': 'name,title,description,posts'
32
});
33
34
// Using full URL
35
const blogInfo2 = await client.blogInfo('https://example.tumblr.com');
36
```
37
38
### Blog Avatar
39
40
Gets the avatar URL for a blog in various sizes.
41
42
```javascript { .api }
43
/**
44
* Gets the avatar URL for a blog
45
* @param blogIdentifier - Blog name or URL
46
* @param size - Optional avatar size in pixels
47
* @returns Promise resolving to avatar URL
48
*/
49
blogAvatar(blogIdentifier: string, size?: 16|24|30|40|48|64|96|128|512): Promise<any>;
50
```
51
52
**Usage Examples:**
53
54
```javascript
55
// Get default avatar size
56
const avatar = await client.blogAvatar('example');
57
console.log(avatar.avatar_url);
58
59
// Get specific avatar size
60
const smallAvatar = await client.blogAvatar('example', 64);
61
const largeAvatar = await client.blogAvatar('example', 512);
62
63
// Use avatar URL in HTML
64
const avatarResponse = await client.blogAvatar('example', 128);
65
const imgTag = `<img src="${avatarResponse.avatar_url}" alt="Blog Avatar">`;
66
```
67
68
### Blog Posts
69
70
Retrieves posts from a blog with extensive filtering and pagination options.
71
72
```javascript { .api }
73
/**
74
* Gets a list of posts for a blog with optional filtering
75
* @param blogIdentifier - Blog name or URL
76
* @param params - Optional filtering and pagination parameters
77
* @returns Promise resolving to blog posts and metadata
78
*/
79
blogPosts(blogIdentifier: string, params?: BlogPostsParams): Promise<any>;
80
81
interface BlogPostsParams {
82
/** A specific post ID. Returns the single post specified or 404 error */
83
id?: string;
84
/** Limits the response to posts with the specified tags */
85
tag?: string | string[];
86
/** The type of post to return */
87
type?: 'text' | 'quote' | 'link' | 'answer' | 'video' | 'audio' | 'photo' | 'chat';
88
/** The number of posts to return: 1–20, inclusive */
89
limit?: number;
90
/** Offset post number (0 to start from first post) */
91
offset?: number;
92
/** Indicates whether to return reblog information */
93
reblog_info?: boolean;
94
/** Indicates whether to return notes information */
95
notes_info?: boolean;
96
/** Returns posts' content in NPF format instead of the legacy format */
97
npf?: boolean;
98
}
99
```
100
101
**Usage Examples:**
102
103
```javascript
104
// Get recent posts
105
const posts = await client.blogPosts('example', { limit: 10 });
106
posts.posts.forEach(post => {
107
console.log(`${post.type}: ${post.summary || post.title || 'Untitled'}`);
108
});
109
110
// Get posts by type
111
const photoPosts = await client.blogPosts('example', {
112
type: 'photo',
113
limit: 5,
114
});
115
116
// Get posts with specific tags (all tags must match)
117
const taggedPosts = await client.blogPosts('example', {
118
tag: ['tumblr', 'api'],
119
limit: 20,
120
});
121
122
// Get single post by ID
123
const singlePost = await client.blogPosts('example', {
124
id: '12345678901',
125
});
126
127
// Get posts in NPF format with full metadata
128
const npfPosts = await client.blogPosts('example', {
129
npf: true,
130
reblog_info: true,
131
notes_info: true,
132
limit: 5,
133
});
134
```
135
136
### Blog Likes
137
138
Gets the posts liked by a blog (requires OAuth authentication).
139
140
```javascript { .api }
141
/**
142
* Gets the likes for a blog
143
* @param blogIdentifier - Blog name or URL
144
* @param params - Optional pagination and filtering parameters
145
* @returns Promise resolving to liked posts
146
*/
147
blogLikes(blogIdentifier: string, params?: BlogLikesParams): Promise<any>;
148
149
interface BlogLikesParams {
150
/** The number of results to return: 1–20, inclusive */
151
limit?: number;
152
/** Liked post number to start at */
153
offset?: number;
154
/** Return posts liked before this timestamp */
155
before?: number;
156
/** Return posts liked after this timestamp */
157
after?: number;
158
}
159
```
160
161
**Usage Examples:**
162
163
```javascript
164
// Get blog's liked posts (requires OAuth)
165
const likes = await client.blogLikes('example', { limit: 10 });
166
likes.liked_posts.forEach(post => {
167
console.log(`Liked: ${post.blog_name} - ${post.type} post`);
168
});
169
170
// Get likes with timestamp filtering
171
const recentLikes = await client.blogLikes('example', {
172
after: 1640995200, // Unix timestamp
173
limit: 20,
174
});
175
```
176
177
### Blog Followers
178
179
Gets the followers of a blog (requires OAuth authentication).
180
181
```javascript { .api }
182
/**
183
* Gets the followers for a blog
184
* @param blogIdentifier - Blog name or URL
185
* @param params - Optional pagination parameters
186
* @returns Promise resolving to blog followers
187
*/
188
blogFollowers(blogIdentifier: string, params?: BlogFollowersParams): Promise<any>;
189
190
interface BlogFollowersParams {
191
/** The number of results to return: 1–20, inclusive */
192
limit?: number;
193
/** Result number to start at */
194
offset?: number;
195
}
196
```
197
198
**Usage Examples:**
199
200
```javascript
201
// Get blog followers (requires OAuth)
202
const followers = await client.blogFollowers('example', { limit: 20 });
203
console.log(`Total followers: ${followers.total_users}`);
204
followers.users.forEach(user => {
205
console.log(`Follower: ${user.name}`);
206
});
207
```
208
209
### Blog Queue
210
211
Gets the queued posts for a blog (requires OAuth authentication and blog ownership).
212
213
```javascript { .api }
214
/**
215
* Gets the queue for a blog
216
* @param blogIdentifier - Blog name or URL
217
* @param params - Optional filtering and pagination parameters
218
* @returns Promise resolving to queued posts
219
*/
220
blogQueue(blogIdentifier: string, params?: BlogQueueParams): Promise<any>;
221
222
interface BlogQueueParams {
223
/** The number of results to return: 1–20, inclusive */
224
limit?: number;
225
/** Result number to start at */
226
offset?: number;
227
/** Response filter: 'text' for text only, 'raw' for raw HTML */
228
filter?: 'text' | 'raw';
229
}
230
```
231
232
**Usage Examples:**
233
234
```javascript
235
// Get queued posts (requires blog ownership)
236
const queue = await client.blogQueue('myblog', { limit: 10 });
237
queue.posts.forEach(post => {
238
console.log(`Queued: ${post.type} post scheduled for ${post.scheduled_publish_time}`);
239
});
240
241
// Get queue with text filter
242
const textQueue = await client.blogQueue('myblog', {
243
filter: 'text',
244
limit: 20,
245
});
246
```
247
248
### Blog Drafts
249
250
Gets the draft posts for a blog (requires OAuth authentication and blog ownership).
251
252
```javascript { .api }
253
/**
254
* Gets the drafts for a blog
255
* @param blogIdentifier - Blog name or URL
256
* @param params - Optional filtering parameters
257
* @returns Promise resolving to draft posts
258
*/
259
blogDrafts(blogIdentifier: string, params?: BlogDraftsParams): Promise<any>;
260
261
interface BlogDraftsParams {
262
/** Return drafts before this post ID */
263
before_id?: number;
264
/** Response filter: 'text' for text only, 'raw' for raw HTML */
265
filter?: 'text' | 'raw';
266
}
267
```
268
269
**Usage Examples:**
270
271
```javascript
272
// Get draft posts (requires blog ownership)
273
const drafts = await client.blogDrafts('myblog');
274
drafts.posts.forEach(post => {
275
console.log(`Draft: ${post.type} post - ${post.title || 'Untitled'}`);
276
});
277
278
// Get drafts with pagination
279
const oldDrafts = await client.blogDrafts('myblog', {
280
before_id: 12345678901,
281
filter: 'text',
282
});
283
```
284
285
### Blog Submissions
286
287
Gets the submission posts for a blog (requires OAuth authentication and blog ownership).
288
289
```javascript { .api }
290
/**
291
* Gets the submissions for a blog
292
* @param blogIdentifier - Blog name or URL
293
* @param params - Optional filtering parameters
294
* @returns Promise resolving to submission posts
295
*/
296
blogSubmissions(blogIdentifier: string, params?: BlogSubmissionsParams): Promise<any>;
297
298
interface BlogSubmissionsParams {
299
/** Result number to start at */
300
offset?: number;
301
/** Response filter: 'text' for text only, 'raw' for raw HTML */
302
filter?: 'text' | 'raw';
303
}
304
```
305
306
**Usage Examples:**
307
308
```javascript
309
// Get submission posts (requires blog ownership)
310
const submissions = await client.blogSubmissions('myblog');
311
submissions.posts.forEach(post => {
312
console.log(`Submission from ${post.submitter}: ${post.type} post`);
313
});
314
315
// Get submissions with offset
316
const moreSubmissions = await client.blogSubmissions('myblog', {
317
offset: 20,
318
filter: 'text',
319
});
320
```
321
322
## Authentication Requirements
323
324
**API Key Authentication Required:**
325
- `blogInfo`
326
- `blogAvatar`
327
- `blogPosts`
328
329
**OAuth Authentication Required:**
330
- `blogLikes`
331
- `blogFollowers`
332
- `blogQueue` (also requires blog ownership)
333
- `blogDrafts` (also requires blog ownership)
334
- `blogSubmissions` (also requires blog ownership)
335
336
## Blog Identifier Format
337
338
All methods accept blog identifiers in these formats:
339
- Short name: `'example'`
340
- Full URL: `'https://example.tumblr.com'`
341
- Custom domain: `'example.com'` (if blog uses custom domain)