user21560133
user21560133

Reputation: 21

How to create the wix blog draft post by using wix api and the wix api access token

{
  "draftPost": {
    "title": "abc1",
    "richContent": {
      "nodes": [
        {
          "type": "paragraph",
          "text": "This is a paragraph of text."
        },
        {
          "type": "paragraph",
          "textData": {
            "text": "This is a paragraph of text."
          }
        },
        {
          "type": "paragraph",
          "style": {
            "paddingTop": "20px"
          },
          "textData": {
            "text": "This is a paragraph of text."
          }
        } 
      ]
    }
  },
  "publish": false
}

I had tried to create the wix blog draft post with the above code By the way, only the title had been created, but the description had not been created What is the reason? Please let me know the solution with the detailed example Thanks

I want to know the detailed way to create the wix blog post with the wix api

Upvotes: 2

Views: 1153

Answers (1)

Clemens Lode
Clemens Lode

Reputation: 319

The issue is that paragraphs are containers, not texts themselves.

This means that you need to add a text node within a paragraph to actually display text. There are only a few examples of this in the documentation: https://dev.wix.com/api/rest/wix-blog/blog/draft-posts/list-draft-posts

For example:

{ "draftPost": {
    "title": "abc1",     
    "richContent": {
        "nodes": [ {
            "type": "PARAGRAPH",
            "id": "",
            "nodes": [            {
              "type": "TEXT",
              "id": "",
              "nodes": [],
              "textData":               {
                "text": "This is a paragraph of text.",
                "decorations": []
              }
            }],
            "paragraphData":             {
              "textStyle": {"textAlignment": "AUTO"},
              "indentation": 0
            }
         } ]
      }
   }
}

Upvotes: 1

Related Questions