{"id":3442,"date":"2024-08-02T14:35:41","date_gmt":"2024-08-02T06:35:41","guid":{"rendered":"https:\/\/five.co\/?p=3442"},"modified":"2024-08-13T11:54:58","modified_gmt":"2024-08-13T03:54:58","slug":"odata-vs-graphql","status":"publish","type":"post","link":"https:\/\/preview-php85.dzine.org\/five\/blog\/odata-vs-graphql\/","title":{"rendered":"OData vs. GraphQL: When to Use Which?"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">OData vs. GraphQL: What is The Best Way to REST?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The Open Data Protocol, or OData, promotes itself as &#8220;<em>the best way to REST&#8221;<\/em>. A powerful and easy-to-use data access technology, it provides familiarity by combining the HTTP protocol with a SQL-like query language. How does OData compare against GraphQL, another data query and manipulation language for APIs? <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s find out in our OData vs. GraphQL comparison.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<div class=\"root-eb-toc-rxvup wp-block-essential-blocks-table-of-contents\"><div class=\"eb-parent-wrapper eb-parent-eb-toc-rxvup \"><div class=\"eb-toc-container eb-toc-rxvup  eb-toc-is-not-sticky eb-toc-not-collapsible eb-toc-initially-not-collapsed eb-toc-scrollToTop style-1 list-style-none\" data-scroll-top=\"false\" data-scroll-top-icon=\"fas fa-angle-up\" data-collapsible=\"false\" data-sticky-hide-mobile=\"false\" data-sticky=\"false\" data-scroll-target=\"scroll_to_toc\" data-copy-link=\"false\" data-editor-type=\"\" data-hide-desktop=\"false\" data-hide-tab=\"false\" data-hide-mobile=\"false\" data-itemcollapsed=\"false\" data-highlight-scroll=\"false\"><div class=\"eb-toc-header\"><h2 class=\"eb-toc-title\">Table of Contents<\/h2><\/div><div class=\"eb-toc-wrapper \" data-headers=\"[{&quot;level&quot;:2,&quot;content&quot;:&quot;OData vs. GraphQL: What is The Best Way to REST?&quot;,&quot;text&quot;:&quot;OData vs. GraphQL: What is The Best Way to REST?&quot;,&quot;link&quot;:&quot;odata-vs-graphql-what-is-the-best-way-to-rest&quot;},{&quot;level&quot;:2,&quot;content&quot;:&quot;What is OData?&quot;,&quot;text&quot;:&quot;What is OData?&quot;,&quot;link&quot;:&quot;what-is-odata&quot;},{&quot;level&quot;:3,&quot;content&quot;:&quot;OData: A Simple Example&quot;,&quot;text&quot;:&quot;OData: A Simple Example&quot;,&quot;link&quot;:&quot;odata-a-simple-example&quot;},{&quot;level&quot;:2,&quot;content&quot;:&quot;What is GraphQL?&quot;,&quot;text&quot;:&quot;What is GraphQL?&quot;,&quot;link&quot;:&quot;what-is-graphql&quot;},{&quot;level&quot;:2,&quot;content&quot;:&quot;OData vs. GraphQL: When to Use Which?&quot;,&quot;text&quot;:&quot;OData vs. GraphQL: When to Use Which?&quot;,&quot;link&quot;:&quot;odata-vs-graphql-when-to-use-which&quot;},{&quot;level&quot;:3,&quot;content&quot;:&quot;Why You Should Use OData&quot;,&quot;text&quot;:&quot;Why You Should Use OData&quot;,&quot;link&quot;:&quot;why-you-should-use-odata&quot;},{&quot;level&quot;:3,&quot;content&quot;:&quot;Why You Should Use GraphQL&quot;,&quot;text&quot;:&quot;Why You Should Use GraphQL&quot;,&quot;link&quot;:&quot;why-you-should-use-graphql&quot;},{&quot;level&quot;:3,&quot;content&quot;:&quot;Here Is What Developers Say About OData vs. GraphQL&quot;,&quot;text&quot;:&quot;Here Is What Developers Say About OData vs. GraphQL&quot;,&quot;link&quot;:&quot;here-is-what-developers-say-about-odata-vs-graphql&quot;},{&quot;level&quot;:2,&quot;content&quot;:&quot;Conclusion: OData vs. GraphQL&quot;,&quot;text&quot;:&quot;Conclusion: OData vs. GraphQL&quot;,&quot;link&quot;:&quot;conclusion-odata-vs-graphql&quot;},{&quot;level&quot;:3,&quot;content&quot;:&quot;OData in Five&quot;,&quot;text&quot;:&quot;OData in Five&quot;,&quot;link&quot;:&quot;odata-in-five&quot;}]\" data-visible=\"[true,true,true,true,true,true]\" data-delete-headers=\"[{&quot;label&quot;:&quot;OData vs. GraphQL: What is The Best Way to REST?&quot;,&quot;value&quot;:&quot;odata-vs-graphql-what-is-the-best-way-to-rest&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;What is OData?&quot;,&quot;value&quot;:&quot;what-is-odata&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;OData: A Simple Example&quot;,&quot;value&quot;:&quot;odata-a-simple-example&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;What is GraphQL?&quot;,&quot;value&quot;:&quot;what-is-graphql&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;OData vs. GraphQL: When to Use Which?&quot;,&quot;value&quot;:&quot;odata-vs-graphql-when-to-use-which&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;Why You Should Use OData&quot;,&quot;value&quot;:&quot;why-you-should-use-odata&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;Why You Should Use GraphQL&quot;,&quot;value&quot;:&quot;why-you-should-use-graphql&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;Here Is What Developers Say About OData vs. GraphQL&quot;,&quot;value&quot;:&quot;here-is-what-developers-say-about-odata-vs-graphql&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;Conclusion: OData vs. GraphQL&quot;,&quot;value&quot;:&quot;conclusion-odata-vs-graphql&quot;,&quot;isDelete&quot;:true},{&quot;label&quot;:&quot;OData in Five&quot;,&quot;value&quot;:&quot;odata-in-five&quot;,&quot;isDelete&quot;:true}]\" data-smooth=\"true\" data-top-offset=\"\"><div class=\"eb-toc__list-wrap\"><ul class=\"eb-toc__list\"><li><a href=\"#odata-vs-graphql-what-is-the-best-way-to-rest\">OData vs. GraphQL: What is The Best Way to REST?<\/a><li><a href=\"#what-is-odata\">What is OData?<\/a><ul class=\"eb-toc__list\"><li><a href=\"#odata-a-simple-example\">OData: A Simple Example<\/a><\/li><\/ul><li><a href=\"#what-is-graphql\">What is GraphQL?<\/a><li><a href=\"#odata-vs-graphql-when-to-use-which\">OData vs. GraphQL: When to Use Which?<\/a><ul class=\"eb-toc__list\"><li><a href=\"#why-you-should-use-odata\">Why You Should Use OData<\/a><li><a href=\"#why-you-should-use-graphql\">Why You Should Use GraphQL<\/a><li><a href=\"#here-is-what-developers-say-about-odata-vs-graphql\">Here Is What Developers Say About OData vs. GraphQL<\/a><\/li><\/ul><li><a href=\"#conclusion-odata-vs-graphql\">Conclusion: OData vs. GraphQL<\/a><ul class=\"eb-toc__list\"><li><a href=\"#odata-in-five\">OData in Five<\/a><\/li><\/ul><\/ul><\/div><\/div><\/div><\/div><\/div>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"has-text-align-center wp-block-paragraph\"><strong><span style=\"text-decoration: underline;\">Code-Along: Develop an OData Data View in a Responsive Web App<\/span><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Follow our <a href=\"https:\/\/preview-php85.dzine.org\/five\/code-along\/how-to-develop-an-odata-data-view\/\" target=\"_blank\" rel=\"noreferrer noopener\">step-by-step code-along tutorial<\/a> and learn how to build a web app that connects to an OData service as a data source. This code-along guide is ideal for anyone building custom apps or software on an OData API.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n<\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">What is OData?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">OData was invented to make accessing data easier. It is a general-purpose data access technology developed by Microsoft, and lets developers query APIs or web services in SQL-like manner. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As a standard protocol based on HTTP, OData is the glue between clients, i.e. those requesting data, and data sources, i.e. those providing data. It enables applications to create, expose, and consume queryable APIs in a standard way.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If &#8220;standardized data access&#8221; sounds a lot like two other related technologies &#8211; JDBC and ODBC &#8211; it is. OData is similar to JDBC and ODBC and can replace them for most use cases.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">OData: A Simple Example<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a simple scenario: say, you are a developer and you been tasked with building a portal on your company&#8217;s ERP system. How does the portal connect to the data stored in the ERP system? OData is the answer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">OData is very useful in custom application development, when a custom application, such as a portal, needs data access from an external, existing system. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With OData, the custom app doesn&#8217;t need <em>direct<\/em> database access. Everything happens through HTTP. However, unlike a standard API request, where a server responds with all the data, OData lets you query your data source. Developers can append &#8220;$filter&#8221; to a URL. The $filter determines what the server returns in its JSON response. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, a standard GET request for a list of airports would look like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#abb2bf;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282c34\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"GET serviceRoot\/Airports\" style=\"color:#abb2bf;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki one-dark-pro\" style=\"background-color: #282c34\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C678DD\">GET<\/span><span style=\"color: #ABB2BF\"> serviceRoot\/Airports<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">With OData, developers can specify which airport to return:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#abb2bf;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282c34\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"GET serviceRoot\/Airports?$filter=contains(Location\/Address, 'San Francisco')\" style=\"color:#abb2bf;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki one-dark-pro\" style=\"background-color: #282c34\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #C678DD\">GET<\/span><span style=\"color: #ABB2BF\"> serviceRoot\/Airports?$<\/span><span style=\"color: #C678DD\">filter<\/span><span style=\"color: #56B6C2\">=<\/span><span style=\"color: #ABB2BF\">contains(<\/span><span style=\"color: #C678DD\">Location<\/span><span style=\"color: #ABB2BF\">\/<\/span><span style=\"color: #C678DD\">Address<\/span><span style=\"color: #ABB2BF\">, <\/span><span style=\"color: #98C379\">&#39;San Francisco&#39;<\/span><span style=\"color: #ABB2BF\">)<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">OData provides a comprehensive library of string, date\/time, and other operations that developers can use to filter data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In summary, OData is a powerful, standardized, well-documented and easy-to-use data access technology. Not surprisingly, its (witty) team of inventors refers to it as &#8220;the best way to REST&#8221;.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">What is GraphQL?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">GraphQL is a query language for APIs developed by Facebook. It allows clients to request exactly the data they need, no more, no less.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Someone once said that &#8220;GraphQL is a fancy name for OData&#8221;. It is not. They are important differences between these two technologies, even though both are designed as data access technologies. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GraphQL is highly flexible and only needs a single endpoint. The query defines what data the client receives from said endpoint. It has an easy syntax too, but one that looks very different from OData.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To stick with our example about requesting a particular airport from a data source, here is what this would look like in GraphQL:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#abb2bf;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282c34\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"{\n  airports(filter: { addressContains: &quot;San Francisco&quot; }) {\n    id\n    name\n    location {\n      address\n    }\n  }\n}\n\" style=\"color:#abb2bf;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki one-dark-pro\" style=\"background-color: #282c34\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ABB2BF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">airports<\/span><span style=\"color: #ABB2BF\">(<\/span><span style=\"color: #E06C75; font-style: italic\">filter<\/span><span style=\"color: #ABB2BF\">: { <\/span><span style=\"color: #98C379\">addressContains<\/span><span style=\"color: #ABB2BF\">: <\/span><span style=\"color: #98C379\">&quot;San Francisco&quot;<\/span><span style=\"color: #ABB2BF\"> }) {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">id<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">name<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">location<\/span><span style=\"color: #ABB2BF\"> {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">      <\/span><span style=\"color: #E06C75\">address<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">    }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This GraphQL query assumes that the schema has been set up to allow filtering by a substring. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The GraphQL response would be the same as OData&#8217;s by the way. Both would return a JSON file, such as this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#abb2bf;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#282c34\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewBox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"{\n  &quot;data&quot;: {\n    &quot;airports&quot;: [\n      {\n        &quot;id&quot;: &quot;1&quot;,\n        &quot;name&quot;: &quot;San Francisco International Airport&quot;,\n        &quot;location&quot;: {\n          &quot;address&quot;: &quot;San Francisco, CA&quot;\n        }\n      },\n      {\n        &quot;id&quot;: &quot;2&quot;,\n        &quot;name&quot;: &quot;Oakland International Airport&quot;,\n        &quot;location&quot;: {\n          &quot;address&quot;: &quot;1 Airport Dr, Oakland, CA&quot;\n        }\n      }\n    ]\n  }\n}\n\" style=\"color:#abb2bf;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki one-dark-pro\" style=\"background-color: #282c34\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #ABB2BF\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">  <\/span><span style=\"color: #E06C75\">&quot;data&quot;<\/span><span style=\"color: #ABB2BF\">: {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">    <\/span><span style=\"color: #E06C75\">&quot;airports&quot;<\/span><span style=\"color: #ABB2BF\">: [<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">      {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">&quot;id&quot;<\/span><span style=\"color: #ABB2BF\">: <\/span><span style=\"color: #98C379\">&quot;1&quot;<\/span><span style=\"color: #ABB2BF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">&quot;name&quot;<\/span><span style=\"color: #ABB2BF\">: <\/span><span style=\"color: #98C379\">&quot;San Francisco International Airport&quot;<\/span><span style=\"color: #ABB2BF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">&quot;location&quot;<\/span><span style=\"color: #ABB2BF\">: {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">          <\/span><span style=\"color: #E06C75\">&quot;address&quot;<\/span><span style=\"color: #ABB2BF\">: <\/span><span style=\"color: #98C379\">&quot;San Francisco, CA&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">      },<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">      {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">&quot;id&quot;<\/span><span style=\"color: #ABB2BF\">: <\/span><span style=\"color: #98C379\">&quot;2&quot;<\/span><span style=\"color: #ABB2BF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">&quot;name&quot;<\/span><span style=\"color: #ABB2BF\">: <\/span><span style=\"color: #98C379\">&quot;Oakland International Airport&quot;<\/span><span style=\"color: #ABB2BF\">,<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">        <\/span><span style=\"color: #E06C75\">&quot;location&quot;<\/span><span style=\"color: #ABB2BF\">: {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">          <\/span><span style=\"color: #E06C75\">&quot;address&quot;<\/span><span style=\"color: #ABB2BF\">: <\/span><span style=\"color: #98C379\">&quot;1 Airport Dr, Oakland, CA&quot;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">        }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">      }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">    ]<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">  }<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ABB2BF\">}<\/span><\/span>\n<span class=\"line\"><\/span><\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">GraphQL is a great technology to ensure your UI gets access to the right data.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">OData vs. GraphQL: When to Use Which?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Now let&#8217;s compare OData vs. GraphQL: which technology works best for exposing and accessing data?<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Why You Should Use OData<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. OData Is Easy to Implement:<br><\/strong>All OData needs to work is a storage model. The technology works great for structured data (think relational databases). OData also exposes the underlying metadata, making it easier for clients to understand the structure of the data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. OData Works Great for CRUD Operations:<\/strong><br>As a RESTful protocol with a standardized query language for the web, OData is very well suited for manipulating data with CRUD operations (Create, Read, Update, Delete). Its built-in query capabilties are very SQL-like and easy to read and write. OData, for example, supports filtering, ordering, aggregration, joining and paging.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. When OData Is Supported.<\/strong><br>At the risk of stating the obvious, it is worth adding that OData can of course only be used when it is natively supported. This applies to commonly used ERP systems (Dynamics or SAP), or custom apps developed in FileMaker, for example. <\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Why You Should Use GraphQL<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. GraphQL Gives Developers Flexibility: <\/strong><br>GraphQL is highly flexible. Clients can request data from multiple sources in a single query, and they can specify exactly what fields they need, reducing over-fetching and under-fetching.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. You Only Deal With a Single Endpoint: <\/strong><br>GraphQL uses a single endpoint for all interactions, compared to multiple endpoints in REST. The queries define what data the client receives.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. GraphQL is Well-Suited for Complex Data and Business Logic:<\/strong> <br>GraphQL is well-suited when more than just CRUD operations are required, and when a lot of business logic is involved. It works great for complex data structures or nested relationships.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">Here Is What Developers Say About OData vs. GraphQL<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">&#8220;<em>OData is great if your consumer is a data grid &#8211; sorting, paging, filtering. GraphQL is great when your consumer is&#8230; unspecified &#8211; it&#8217;s a great way for consumers of a collection of APIs to get from them what they want. You handle mapping the relationships and retrieving the data from the APIs, the consumer can just browse it and pick what they want.<\/em>&#8221; &#8211; <a href=\"https:\/\/www.reddit.com\/r\/dotnet\/comments\/kfsy8o\/is_odata_still_viable_option_in_nowadays\/\" rel=\"nofollow noopener\" target=\"_blank\">Reddit<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em>&#8220;OData indeed still has a place where it\u2019s valuable: as an implementation detail, serving as a data access layer for internal forms-over-data applications dealing with dozens, hundreds, or thousands of CRUD screens.&#8221;<\/em> &#8211; <a href=\"https:\/\/jeffhandley.com\/2018-09-13\/graphql-is-not-odata\" rel=\"nofollow noopener\" target=\"_blank\">Jeff Handley<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion: OData vs. GraphQL<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Use OData<\/strong> when you need a mature, standardized protocol with built-in query capabilities, particularly in Microsoft-centric environments or when dealing with applications that benefit from RESTful conventions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Use GraphQL<\/strong> when you need flexibility in data querying, reduced over-fetching, and a more collaborative approach between frontend and backend teams. It&#8217;s ideal for modern web and mobile applications where responsiveness and efficiency are critical.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\">OData in Five<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Five is a rapid application development environment that lets developers build and deploy bespoke business software faster. Five comes with native support for OData and it can easily treat any external application or web service that supports OData as a a data source. This, for example, includes common ERP systems such as Microsoft Dynamics and others. Five can simply fetch data from these systems and display said data in its (login-protected) front-end.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By using OData, Five does not need to store any data locally, but can be used as a UI front end builder on an OData data provider. Common use cases for Five are, for example, customer or business partner portals, where clients maintain information stored in Dynamics through a self-service web interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To learn more, <a href=\"https:\/\/preview-php85.dzine.org\/five\/get-started\">sign up for a free trial<\/a>.<\/p>\n\n\n\n<div style=\"background-color: #001524;\"><hr style=\"height: 5px;\">\n<pre style=\"text-align: center; overflow: hidden; white-space: pre-line;\"><span style=\"color: #f1ebda; background-color: #4588d8; font-size: calc(18px + 0.390625vw);\"><strong>Connect to OData, Build a Web App<\/strong><br><span style=\"font-size: 14pt;\">Rapidly build and deploy custom software&nbsp;<\/span><\/span><\/pre>\n<p style=\"text-align: center;\"><a href=\"https:\/\/preview-php85.dzine.org\/five\/get-started\" target=\"_blank\" rel=\"noopener\"><button style=\"background-color: #f8b92b; border: none; color: black; padding: 20px; text-align: center; text-decoration: none; display: inline-block; font-size: 18px; cursor: pointer; margin: 4px 2px; border-radius: 5px;\"><strong>Get Instant Access<\/strong><\/button><br><\/a><\/p>\n<hr style=\"height: 5px;\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>OData vs. GraphQL: What is The Best Way to REST? The Open Data Protocol, or OData, promotes itself as &#8220;the best way to REST&#8221;. A powerful and easy-to-use data access technology, it provides familiarity by combining the HTTP protocol with a SQL-like query language. How does OData compare against GraphQL, another data query and manipulation [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":3449,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_eb_attr":"","_uag_custom_page_level_css":"","footnotes":""},"categories":[21],"tags":[],"class_list":["post-3442","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"uagb_featured_image_src":{"full":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2024\/08\/Five.Co-OData-vs-GraphQL.jpg",1280,720,false],"thumbnail":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2024\/08\/Five.Co-OData-vs-GraphQL-150x150.jpg",150,150,true],"medium":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2024\/08\/Five.Co-OData-vs-GraphQL-300x169.jpg",300,169,true],"medium_large":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2024\/08\/Five.Co-OData-vs-GraphQL-768x432.jpg",768,432,true],"large":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2024\/08\/Five.Co-OData-vs-GraphQL-1024x576.jpg",1024,576,true],"1536x1536":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2024\/08\/Five.Co-OData-vs-GraphQL.jpg",1280,720,false],"2048x2048":["https:\/\/preview-php85.dzine.org\/five\/wp-content\/uploads\/2024\/08\/Five.Co-OData-vs-GraphQL.jpg",1280,720,false]},"uagb_author_info":{"display_name":"Dominik Keller","author_link":"https:\/\/preview-php85.dzine.org\/five\/author\/f1v5_ed3_my\/"},"uagb_comment_info":0,"uagb_excerpt":"OData vs. GraphQL: What is The Best Way to REST? The Open Data Protocol, or OData, promotes itself as &#8220;the best way to REST&#8221;. A powerful and easy-to-use data access technology, it provides familiarity by combining the HTTP protocol with a SQL-like query language. How does OData compare against GraphQL, another data query and manipulation&hellip;","_links":{"self":[{"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/posts\/3442","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/comments?post=3442"}],"version-history":[{"count":0,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/posts\/3442\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/media\/3449"}],"wp:attachment":[{"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/media?parent=3442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/categories?post=3442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/preview-php85.dzine.org\/five\/wp-json\/wp\/v2\/tags?post=3442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}