3. Šta je REST ?
• to je stil softverske arhitekture, za distribuirane
hypermedia sisteme kao što je „World Wide Web“
• nije protokol ni standard
4. Šta je ASP.NET Web API ?
• Frejmvork koji omogućava lak razvoj HTTP
servisa kojima se može pristupati sa velikog
broja različitih klijenata uključujući browsere i
mobilne uređaje
5. Da li je ASP.NET Web API =
RESTful service?
• ASP.NET Web API ne diktira stil arhitekture
• ali vi možete da razvijete RESTful service
pomoću ASP.NET Web API- ja
9. Koje metode ASP.NET Web API
podržava
Metod Akcija HTTPMetod Relativni URI
Get Vraća listu svih
kontakata
GET /api/contacts
Get Vraća kontakt na
osnovu id-a
GET /api/contacts/id
Add Dodaje novi
kontakt
POST /api/contacts
Update Mijenja selektovani
kontakt
PUT /api/contacts
Delete Briše kontakt DELETE /api/contacts/id
11. Kako implementirati Web API
• Nasljediti klasu ApiController
• Implementirati akcije
– akcije se mapiraju na HTTP metode
– stavite prefix ispred metoda za željeni HTTP method
(PostCustomer)
13. Action parameters
• prosti tipovi se dobijaju iz URI-ja
– route data, query parameters
http://api.mssinergija.net/kontakt?kod=nesto
• kompleksni tipovi – request body
– MediaTypeFormatters koriste se za deserijalizaciju
Request Body-ja zavisno od content type-a
– JSON i XML su podržani pod default-u
14. Validacija
• Validacija se vrši na podacima prilikom svakog
request-a
• greške prilikom validacije se snimaju u
ModelState
• provjerite ModelState.IsValid
15. Filteri
• Tipovi filtera :
– Action filters (pokreću se prije i nakon poziva akcije)
– Authorization filters (pokreću se prije model binding-a i
služe za autorizaciju korisnika)
– Exception filters (generišu odgovor u slučaju greške na
centralizovan način)
• Oni mogu biti konfigurisani globalno, po
kontroleru i po akciji
17. Opis Web API-ja
• koristi se IApiExplorer servis da bi se dobio
runtime opis Web API-ja
• korisno prilikom izrade help stranica, test
klijenata, alata i sl.
• http://nuget.org/packages/Microsoft.AspNet.Web
Api.HelpPage
19. Hosting
• dva načina hostovanja
– ASP.NET Web Application (IIS)
– Self-host (npr. console application, Windows service,
Azure Worker Role, itd.)
• hostovanje u memoriji je korisno za integration
testiranje servisa
23. Help us choose the best Sinergija lecturer! HTC and Microsoft will award you
– at the conference end, we’ll give one HTC Windows Phone 8X to someone
from the audience – randomly.
Go to www.mssinergija.net, log in and cast your votes!
You can rate only lectures that you were present at, just once. More lectures you rate, more chances you have.
Please use computers at the front of this room, or rate lecture from your phone or home computer, at Sinergija portal.
This prize contest will end at Thursday, October 24th at 21:00. Winner will be announced at the official Sinergija web portal,
www.mssinergija.net
Please rate this lecture
and WIN Windows Phone 8X by
HTC!
Powered by:
24. Microsoft and
Open Source
gateway for deeper
exploration of
open source
engagements
http://www.microsoft.com
/openness
Port25
blogs from the
platform
community and
the OSS Lab
teams
http://Port25.technet.com
Codeplex
resources for
developers and
consumers of
open source
projects
http://www.codeplex.com
Interoperability
Bridges
technical collaborative
works
http://www.interoperabilit
ybridges.com
Open Up
cross-Industry
Interoperability
and Standards
activities
http://www.microsoft.com
/interop/openup
Shared Source
portal for
programmaticall
y sharing code
http://www.microsoft.com
/sharedsource
OData
open source starter kit
for Internet
publishing of
Government
datasets using
the Open Data
http://ogdisdk.cloudapp.ne
t
Open Spec
protocols, file formats,
standards,
technical
specifications
http://www.microsoft.com
/openspecification
s
BizSpark
Program for Start-Up
companies from
both
commercial and
open source
backgrounds
http://www.microsoft.com
/bizspark
Openness and Interoperability @Microsoft
How can I receive up-to-date Openness announcements from Microsoft?
In addition to the websites above, you can receive regular updates to
Microsoft’s openness, interoperability and standards efforts via the following
channels:
• http://blogs.technet.com/b/openness/
• http://blogs.msdn.com/b/interoperability/
• http://twitter.com/OpenAtMicrosoft
• http://port25.technet.com
• http://channel9.msdn.com/Blogs/Interoperability