Technical workshop, presented by Gerald Martinez, Product Development Manager at Apex Tech, that aim and dive through interactive demonstrations of the building blocks of a Web 2.0 application. Explaining the use of the APEX RESTful API using C# and JQuery.
3. Mashups Is a web page or application that uses or combines data or functionality from two or many more external sources to create a new service. Examples: http://twittervision.com/ http://bcdef.org/flappr/ http://www.tsmaps.com
4. Purpose of the ENDIAPI Maximize the potential of El Nuevo Día primary asset: Content Creation Expand the boundaries of Content Syndication Reach New Content Delivery Platforms.
6. RESTful API REST - Representational State Transfer is a style of software architecture for distributed hypermedia systems such as the World Wide Web. REST-style architectures consist of clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses. REST was initially described in the context of HTTP, but is not limited to that protocol REST over HTTP works with and enhances the native HTTP verbs, URI’s, request and response headers, request and response codes, etc.
7. RESTful API A RESTful web service (also called a RESTful web API) is a simple web service implemented using HTTP and the principles of REST. It is a collection of resources, with three defined aspects: the base URI for the web service, such as http://api.elnuevodia.com/resources/. the MIME type of the data supported by the web service. This is often JSON, XML or YAML but can be any other valid MIME type. the set of operations supported by the web service using HTTP methods (e.g., POST, GET, PUT or DELETE).
8. JSON JavaScript Object Notation, is a lightweight computer data interchange format. It is a text-based, human-readable format for representing simple data structures and associative arrays (called objects). The JSON format is often used for serialization and transmitting structured data over a network connection. Its main application is in Ajax web application programming, where it serves as an alternative to the XML format. Resource: http://www.json.org
10. ENDIAPI Documentation Uses HTTP Basic Authentication Rate Limiting: Clients are allowed 100 requests per 60 sixty minute time period, starting from their first request. Pagination Limiting: Clients may request up to the last 31 days of news articles via the page and count parameters. Resources Available: Sections, News, Comments, UltimaHora, Horoscope, Movies, Climate and others. Debug curl -u <username>:<password> –H “api_key: <APIKey>” http://api.elnuevodia.com/sections/ Reference http://www.apex.pr/reto/documents.htm
11. ENDIAPI – C# Sample Code using System; usingSystem.Web; usingSystem.IO; usingSystem.Net; usingSystem.Text; // Create the web request HttpWebRequest request = WebRequest.Create("http://api.elnuevodia.com/news/") asHttpWebRequest; // Add pre authentication to request request.PreAuthenticate = true; // Add Authorization header request.Headers.Add(HttpRequestHeader.Authorization, "Basic " + Convert.ToBase64String( new UTF8Encoding().GetBytes(String.Format("{0}:{1}", "<Username>", "Password")))); // Add API Key to header request.Headers.Add(String.Format("api_key:{0}", "<API Key>")); // Get response using (HttpWebResponse response = request.GetResponse() asHttpWebResponse) { // Get the response stream StreamReader reader = newStreamReader(response.GetResponseStream()); // Console application output Console.WriteLine(reader.ReadToEnd());
Make it easier for the user to understand the hierarchy of the site. Helps for easier URL frienlynessHTML – tell the users XML – tell the Search EngineAre easier to index for the crawlerCrawlers indexes static pages faster
A sentence or phrase describing the pageA paragraph with a synopsis of the pages content Easier to follow and index. Aviod passing to much parameters, variables, etc. Avoid long URLsUse descriptive text for linksUse this as an Outline of the pageInclude Alt tag for every image.Prevent the crawler to index undesired pages. Security issue. Rel=“nofollow” as an alternative
Roy Fielding – 2000 – Doctoral dissertationRequests and responses are built around the transfer of "representations" of "resources".RESTful architectures can be based on other Application Layer protocols if they already provide a rich and uniform vocabulary for applications based on the transfer of meaningful representational state. RESTful applications maximize the use of the pre-existing, well-defined interface and other built-in capabilities provided by the chosen network protocol, and minimize the addition of new application-specific features on top of it.SOAPRPC over HTTP, on the other hand, encourages each application designer to define a new and arbitrary vocabulary of nouns and verbs (for example getUsers(), savePurchaseOrder(...)), usually overlaid onto the HTTP 'POST' verb. This disregards many of HTTP's existing capabilities such as authentication, caching, content type negotiation, etc. and may leave the application designer re-inventing many of these features within the new vocabulary
Roy Fielding – 2000 – Doctoral dissertationRequests and responses are built around the transfer of "representations" of "resources".RESTful architectures can be based on other Application Layer protocols if they already provide a rich and uniform vocabulary for applications based on the transfer of meaningful representational state. RESTful applications maximize the use of the pre-existing, well-defined interface and other built-in capabilities provided by the chosen network protocol, and minimize the addition of new application-specific features on top of it.SOAPRPC over HTTP, on the other hand, encourages each application designer to define a new and arbitrary vocabulary of nouns and verbs (for example getUsers(), savePurchaseOrder(...)), usually overlaid onto the HTTP 'POST' verb. This disregards many of HTTP's existing capabilities such as authentication, caching, content type negotiation, etc. and may leave the application designer re-inventing many of these features within the new vocabulary
Although JSON was based on a subset of the JavaScript programming language (specifically, Standard ECMA-262 3rd Edition—December 1999) and is commonly used with that language, it is considered to be a language-independent data format. Code for parsing and generating JSON data is readily available for a large variety of programming languages. The json.org website provides a comprehensive listing of existing JSON bindings, organized by language.
Although JSON was based on a subset of the JavaScript programming language (specifically, Standard ECMA-262 3rd Edition—December 1999) and is commonly used with that language, it is considered to be a language-independent data format. Code for parsing and generating JSON data is readily available for a large variety of programming languages. The json.org website provides a comprehensive listing of existing JSON bindings, organized by language.