<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: REST API Explorer - Insert Multiple Records in HRSD forum</title>
    <link>https://www.servicenow.com/community/hrsd-forum/rest-api-explorer-insert-multiple-records/m-p/2725677#M32902</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/57636"&gt;@Andr_1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to the &lt;A href="https://developer.servicenow.com/dev.do#!/reference/api/vancouver/rest/c_ImportSetAPI%23import-POST-insertMultiple" target="_blank" rel="noopener"&gt;API documentation&lt;/A&gt;, it needs to live within the "results" array, just like you have it in your first code snippet. You can't send custom JSON or else the API won't know how to parse it. That being said, is there a specific goal you are trying to accomplish by wrapping it in an "FOBusinessUnit" object and "businessUnit" array? Perhaps there is another way to accomplish the same goal without modifying the request body's JSON structure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Aylee&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Nov 2023 18:46:26 GMT</pubDate>
    <dc:creator>Aylee Andersen</dc:creator>
    <dc:date>2023-11-07T18:46:26Z</dc:date>
    <item>
      <title>REST API Explorer - Insert Multiple Records</title>
      <link>https://www.servicenow.com/community/hrsd-forum/rest-api-explorer-insert-multiple-records/m-p/2725622#M32901</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am testing the "Insert Multiple Records from the same request (POST)" API with the Rest API Explorer module.&lt;/P&gt;&lt;P&gt;I sent on the request body the follow JSON with this "records" format:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
   "records":[
      {
         "u_work_phone":"test4545"
      },
      {
         "u_work_phone":"test123"
      }
   ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;When I send.. it creates 2 records on my staging table. So far so good.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My question is: Can I change this request body format to something like this?&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
	"FOBusinessUnit": {
		"businessUnit": [
			{
				"u_work_phone":"test4545"
			},
			{
				"u_work_phone":"test"
			}
		]
	}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;If I send the JSON like above, it gives me this error message:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;{
  "error": {
    "message": "Invalid JSON Object",
    "detail": "There is no root array element with name records"
  },
  "status": "failure"
}&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Thank you&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;André Ramos&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 17:51:02 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/rest-api-explorer-insert-multiple-records/m-p/2725622#M32901</guid>
      <dc:creator>Andr_1</dc:creator>
      <dc:date>2023-11-07T17:51:02Z</dc:date>
    </item>
    <item>
      <title>Re: REST API Explorer - Insert Multiple Records</title>
      <link>https://www.servicenow.com/community/hrsd-forum/rest-api-explorer-insert-multiple-records/m-p/2725677#M32902</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://www.servicenow.com/community/user/viewprofilepage/user-id/57636"&gt;@Andr_1&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to the &lt;A href="https://developer.servicenow.com/dev.do#!/reference/api/vancouver/rest/c_ImportSetAPI%23import-POST-insertMultiple" target="_blank" rel="noopener"&gt;API documentation&lt;/A&gt;, it needs to live within the "results" array, just like you have it in your first code snippet. You can't send custom JSON or else the API won't know how to parse it. That being said, is there a specific goal you are trying to accomplish by wrapping it in an "FOBusinessUnit" object and "businessUnit" array? Perhaps there is another way to accomplish the same goal without modifying the request body's JSON structure?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Aylee&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2023 18:46:26 GMT</pubDate>
      <guid>https://www.servicenow.com/community/hrsd-forum/rest-api-explorer-insert-multiple-records/m-p/2725677#M32902</guid>
      <dc:creator>Aylee Andersen</dc:creator>
      <dc:date>2023-11-07T18:46:26Z</dc:date>
    </item>
  </channel>
</rss>

