Integrating REST API and SQL Server JSON Functions

Slides:



Advertisements
Similar presentations
What Is Microsoft Marketplace DataMarket What Is Microsoft Marketplace DataMarket? Michael Stiefel
Advertisements

Introduction to HTML5 By Sam Nasr, MCAD, MCT, MCTS, MVP Nasr Information Systems October 22, 2013.
By Sam Nasr Nasr Information Systems May 14, 2013.
JSON Valery Ivanov.
With jQuery and AJAX Doncho Minkov Telerik Corporation Technical Trainer.
JSON IDU0075 Sissejuhatus veebiteenustesse.  JSON stands for JavaScript Object Notation  JSON is lightweight text-data interchange format  JSON is.
More APIs: Web Services CMPT 281. Announcements Project milestone Lab: – Web services examples.
The New Zealand Institute for Plant & Food Research Limited Matthew Laurenson Web Services: Introduction & Design Considerations.
Lecture 13 – XML and JSON SFDV3011 – Advanced Web Development Reference: 1.
HTML5. HTML5’s overall theme The browser as a rich application platform rich, cross-device user interfaces offline operation capability hardware access.
Google Data Protocol Guy Mark Lifshitz. Motivation Google’s Mission: – Organize the world’s information – Make information universally accessible – Provide.
Welcome to Azure App Services! Amie Seisay
Introduction to Web Services
WINDOWS AZURE MOBILE SERVICES AN INTRODUCTION Bret Stateham Technical Evangelist
Welcome to Azure App Services! Amie Seisay
AJAX. Ajax  $.get  $.post  $.getJSON  $.ajax  json and xml  Looping over data results, success and error callbacks.
My Data Wandered Lonely As A Cloud: Azure Data Factory Julie Smith SQL Server MVP Innovative
JSON (Copied from and from Prof Da Silva) Week 12 Web site:
14 New T-SQL Functions By Sam Nasr, MCAD, MCT, MCTS NIS August 18, 2012.
14 New T-SQL Functions By Sam Nasr, MCAD, MCTS. MVP Nasr Information Systems February 8, 2014.
BI Development By Sam Nasr, MCAD, MCT, MCTS Nasr Information Systems February 5, 2011.
Putting Your Head in the Cloud Working with SQL Azure David Postlethwaite 18/06/2016David Postlethwaite.
Embt.co/sprint-rest-json-services Blog Notes: Building RESTful servers. In C++ Builder Developer Skill Sprint Tips, Tricks and Techniques The Ultimate.
WELCOME MIDHUN SUDHAKAR twitter.com/midhunopus in.linkedin.com/pub/midhunsudhakar/86/a65/a9.
The Fat-Free Alternative to XML
Storing Data.
SQL Server getting closer to
FileTables Sam Nasr, MCAD, MCTS, MVP NIS Technologies
Programming with FileStream Object
All about JSON Scenarios and value proposition for JSON data enabled in Azure SQL Database and SQL Server Ralph Kemperdick Digital Business Architect,
Temporal Tables Sam Nasr, MCSA, MVP NIS Technologies July 22, 2017
The Client-Server Model
Make Power BI Your Own with the Power BI APIs
Mobile App Trends: lifecycle, functions, and cognitive
The Fat-Free Alternative to XML
Automate Custom Solutions Deployment on Office 365 and Azure
JSON.
Make Power BI Your Own with the Power BI APIs
Building Applications with LUIS
FileTables By Sam Nasr, MCAD, MCT, MCTS NIS October 6, 2012
Exporting and Importing Data
Using FileTables Sam Nasr, MCSA, MCT, MVP NIS Technologies
Exporting and Importing Data
Making Developers lives easier with SQL Server 2016
Data Virtualization Tutorial: JSON_TABLE Queries
Using FileTables Sam Nasr, MCAD, MCTS, MVP NIS Technologies
Twitter & NoSQL Integration with MVC4 Web API
SQL Server 2016 JSON Support FOR Data Warehousing
SQL Server 2016 Security Features
14 T-SQL Functions You May Not Know
…and web frameworks in general
ISC440: Web Programming 2 Server-side Scripting PHP 3
Meet JSON In SQL Server 2016 Russ Loski Preparations:
{. “speaker”:. “Emanuele Zanchettin”,. “session” :
Built in Fairfield County: Front End Developers Meetup
Meet JSON In SQL Server 2016 Russ Loski Preparations:
Make Power BI Your Own with the Power BI APIs
A JSON’s Journey through SQL Server
JSON for the Data Mortal
14 T-SQL Functions You May Not Know
Strings and Serialization
What’s new in ASP.NET Core and Entity Framework 2.2 (Preview 3)
…and web frameworks in general
The Fat-Free Alternative to XML
Data Time Travel with Temporal Tables
TN19-TCI: Integration and API management using TIBCO Cloud™ Integration
Using FileTables Sam Nasr, MCSA NIS Technologies August 3, 2019.
Microsoft Azure Data Catalog
Data Time Travel with Temporal Tables
Data Time Travel with Temporal Tables
Presentation transcript:

Integrating REST API and SQL Server JSON Functions Sam Nasr, MCSA, MVP NIS Technologies July 28, 2018

About Me Software Developer since 1995 Sam Nasr (@SamNasr) Software Developer since 1995 Sr. Software Engineer (NIS Technologies) Certifications: MCSA, MCAD, MCT, MCTS President - Cleveland C#/VB.Net User Group President - .Net Study Group Author for Visual Studio Magazine Microsoft Most Valuable Professional (since 2013)

General Info Down the hall (right side) Participation is encouraged Please mute cell phones

Cleveland C#/VB.Net User Group Meets every month Free of charge , open to the public All topics related to .Net Meeting info: https://www.meetup.com/Cleveland-C-VB-Net-User-Group/

JSON JSON (JavaScript Object Notation) Name/Value pair syntax for storing/exchanging data JSON data is Text written in JavaScript object notation Lightweight data-interchange format Self-describing and easy to understand Language independent Native JavaScript Objects JSON.Parse(): converts string into JSON JSON.Stringify(): converts JSON into string

JSON Sample Data { "firstName": "John", "lastName": "Smith", "address": "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021-3100" }, "phoneNumbers": [ "type": "home", "number": "212 555-1234" "type": "office", "number": "646 555-4567" } ], "children": [], "spouse": null

