1 / 18

WEB API

WEB API. API. is a set of subroutine definitions, protocols, and tools for building application software. Purpose API make it easier for developers to use certain technologies in building applications. API. APPLICATION PROGRAMMING INTERFACE. API. Documentation describing API:

Download Presentation

WEB API

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WEB API

  2. API

  3. is a set of subroutine definitions, protocols, and tools for building application software. Purpose API make it easier for developers to use certain technologies in building applications. API APPLICATION PROGRAMMING INTERFACE

  4. API • Documentation describing API: • List of functions (endpoints) • Calls (requests) • Returns (responses) • Implementations: • Library or framework that can be imported to develop an application • OS interfaces between an app and OS (POSIX, MacOS API, Windows API) • Remote APIs on remote servers

  5. WEB (Remote) APIs • A server-side programmatic interface allows the client application to communicate with the server • Based on one or more publicly exposed endpointsand a defined request–response message system. • Uses the network to provide its services

  6. NET Protocols • Address resolving and delivering packets • Transmission Control between applications over IP • Content container Level (application protocol) • Security Level • IP • TCP • HTTP • HTTPS • URL: Protocol + address + port + path on server (URI) _https://best.server.com:8080/API/endpoints/cars?brand=FERRARI&color=RED

  7. Web Services zhttps://best.server.com:8080/API/endpoints/cars?brand=FERRARI&color=RED DesktopApps INTERNET Endpoint Mobile apps WEB SERVER Requests Endpoint DB Endpoint Other servers Responses Endpoint Web API Endpoint Smart Teapot

  8. is an architectural style URL based services HTTP/HTTPS only JSON , XML, TEXT, HTML Authorization and security must be implemented separately Easy to implement SOAP vs REST SimpleObjectAccess Protocol REpresentationalStateTransfer • is a protocol • uses services interfaces • Works on top of any communication Protocol, even asynchronously (TCP HTTP FTP SMTP) • Only XML • Security and authorization are part of the protocol • Fully described and provide information to users (WSDL)

  9. Principles of REST • RESOURCES expose easily understood directory structure URIs. • REPRESENTATIONS transfer JSON or XML to represent data objects and attributes. • MESSAGES use HTTP methods explicitly (for example, GET, POST, PUT, and DELETE). • STATELESS interactions store no client context on the server between requests. The client holds session state.

  10. HTTP methods • GET - Retrieve information. GET requests must be safe and idempotent, meaning regardless of how many times it repeats with the same parameters, the results are the same • POST - Request that the resource at the URI do something with the provided entity • PUT - Store an entity at a URI. PUT can create a new entity or update an existing one. • PATCH - Update only the specified fields of an entity at a URI • DELETE - Request that a resource be removed; however, the resource does not have to be removed immediately. • HEAD, OPTIONS, TRACE and CONNECT

  11. SELECT rows INSERT new row UPDATE row DELETE row UPDATE certain field CRUD - HTTP REQUESTS IN REST HTTP Requests DB operations • GET • POST • PUT • DELETE • PATCH

  12. HTTP request status codes indicate the result of the HTTP request. • 1XX - informational • 2XX – success (200 -OK, 201 – Created,204 - No Content) • 3XX - redirection • 4XX - client error (400-Bad Request, 401 Unauthorized, 403 - Forbidden, 404 - PNF) • 5XX - server error

  13. Request Structure • A request line GET /images/logo.png HTTP/1.1 • Request header fields Accept-Language: en Content-Type: text/html Cookie: <cookie-list> • An empty line. • An optional message body. JSON, TEXT, XML

  14. Response Structure • A status line which includes the status code and reason message HTTP/1.1 200 OK • Response header fields Content-Type: text/html Allow: GET, HEAD. • An empty line. • An optional message body JSON, TEXT, XML

  15. _

  16. -

  17. _

  18. _

More Related