Cyril
Cyril

Reputation: 576

Blogger API - How to add labels while inserting a new post?

I am trying to insert new blog post with Blogger API v3.0 below is my sample payload:

var payload = {
  "title"   : "This is the post title2",
  "content" : "This is <b>HTML</b> post2"
};

This works as intended, but I need to insert labels while posting these new posts, I checked the documentation and Google but no help. I tried something like below:

var payload = {
  "title"   : "This is the post title2",
  "content" : "This is <b>HTML</b> post2",
  "labels"  : "test_post,test,post"
};

based on a v1.0 php example, still I was not successful.

Upvotes: 0

Views: 1456

Answers (1)

paolo
paolo

Reputation: 2538

The Post Resource documentation states that the labels attribute is a list. Your payload should probably look like this:

var payload = {
  "title"   : "This is the post title2",
  "content" : "This is <b>HTML</b> post2",
  "labels"  : [
                "test_post",
                "test",
                "post"
              ]
};

Upvotes: 5

Related Questions