If I have setup a script to post a blog post to Tumblr using their API.
$client->createPost($blog->name, array(
'type' => 'link',
'tags' => '',
'title' => $post->title,
'description' => $body[0],
'url' => site_url($post->blog_slug),
'thumbnail' => base_url() . $post->preview_image
)
);
Does anyone know how I can obtain the ID of this post that has been newly created? AFAIK the documentation doesn't say anything about obtaining the ID of the post after creating it.
You can use the id attribute of response returned by createPost method.
$response = $client->createPost($blog->name, array(
'type' => 'link',
'tags' => '',
'title' => $post->title,
'description' => $body[0],
'url' => site_url($post->blog_slug),
'thumbnail' => base_url() . $post->preview_image
)
);
$postURL = 'https://'.$blog->name.'tumblr.com/post/'.$repsonse->id;