How to insert multiple rows in a Business Central API with a single call?

kuhi
Member Posts: 18
I'm trying to insert a json with multiple records into Business Central via Web Services
If I make a GET request, I see this response:
Trying to insert from Postman against this URL: https://api.businesscentral.dynamics.com/v2.0/{{TENANT_ID}}/{{ENVIRONMENT}}/api/Kuhicop/Kuhicop/v1.0/companies({{COMPANY_ID}})/SalesOrderInserts
And based in the GET response, I will send a json With this data:
But I get this error:
How to insert multiple rows in a Business Central custom API?
page 60000 "Sales Order Inserts MIM API" { PageType = API; SourceTable = "Sales Order Inserts MIM"; Caption = 'Sales Order Inserts MIM API'; EntitySetName = 'SalesOrderInserts'; EntityName = 'SalesOrderInsert'; APIPublisher = 'Kuhicop'; APIGroup = 'Kuhicop'; DelayedInsert = true; APIVersion = 'v1.0'; layout { area(content) { repeater(Group) { field("BatchID"; Rec."Batch ID") { ApplicationArea = All; } } } } }
If I make a GET request, I see this response:
{ "@odata.context": "https://api.businesscentral.dynamics.com/v2.0/{{TENANT_ID}}/{{ENVIRONMENT}}/api/Kuhicop/Kuhicop/v1.0/$metadata#companies({{COMPANY_ID}})/SalesOrderInserts", "value": [ { "@odata.etag": "W/\"JzIwOzE1ODc4NzU5MDIzMDQyNDQyNTI1MTswMDsn\"", "BatchID": "BATCH001" }, { "@odata.etag": "W/\"JzE5OzI3MTk3MjU4MTE5MDAwNDI1NTAxOzAwOyc=\"", "BatchID": "BATCH002" }, { "@odata.etag": "W/\"JzE5OzgwMDc0MzY2NzQ0NjcxOTQxOTExOzAwOyc=\"", "BatchID": "BATCH003" } ] }
Trying to insert from Postman against this URL: https://api.businesscentral.dynamics.com/v2.0/{{TENANT_ID}}/{{ENVIRONMENT}}/api/Kuhicop/Kuhicop/v1.0/companies({{COMPANY_ID}})/SalesOrderInserts
And based in the GET response, I will send a json With this data:
{ "value": [ { "BatchID": "BATCH004" }, { "BatchID": "BATCH005" } ] }
But I get this error:
{ "error": { "code": "BadRequest", "message": "The property 'value' does not exist on type 'Microsoft.NAV.salesOrderInsert'. Make sure to only use property names that are defined by the type. CorrelationId: a10912cb-7f47-4f38-b0a0-43f5dd595e3a." } }
How to insert multiple rows in a Business Central custom API?
0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions