• I am starting some work with the WordPress REST API to create Posts from Salesforce records. I am trying to insert multiple Posts in one API call to avoid using too many API callouts as Salesforce has pretty strict governor limits. The best I’ve found so far is the Batch framework within wordpress and have begun experimenting with this but I’m looking for more information on how to use this with builtin WordPress endpoints.

    REST API Batch Framework in WordPress 5.6

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • The /wp/v2/posts endpoint supports batching so to make multiple posts, you can send a POST request to /wp-json/batch/v1/ with the following structure.

    {
      "requests": [
        {
          "method": "POST",
          "path": "/wp/v2/posts",
          "body": {
            "slug": "slug-1",
            "title": "Title 1",
            "excerpt": "Excerpt 1",
            "content": "Content 1",
            "status": "publish"
          }
        },
        {
          "method": "POST",
          "path": "/wp/v2/posts",
          "body": {
            "slug": "slug-2",
            "title": "Title 2",
            "excerpt": "Excerpt 2",
            "content": "Content 2",
            "status": "publish"
          }
        }
      ]
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Bulk Insert Posts via REST API’ is closed to new replies.