{"id":762,"date":"2020-10-10T22:54:24","date_gmt":"2020-10-11T02:54:24","guid":{"rendered":"http:\/\/salzlechner.com\/dev\/?p=762"},"modified":"2020-10-10T22:54:25","modified_gmt":"2020-10-11T02:54:25","slug":"starzen-rest-library-for-dataflex-webapp-introduction","status":"publish","type":"post","link":"http:\/\/salzlechner.com\/dev\/2020\/10\/10\/starzen-rest-library-for-dataflex-webapp-introduction\/","title":{"rendered":"StarZen REST library for DataFlex WebApp &#8211; Introduction"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;3.22&#8243;][et_pb_row _builder_version=&#8221;3.25&#8243; background_size=&#8221;initial&#8221; background_position=&#8221;top_left&#8221; background_repeat=&#8221;repeat&#8221;][et_pb_column _builder_version=&#8221;3.26.7&#8243; type=&#8221;4_4&#8243;][et_pb_text _builder_version=&#8221;3.26.7&#8243;]<\/p>\n<p>We are not going to go over general information on REST services there is plenty of information available. This multi part post is meant to show how to use our open source library to create REST services using DataFlex WebApp.<\/p>\n<p>The library helps by hiding the complexity of handling the following<\/p>\n<ul>\n<li>Routing \/ Paths<\/li>\n<li>Authentication<\/li>\n<li>Schemas\/Data Models<\/li>\n<li>Paging \/ Sorting<\/li>\n<li>OpenAPI Documentation<\/li>\n<li>Error Handling<\/li>\n<li>and more<\/li>\n<\/ul>\n<h2>Routing \/ Paths<\/h2>\n<p>Routing is one of the important features of a REST service controller. Lets take a customer controller as an example.<\/p>\n<p>We want the following features<\/p>\n<ul>\n<li>get list of customers<\/li>\n<li>get customer by number<\/li>\n<li>get orders for customer<\/li>\n<li>create customer<\/li>\n<li>update customer<\/li>\n<li>delete customer<\/li>\n<\/ul>\n<p>The routes we would define are as follows<\/p>\n<ul>\n<li>GET \/customer<\/li>\n<li>GET \/customer\/{number}<\/li>\n<li>GET \/customer\/{number}\/orders<\/li>\n<li>POST \/customer<\/li>\n<li>PATCH \/customer\/{number}<\/li>\n<li>DELETE \/customer\/{number}<\/li>\n<\/ul>\n<p>it can be tedious to have to code these routes over and over so the library takes care of handling the routes and route parameters for you and even handles all the database work for you.<\/p>\n<h2>Authentication<\/h2>\n<p>Most REST services require some sort of authentication. Often multiple different authentications and also often different per route.<\/p>\n<p>The library helps define and handle authentication by allowing the user to define default authentication for the controller and then override the authentication per route.<\/p>\n<h2>Schemas \/ Data Models<\/h2>\n<p>The library allows definition of schemas \/ data models. This is used to automate data output and input, ensure data integrity and is also used to document the service to a possible user using OpenAPI specifications<\/p>\n<h2>Paging \/ Sorting<\/h2>\n<p>\u00a0Paging and sorting capabilities are implemented in the library as well<\/p>\n<h2>OpenAPI documentation<\/h2>\n<p>The library can automatically document the API using OpenAPI specifications. This makes it easy to test the API using swagger and also helps documenting the API to a possible user.<\/p>\n<p>After this quick overview we will look into creating a few different APIs to showcase the features of the library.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;3.26.7&#8243;][et_pb_column _builder_version=&#8221;3.26.7&#8243; type=&#8221;4_4&#8243;][et_pb_text _builder_version=&#8221;3.26.7&#8243;]<\/p>\n\n\t\t<div class='author-shortcodes'>\n\t\t\t<div class='author-inner'>\n\t\t\t\t<div class='author-image'>\n\t\t\t<img src='http:\/\/salzlechner.com\/dev\/wp-content\/uploads\/sites\/2\/2016\/02\/mike5crop-566174_60x60.jpg' alt='' \/>\n\t\t\t<div class='author-overlay'><\/div>\n\t\t<\/div> \n\t\t<div class='author-info'>\n\t\t\tMichael Salzlechner is the CEO of StarZen Technologies, Inc.<\/p>\n<p>He was part of the Windows Team at Data Access Worldwide that created the DataFlex for Windows Product before joining\u00a0StarZen Technologies. StarZen Technologies provides consulting services as well as custom Application development and third party products<\/p>\n\t\t<\/div>\n\t\t\t<\/div>\n\t\t<\/div>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are not going to go over general information on REST services there is plenty of information available. This multi part post is meant to show how to use our open source library to create REST services using DataFlex WebApp. The library helps by hiding the complexity of handling the following Routing \/ Paths Authentication [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","ngg_post_thumbnail":0,"footnotes":""},"categories":[6,27],"tags":[],"class_list":["post-762","post","type-post","status-publish","format-standard","hentry","category-dataflex","category-dataflex-webapp"],"_links":{"self":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/762","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/comments?post=762"}],"version-history":[{"count":7,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/762\/revisions"}],"predecessor-version":[{"id":808,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/posts\/762\/revisions\/808"}],"wp:attachment":[{"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/media?parent=762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/categories?post=762"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/salzlechner.com\/dev\/wp-json\/wp\/v2\/tags?post=762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}