Use only one web service to export data of multiple tables - controlled by url parameters

KURN
Member Posts: 4
Hi,
as my NAV experience is kinda small I would like to explore the possibilities of the NAV (2016/2018) web services. My last development in NAV was in 2014 (CC09) - just for a few weeks. Now I have been dragged into a NAV project and have to care about the communication through web services.
The idea:
We would like to export some data (e. a. Customer, Item) through one published web service. Of course we could publish multiple web services for every need, but the goal is to publish just one service and control it via parameters.
example web service url with parameters (could be a query or a page?):
http://SERVER:PORT/NAVTIER/OData/Company('COMPANY')/ExportService?$filter=exportTable eq 'Customer'
http://SERVER:PORT/NAVTIER/OData/Company('COMPANY')/ExportService?$filter=exportTable eq 'Item'
If a request is made to this url - the web service should response the Customer or Item data - preferable in the normal oData output format with columns and values. In future we would also like to pass other parameters to the service for more detailed filtering or pagination. The service will be read only always and is only used for exports. We would like to avoid to create csv files or go down to raw sql to retrieve all needed data.
Has anyone had experience with this approach? Is it possible at all or have the output structure (columns) of the web service pre defined always?
If this idea is not good at all, any other advice about handling exports without creating multiple web services would be amazing too.
Best regards
Kurn
as my NAV experience is kinda small I would like to explore the possibilities of the NAV (2016/2018) web services. My last development in NAV was in 2014 (CC09) - just for a few weeks. Now I have been dragged into a NAV project and have to care about the communication through web services.
The idea:
We would like to export some data (e. a. Customer, Item) through one published web service. Of course we could publish multiple web services for every need, but the goal is to publish just one service and control it via parameters.
example web service url with parameters (could be a query or a page?):
http://SERVER:PORT/NAVTIER/OData/Company('COMPANY')/ExportService?$filter=exportTable eq 'Customer'
http://SERVER:PORT/NAVTIER/OData/Company('COMPANY')/ExportService?$filter=exportTable eq 'Item'
If a request is made to this url - the web service should response the Customer or Item data - preferable in the normal oData output format with columns and values. In future we would also like to pass other parameters to the service for more detailed filtering or pagination. The service will be read only always and is only used for exports. We would like to avoid to create csv files or go down to raw sql to retrieve all needed data.
Has anyone had experience with this approach? Is it possible at all or have the output structure (columns) of the web service pre defined always?
If this idea is not good at all, any other advice about handling exports without creating multiple web services would be amazing too.
Best regards
Kurn
0
Answers
-
You can have multiple functions in one WS. Just publish codeunit with multiple functions.
Or if you insist to have ony function, than use a function parameter to control what to return.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