[PDF] building a simple rest api with nodejs and express
[PDF] building restful web apis with asp.net core 3.1 free download
[PDF] building restful web apis with django
[PDF] building restful web apis with node.js and express
[PDF] bulgari
[PDF] bulgarian citizenship language test
[PDF] bundt cakes columbus
[PDF] burden of major musculoskeletal conditions. bulletin of the world health organization
[PDF] bureau veritas dynapos am/at
[PDF] burwell v hobby lobby
[PDF] burwell v hobby lobby mtsu
[PDF] burwell v. hobby lobby
[PDF] burwell v. hobby lobby summary
[PDF] bus paris nantes aeroport
[PDF] bus paris nantes comparateur
1
Introduction to RESTful Web Services
Presented by Steve Ives
2
Introduction to RESTful Web Services
Whatare web services?
Howare web services implemented?
Whyare web services used?
Categoriesof web services
History of .NET web service technologies
RESTfulweb services...the "state of the art"
OData services...taking things to the next level
Importanceto your business?
Focusduring this conference
Teaser...Harmony Core
3
What are Web Services?
4
What are Web Services?
Published APIs
Great alternative to
custom components
Standard protocols and payloads
Zero client footprint
"Software systems designed to support interoperable machine-to- machine interaction over a network. (W3C)
Called by client software
Desktop or server apps
Websites
Other web services
Mobile apps
Internet of Things
Web services expose
Data
Business logic
Via the web
Remote procedure calls via standard tools
5
How Are Web Services Implemented?
6
How Are Web Services Implemented?
CODE+NETWORK
PROTOCOLDATA
FORMAT+=WEB
SERVICE
Web services are cross-platform language-
independent remote function calls. 7
Web Service Code
Web services contain operations that perform various actions. Operations are methods...web services are remotely callable functions. The clever part is the network messaging, serialization of data, etc.
The easy part is writing the code!
8
Web Service Network Protocols
HTTP or HTTPS
Simple and effective protocol
Widely supported across platforms &
development environments
Internet friendly
Firewall friendly
Occasionally other protocols within
private LAN
WCF socket endpoints, etc.
Specific one-to-one scenarios
9
Web Service Data Interchange Formats
Simple Object Access Protocol (SOAP)
-792 charactersPlain XML -556 charactersJavaScript Object Notation (JSON) -401 characters
Most web services now use JSON.
Some continue to offer XML alternative.
Most frameworks serialize & deserialize
data automatically. 10 Why
Are Web Services Used?
11
Why Are Web Services Used?
Achieve interoperability between systems & applications Combine best aspects of component-based development & web
Platform & language agnostic
Decoupled
Clients don't know or care how services are implemented. Services don't know or care how clients are implemented.
Follow the rules and it just works!
Scalable (if well designed)
Multiple deployment options
Great ROI
Expose functionality once.
Call it from multiple client apps.
12
Categories of Web Services
13
Public API
Common use cases
Public information or service
Selling information or service
App store mobile apps
Published desktop apps
Audience
Open to anyone
Often requires registration
May require fees
Connectivity
Internet
API
Usually designed for widespread use
Web service
Application &
data serversVarious & unknown consumers
Internet
14
Restricted Use API
Common use cases
B2B, interaction with partner entities
Supporting a mobile app
Audience
Limited, known, authorized
Connectivity
Internet
API
Typically designed for a single specific
consumer/appWeb service
Application &
data servers
Internet
Customer or
vendor application server
Company
mobile app (external use) 15
Private API
Common use cases
Corporate web sites
Systems integration
Internal use mobile apps
Audience
Restricted, internal, controlled
Connectivity
Internet or private network
API
Sometimes specific to a single use case
Sometimes general purpose
Enterprise Service Bus (ESB)
Application &
data serversWeb service
Internet
Company
mobile app (internal use)
In-house remote
application
In-house local
application
Corporate
web server ESB 16
History of .NET Web Service Technologies
17
ASP.NET Web Services
Introduced in .NET 1.0 (2002)
Look for .asmx
Pretty much died when WCF was introduced (2005)!
Transport
Always HTTP[S]
Data protocol
SOAP (verbose XML dialect)
WSDL
XML file describing the service to custom tooling
Easy to use from environments with WSDL tooling
.NET "add service reference" generates client-side code
Difficult to use from other environments
Producing and parsing complex SOAP messages
Performance and scalability - not great!
18
Windows Communication Foundation
Introduced in .NET Framework 3.0 (Visual Studio 2005) Last significant update in .NET Framework 4.5(Visual Studio 2012)
More flexible & capable than ASMX
Multiple network transports
HTTP, TCP, named pipes, etc.
Still SOAP-based, but improved performance
Early REST capabilities "shoehorned in" to later versions
Heavily configuration based
Good and bad
Simple to code, nightmare to configure!
Could be fast, but scalability could be a BIG issue 19
ASP.NET Web API
Introduced in .NET Framework 4.0 (Visual Studio 2010)
Now open source and actively developed
Now supported by .NET Framework and .NET Core
Total focus on RESTful web services
Easy to learn and use
Fully compatible with Synergy .NET
Microsoft finally focused on performance!
Fast and scalable, current "best of breed"
Current "state of the art" for .NET web services
20
RESTful Web Services
21
RESTful Web Services
Representational State Transfer
An architectural style, not a product, transport, or protocol A set of constraintsto be used for creating web services Access & manipulate textual representations of resources in a uniformand statelessway
Architectural goals
Accessibility from any environment
Simplicity through use of a uniform interface
Performance and scalability
RESTful implementations leverage various standards
URIRFC 3986
HTTPRFC 7230 -7237
JSONRFC 7159
22
Consistent Interface & Standard Operations
URLs identifiythe type of entity being addressed
Standards apply, naming conventions, etc.
These URLs are known as "routes" or "endpoints"
HTTP method used to access URL determines operation type
Create, read, update, delete, etc.
Inbound data passed in two ways
Path parameters (in the URL)
Body data (in the request body)
Outbound data (if any) passed in the HTTP response body Completion status indicated by the HTTP response status code 23
URLs Identify Entity Being Addressed
The collection of customer entities
The specific customer with customer ID 123456
The collection of customers in California
The collection of customers in California assigned to rep 1200 Each of these endpoints is mapped to a method in the code 24
HTTP Methods Identify Operation Type
GET/api/customers
Read allcustomers
GET/api/customers/12345
Read onecustomer
POST/api/customers
Create newcustomer (primary auto assigned by service)
New customer data passed in request body
PUT/api/customers/12345
Create or updatespecific customer (all properties)
Customer data passed in request body
PATCH/api/customers/12345
Partial updatespecific customer (individual properties)
Change instructions passed in request body
DELETE/api/customers/12345
Deletespecific customer
25
Data Passed via Request/Response Body
GET, POST, and PUTPATCH
26
Completion Status
Success status codes
200-OK
Success
Data is present in the response body
204-No content
Success
No data in response
E.g., successful update or delete
201-Created
A POST or PUT operation resulted in a new
entity being created
Location header contains URL
Failure status codes
400-Bad request
Invalid call to service
Bad URL, missing headers, inappropriate data
Client programming error
401-Unauthorized
Authentication is required and the client is not authenticated
403-Forbidden
The authenticated user does not have required permissions
404-Not found
The requested resource does not exist
500-Internal server error
Server programming error
27
Example Request and Response
Programmers only ever see this in log files...libraries do all the work! 28
Advantages of RESTful Web Services
Simple to learn, build, and use
URLs, HTTP, and basic CRUD operations
Simple to write and document
Completely open, reach more clients
Less overhead
Less duplication
More standardized
Testable
Around 70% of public APIs are implemented as RESTful services 29
ASP.NET Web API
Open source framework for building RESTful Web APIs
No SOAP, no WSDL
HTTP transport
Preference for JSON, XML supported
Closely related to ASP.NET MVC
Models and controllers, familiar to many
Convention over configuration
Naming conventions, verbs map to HTTP methods, etc.
Easy to learn, use, and deploy
GREAT performance & scalability
quotesdbs_dbs17.pdfusesText_23