Recently, we initiated the migration of our Sitecore XM website to Sitecore AI. During this process, we encountered a common requirement: provider information was being synchronized to a separate database through a third-party API, and we needed to replicate this data within our Sitecore Cloud instance. To accomplish this, the following steps were implemented:

1. Created item using the GraphQL Authoring API.
2. Implemented bulk item creation through the GraphQL Authoring API.
3. Mapped the bulk item creation process to the third-party API response and iterated through the data to create items accordingly.

1. Created item using the GraphQL Authoring API.


  mutation {
    createItem(
      input: {
        name: "Michael John Abadier"
        templateId: "{C6CEF173-74B3-4E07-97BF-16E7D8516FE7}"
        parent: "{A0FB0D5C-0406-49B1-9DE0-1C8DF57CB5D8}"
        language: "en"
        fields: [
          { name: "DoctorName", value: "Michael John Abadier, DO" }
          { name: "firstname", value: "Michael" }
          { name: "middlename", value: "John" }
          { name: "lastname", value: "Abadier" }       
          { name: "NPINumber", value: "1619984242" }
          { name: "suffix", value: "Dr" }
          { name: "Id", value: "3425" }
          { name: "Bio", value: "Interventional Cardiologist" }
        ]
      }
    ) {
      item {
        itemId
        name
        path
        fields(ownFields: true, excludeStandardFields: true) {
          nodes {
            name
            value
          }
        }
      }
    }
  }
  

and here is the result

 result of item creation
  {
  "data": {
    "createItem": {
      "item": {
        "itemId": "312b621ee360497ab53ef084417e4a64",
        "name": "Michael John Abadier",
        "path": "/sitecore/content/explore/lab1/Home/Providers/Michael John Abadier",
        "fields": {
          "nodes": [
            {
              "name": "LastName",
              "value": "Abadier"
            },
            {
              "name": "NPINumber",
              "value": "1619984242"
            },
            {
              "name": "Id",
              "value": "3425"
            },
            {
              "name": "Suffix",
              "value": "Dr"
            },
            {
              "name": "Bio",
              "value": "Interventional Cardiologist"
            },
            {
              "name": "FirstName",
              "value": "Michael"
            },
            {
              "name": "MiddleName",
              "value": "John"
            },
            {
              "name": "DoctorName",
              "value": "Michael John Abadier, DO"
            }
          ]
        }
      }
    }
  },
  "extensions": {}
}