web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

Array in API POST

(0) ShareShare
ReportReport
Posted on by

Hi all,

I am populating a line items related to a Job table using Custom API. My custom API is working fine with GET, PATCH, POST when I send single record. However, in my case I would like to send multiple lines. Is it possible to have array of items in JSON in BC Custom API? I am using version 16.x but soon will be upgrading to 19.1

Let me know if anyone come across same requirement in one of your project.

Table: Job (will be created by end user)

Table: Job Lines ( I would like to populate using API)

{
"value": [
{

"JobNo": "A00600",
"LineNo": 2000,
"CostType": "Material",
"Quantity": 10,

"Price" : 100

}
]
}

I tried array in POST but no luck, getting message back from API

"message": "An unexpected 'StartArray' node was found when reading from the JSON reader. A 'StartObject' node was expected.  CorrelationId:  6ec8513d-5334-471f-a3a1-fdb4b82d97ab."

[

 {

  Payload

 },

 {

  Payload

 }

]

Best Regards,

Farooq 

I have the same question (0)
  • Lars Lohndorf-Larsen Profile Picture
    Microsoft Employee on at

    Hello,

    You can insert multiple lines using json arrays. Here is an example from the standard api purchaseOrders where we insert one order with 2 lines and 2 dimensions (update ItemID to match your own items):

    POST MyPC:7048/.../purchaseOrders

    HEADER:

    Content-Type = application/json

    BODY

        {  

                        "vendorNumber": "20000",

                        "purchaseOrderLines":

                        [

                          {"itemId" : "7192b134-2a0f-ed11-b845-6045bd8e5eb4"},

                          {"itemId" : "7392b134-2a0f-ed11-b845-6045bd8e5eb4"}

                        ],

                                            "dimensionSetLines":

                        [

                            {

                          "code": "DEPARTMENT",

                           "valueCode": "SALES"

                            }

                         ]

        }

    or maybe its just the syntax of the array that is missing a ,{( or somethien else?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,161 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,046 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 932 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans