NAV 2018 - how to insert record in Table "Gen. Journal Line" with use of JSON over "API Page" ??

dalmatinko
Member Posts: 11
Hi to all modern and "old fashion" NAV guys,
Hope so someone can help me with example how to insert record from external application with usage of API Page in the background.
For testing purpose I've used "Postman" to connect Cronus NAV 2018, and to send instructions to the NAV.
I was able to read records (GET) from the "Gen. Jorunal Line", but have issue when tryy to (POST) insert new record with use of "Journal Entity" pages.
This is connection/execution string (works fine when read records from NAV):
'GET http://something:7048/DynamicsNAV110/api/beta/journals(bc05cb5f-fc37-496d-a856-3362c035d687)?$expand=journalLines'
where 'bc05cb5f-fc37-496d-a856-3362c035d687' presents the GUID of "Gen. Journal Batch" record.
This is connection/execution string and JSON format data when try to insert record into NAV:
'POST http://something:7048/DynamicsNAV110/api/beta/journals(bc05cb5f-fc37-496d-a856-3362c035d687)?$expand=journalLines'
{
"journalLines":
[
{
"lineNumber": 30000,
"accountId": "59c5cd49-5581-4f03-bfb2-d7f387f6ac5a",
"accountNumber": "1220",
"postingDate": "2019-07-16",
"documentNumber": "G00002",
"externalDocumentNumber": "",
"amount": 500,
"description": "Increases during the Year",
"comment": "",
"dimensions": [
{
"code": "AREA",
"displayName": "Area",
"valueCode": "50",
"valueDisplayName": "Europe South"
},
{
"code": "CUSTOMERGROUP",
"displayName": "Customer Group",
"valueCode": "SMALL",
"valueDisplayName": "Small Business"
},
{
"code": "DEPARTMENT",
"displayName": "Department",
"valueCode": "PROD",
"valueDisplayName": "Production"
}
]
}
]
}
and the error message received is:
{
"error": {
"code": "BadRequest_MethodNotAllowed",
"message": "'POST' requests for 'journals' of EdmType 'Entity' are not allowed within Microsoft Dynamics NAV OData web services."
}
}
I will appreciate if someone have experince with this, or any helping suggestion.
Thanks in advance !
Hope so someone can help me with example how to insert record from external application with usage of API Page in the background.
For testing purpose I've used "Postman" to connect Cronus NAV 2018, and to send instructions to the NAV.
I was able to read records (GET) from the "Gen. Jorunal Line", but have issue when tryy to (POST) insert new record with use of "Journal Entity" pages.
This is connection/execution string (works fine when read records from NAV):
'GET http://something:7048/DynamicsNAV110/api/beta/journals(bc05cb5f-fc37-496d-a856-3362c035d687)?$expand=journalLines'
where 'bc05cb5f-fc37-496d-a856-3362c035d687' presents the GUID of "Gen. Journal Batch" record.
This is connection/execution string and JSON format data when try to insert record into NAV:
'POST http://something:7048/DynamicsNAV110/api/beta/journals(bc05cb5f-fc37-496d-a856-3362c035d687)?$expand=journalLines'
{
"journalLines":
[
{
"lineNumber": 30000,
"accountId": "59c5cd49-5581-4f03-bfb2-d7f387f6ac5a",
"accountNumber": "1220",
"postingDate": "2019-07-16",
"documentNumber": "G00002",
"externalDocumentNumber": "",
"amount": 500,
"description": "Increases during the Year",
"comment": "",
"dimensions": [
{
"code": "AREA",
"displayName": "Area",
"valueCode": "50",
"valueDisplayName": "Europe South"
},
{
"code": "CUSTOMERGROUP",
"displayName": "Customer Group",
"valueCode": "SMALL",
"valueDisplayName": "Small Business"
},
{
"code": "DEPARTMENT",
"displayName": "Department",
"valueCode": "PROD",
"valueDisplayName": "Production"
}
]
}
]
}
and the error message received is:
{
"error": {
"code": "BadRequest_MethodNotAllowed",
"message": "'POST' requests for 'journals' of EdmType 'Entity' are not allowed within Microsoft Dynamics NAV OData web services."
}
}
I will appreciate if someone have experince with this, or any helping suggestion.
Thanks in advance !
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