What should you be doing right now? Recommended schedule Many ways to implement client/server communication We will use HTTP (protocol that drives the Web) Server will implement Web API Clients will use HTTP reqeust/response protocol to send requests to the server, and get back responses from the server Implementing a Web API Server Of course, HTTP was originally invented to support web browsing. But, it can also be used to implement server's that have Web APIs. Web browsing with HTTP Click on link causes HTTP "GET" request to fetch requested document from web server Form submit causes HTTP "POST" that sends form data to server, which returns document in response-body The HTTP network protocol can also be used to implement Web APIs Web API Server provides "methods" that clients can call APIs include two basic types of operations: accessors and mutators In HTTP, accessor operations are implemented using GET requests, and mutators are implemented using POST reqeusts (or PUT, DELETE, etc.) HTTP Network Protocol URLs Requests GET REQUESTS: GET request has the following format: GET : : : ... EXAMPLE: GET /games/list HTTP/1.1 Authorization: afj232hj2332 Accept: application/json POST REQUESTS: POST request has the following format: POST : : : ... EXAMPLE: POST /routes/claim HTTP/1.1 Authorization: afj232hj2332 Content-Type: application/json { "route": "atlanta-miami" } Responses HTTP responses have the following format: : : : ... EXAMPLE: HTTP/1.1 200 OK Content-Type: application/json Content-Length: 226 { "game-list": [ { "name": "fhe game", "player-count": 3, ... }, { "name": "work game", "player-count": 4, ... }, { "name": "church game", "player-count": 2, ... } ] } Implementing a Web API with HttpServer Calling a Web API with HttpURLConnection