API vs OData for Cloud BC
                
                    julkifli33                
                
                    Member Posts: 1,100                
            
                        
            
                    Hi all,
I am looking to integrate BC online with my api
so now from BC Side, i have 2 options : API and OData.
what is the plus minus between these 2?
any recommendation which one should I use?
Thanks.
                I am looking to integrate BC online with my api
so now from BC Side, i have 2 options : API and OData.
what is the plus minus between these 2?
any recommendation which one should I use?
Thanks.
0                
            Answers
- 
            Hi @Juhl
thanks for the reply.
I just created a page to be used as OData, and i created the button (function)
it works fine.
but once I changed the page type become API , then it's gone.
does it mean i need to separate become 2 pages?
1 for API... and 1 for BC user?0 - 
            Hi @Juhl
thanks for your answer.
I just created 1 page, it works fine for OData
I tested using postman
RVB21-000005 --> Document No.
ApplyToDocument --> Page Name
ApplyInvoiceToReceipt --> Function Name[ServiceEnabled] procedure ApplyInvoiceToReceipt(var actionContext: WebServiceActionContext) var WSCodeunit: Codeunit "WS Codeunit"; begin WSCodeunit.ApplyInvoiceToReceipt(Rec."Document No."); actionContext.SetObjectType(ObjectType::Page); actionContext.SetObjectId(Page::"Apply To Document"); actionContext.AddEntityKey(Rec.FieldNo("Document No."), Rec."Document No."); actionContext.SetResultCode(WebServiceActionResultCode::Created); end;[/s]
1. OData
https://api.businesscentral.dynamics.com/v2.0/Sandbox/ODataV4/Company('Training Company')/ApplyToDocument('RVB21-000005')/NAV.ApplyInvoiceToReceipt
--> Successful
2. API
https://api.businesscentral.dynamics.com/sandbox/api/PublisherName/PublisherGroup/v2.0/Companies(d4f3c1fa-d7cc-eb11-9f0a-000d3ac7683d)/ApplyToDocument('RVB21-000005')/NAV.ApplyInvoiceToReceipt
--> Failed{ "error": { "code": "RequestDataInvalid", "message": "Request data is invalid." } }
any idea whats wrong with my API?0 - 
            ok noted.
seems like OData is more efficient.
i need to develop for both BC user and API0 
Categories
- All Categories
 - 73 General
 - 73 Announcements
 - 66.7K 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
 - 323 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