SQL Server JSON Functions JSON_VALUE: extract scalar value JSON_QUERY: extract object or array JSON_MODIFY: Updates property value in JSON string ISJSON: Returns 1 if valid JSON, else 0 OPENJSON: Transforms JSON into table with assumed columns FOR JSON: Formats the result set as JSON [PATH]: define output structure using column names/aliases. [AUTO] automatically create nested sub arrays FOR JSON PATH: Enables you to define the structure of output JSON using the column names/aliases. If you put dot-separated names in the column aliases, JSON properties will follow the naming convention. (Similar to FOR XML PATH where you can use slash separated paths.) FOR JSON AUTO: Automatically create nested JSON sub arrays based on the table hierarchy used in the query (similar to FOR XML AUTO) https://blogs.msdn.microsoft.com/jocapc/2015/05/16/json-support-in-sql-server-2016/

SQL Server JSON Use Cases Simplification of complex data models (denormalize) REST API for SPA Retail/E-commerce Log and telemetry data analysis Storing semi-structured IoT data Fully supported in 2016 and later https://blogs.msdn.microsoft.com/sqlserverstorageengine/2018/01/31/json-in-sql-server-use-cases/

Demo JSON Functions

Visual Studio Project Setup Used .Net Core 2.1 API template No HTTPS, No authentication SDK dependencies were resolved once built and packages downloaded App ran with default setup Install-Package Microsoft.EntityFrameworkCore.SqlServer Install-Package Microsoft.EntityFrameworkCore.Tools Install-Package Microsoft.VisualStudio.Web.CodeGeneration.Design

Demo Web API

Gotchas Using .Net Core 2.0 caused alot of problems because of every package install defaulted to 2.1. Reference issues shown until first build Ensure App template runs with default setup JSON_MODIFY does NOT update record in DB, only the JSON returned.

Recap

Contact Info snasr@nistechnologies.com @SamNasr http://www.linkedin.com/in/samsnasr Thank you for attending!