Home > OS >  How to upload multiple blog posts in BlogSpot at once?
How to upload multiple blog posts in BlogSpot at once?

Time:09-27

I have completely write 86 blog posts. I tried to upload it manually but seems like a long process, so I decided to make it by xml file and worked on it but no xml format on web helps me. This is the code I tried with,

<?xml version='1.0' encoding='UTF-8'?> 
<ns0:feed xmlns:ns0="http://www.w3.org/2005/Atom"> 
<ns0:generator>Blogger</ns0:generator>
<ns0:entry> 
<ns0:category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/blogger/2008/kind#post" /> 
<ns0:category scheme="http://www.blogger.com/atom/ns#" term="CATEGORY A" />
<ns0:id>BLOGGER TEST</ns0:id> 
<ns0:content type="html">Blogger CONTENT</ns0:content> 
<ns0:title type="html">BLOGGER TITLE</ns0:title> 
</ns0:entry> 
</ns0:feed>

If using xml is bad choice then any chance in python or any other coding.

CodePudding user response:

Use the API as in the example below

POST https://www.googleapis.com/blogger/v3/blogs/8070105920543249955/posts/
Authorization: /* OAuth 2.0 token here */
Content-Type: application/json

{
  "kind": "blogger#post",
  "blog": {
    "id": "8070105920543249955"
  },
  "title": "A new post",
  "content": "With <b>exciting</b> content..."
}

See here for more: https://developers.google.com/blogger/docs/3.0/using#AddingAPost

CodePudding user response:

You can add a post for a blog by sending a POST request to the post-collection URI with a post JSON body:

https://www.googleapis.com/blogger/v3/blogs/YOUR_BLOG_ID/posts/

Request (You must be authenticated to create a post) :

POST https://www.googleapis.com/blogger/v3/blogs/8070105920543249955/posts/
Authorization: /* OAuth 2.0 token here */
Content-Type: application/json

{
  "kind": "blogger#post",
  "blog": {
    "id": "8070105920543249955"
  },
  "title": "A new post",
  "content": "With <b>exciting</b> content..."
}

Response (If your request is successful, you will get an HTTP 200 OK status) :

{
 "kind": "blogger#post",
 "id": "6819100329896798058",
 "blog": {
  "id": "8070105920543249955"
 },
 "published": "2012-05-20T20:08:00-07:00",
 "updated": "2012-05-20T20:08:35-07:00",
 "url": "http://brettmorgan-test2.blogspot.com/2012/05/new-post.html",
 "selfLink": "https://www.googleapis.com/blogger/v3/blogs/8070105920543249955/posts/6819100329896798058",
 "title": "A new post",
 "content": "With <b>exciting</b> content...",
 "author": {
  "id": "16258312240222542576",
  "displayName": "Brett Morgan",
  "url": "http://www.blogger.com/profile/16258312240222542576",
  "image": {
   "url": "https://resources.blogblog.com/img/b16-rounded.gif"
  }
 },
 "replies": {
  "totalItems": "0",
  "selfLink": "https://www.googleapis.com/blogger/v3/blogs/8070105920543249955/posts/6819100329896798058/comments"
 }
}

For more details please you can read the API doc. https://developers.google.com/blogger/docs/3.0/using

  • Related