El Nuevo Dia (END) Exposes Some of Its Content and Functionality Via an Application Programming

Total Page:16

File Type:pdf, Size:1020Kb

El Nuevo Dia (END) Exposes Some of Its Content and Functionality Via an Application Programming

Introduction

El Nuevo Dia (END) exposes some of its content and functionality via an Application Programming Interface (API) built and supported by APEX Technologies, Inc. This document is a reference for that interface, and aims to serve as a reference for developers building tools that talk to the END Interactive API (ENDIAPI). For more information about this document or the API please contact us at: [email protected]. Contents

Introduction...... 1 Concepts...... 2 Authentication...... 2 RESTful Resources...... 3 Parameters...... 3 HTTP Requests...... 3 HTTP Headers...... 3 HTTP Status Codes...... 3 Error Messages...... 4 Rate Limiting...... 4 Pagination Limiting...... 4 Encoding...... 4 Getting Started...... 4 Be Nice to the Servers...... 4 The Easiest Way to Play Around with the ENDIAPI...... 5 Sample code...... 5 Frequently Asked Questions...... 5 How do I report bugs and request features?...... 5 How can I keep up with changes to the ENDIAPI?...... 6 Resources Available From API...... 6 Sections...... 6 Description...... 6 Methods...... 6 Subsections...... 7 Description...... 7 Methods...... 7 News...... 8 Description...... 8 Methods...... 9 Comments...... 11 Description...... 11 Methods...... 11 Ultima Hora...... 12 Description...... 12 Methods...... 12 Photogalleries...... 13 Description...... 13 Methods...... 14 Horoscopes...... 15 Description...... 15 Methods...... 16 Polls...... 17 Description...... 17 Methods...... 17 Movies...... 18 Description...... 18 Methods...... 18 Climate...... 20 Description...... 20 Methods...... 23 Lottery...... 24 Description...... 24 Methods...... 24

Concepts

Authentication

Many ENDIAPI methods require authentication. All responses are relative to the context of the authenticating user.

For the time being, HTTP Basic Authentication is the only supported authentication scheme. When authenticating via Basic Auth, use your username and password in the Authorization header and provide the API Key in the request header.

See examples for more information. RESTful Resources

The ENDIAPI attempts to conform to the design principles of Representational State Transfer (REST).

ENDIAPI presently only supports JSON as its data format.

Parameters

Some API methods take optional or requisite parameters. Where applicable, we’ve documented those parameters. Remember to convert to UTF-8 and URL encode parameters that take complex strings. Please note that the page parameter begins at 1, not 0.

There are two special parameters in the ENDIAPI:

 callback: Used only when requesting JSON formatted responses, this parameter wraps your response in a callback method of your choice. For example, appending &callback=myFancyFunction to your request will result in a response body of: myFancyFunction(...). Callbacks may only contain alphanumeric characters and underscores; any invalid characters will be stripped.  suppress_response_codes: If this parameter is present, all responses will be returned with a 200 OK status code - even errors. This parameter exists to accommodate Flash and JavaScript applications running in browsers that intercept all non-200 responses. If used, it's then the job of the client to determine error states by parsing the response body. Use with caution, as those error messages may change.

HTTP Requests

Methods to retrieve data from the ENDIAPI require a GET request. Methods that submit, change, or destroy data require a POST. A DELETE request is also accepted for methods that destroy data. API Methods that require a particular HTTP method will return an error if you do not make your request with the correct method.

Currently only GET is supported.

HTTP Headers

Where noted, some API methods will return different results based on HTTP headers sent by the client. For example, most methods that allow a since parameter will also respond to an If-Modified-Since header. Where the same behavior can be controlled by both a parameter and an HTTP header, the parameter will take precedence.

HTTP Status Codes

The ENDIAPI attempts to return appropriate HTTP status codes for every request. Here's what's going on with our various status codes:

 200 OK: everything worked as expected.  304 Not Modified: there was no new data to return.  400 Bad Request: your request is invalid, and we'll return an error message that tells you why. This is the status code returned if you've exceeded the rate limit (see below).  401 Not Authorized: either you need to provide authentication credentials, or the credentials provided aren't valid.  403 Forbidden: we understand your request, but are refusing to fulfill it. An accompanying error message should explain why.  404 Not Found: either you're requesting an invalid URI or the resource in question doesn't exist (ex: no such news item).  410 Gone: This will be the status code returned when the resource you are requesting is no longer available and will not be available ever again, such as a news item that has expired.  500 Internal Server Error: we did something wrong. Please post to the group about it and the APEX team will investigate.  502 Bad Gateway: returned if ENDIAPI is down or being upgraded.  503 Service Unavailable: the ENDAPI servers are up, but are overloaded with requests. Try again later.

Error Messages

When the ENDI API returns error messages, it does so in JSON.

{ “request” : “/news/3123/”, “error” : “No news article with that ID found.” }

Rate Limiting

Clients are allowed 100 requests per 60 sixty minute time period, starting from their first request.

Notification that a client has exceeded the rate limit will be sent as JSON. A status code of 400 will be returned when the client has exceeded the rate limit.

If you are developing an application that requires more frequent requests to the ENDIAPI, please request whitelisting to APEX and we'll get back to you, usually within 48 hours or less.

Pagination Limiting

Clients may request up to the last 31 days of news articles via the page and count parameters. Requests for more than the limit will result in a reply with a status code of 200 and an empty result in the format requested.

Encoding

The ENDIAPI supports UTF-8 encoding.

Getting Started

Be Nice to the Servers

In order to keep the API running smoothly, please obey the following guidelines:

 If your application does not keep local state, request only the first page of information that you need, and load additional pages only when triggered by user interaction.  If your application keeps a local archive that persists between sessions, it's okay to request an entire list. Save it locally and avoid requesting it again.

 Cache your data! and keep an eye on the remaining requests remember you only have a certain amount of request per hour.

The Easiest Way to Play Around with the ENDIAPI

If your system has curl (and it should!), you’ve already got a great way to poke around the ENDIAPI. Here are some examples:

 Get the section information: curl -u : –H “api_key: ” http://api.elnuevodia.com/sections/  Get information about the section with id “1”: curl -u : –H “api_key: ” http://api.elnuevodia.com/sections/1/

Sample code using System; using System.Web; using System.IO; using System.Net; using System.Text;

// Create the web request HttpWebRequest request = WebRequest.Create("http://api.elnuevodia.com/news/") as HttpWebRequest;

// 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}", "", "Password"))));

// Add API Key to header request.Headers.Add(String.Format("api_key:{0}", ""));

// Get response using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) { // Get the response stream StreamReader reader = new StreamReader(response.GetResponseStream()); // Console application output Console.WriteLine(reader.ReadToEnd()); } Frequently Asked Questions

How do I report bugs and request features?

You can see the list of existing issues right here. Please check to be sure your issue hasn't already been reported. Star an existing issue to vote for it, or add an example to an issue if it describes your bug. Or, report a new issue if need be. How can I keep up with changes to the ENDIAPI?

There are a number of great ways to follow the changes we make to the ENDIAPI:

 Follow @endiapi on Twitter.  Check the REST API Changelog right here on the API Wiki or subscribe to its RSS feed. Resources Available From API

Sections

Description

Sections are a container item that has subsections within them and a short description of the section itself.

Here’s an example of a section as defined in JSON:

{ “id” : “1”, “name” : “Diario”, “url” : “http://www.elnuevodia.com/diario/home” “subsections” : [ { “id” : 1, “name” : “PR Hoy”, “path” : “/sections/noticias/subsections/prhoy/”, }, { “id” : 2, “name” : “Negocios”, “path” : “/sections/noticias/subsections/negocios/”, }, … { “id” : 8, “name” : “Ciencia y Tecnología”, “path” : “/sections/noticias/subsections/cienciaytecnologia/”, } ] }

Some notes:  Id: The internal id (integer) of the section, this can also be used to access the Section resource.

 Subsections: an array of the id, name and path of the subsections belonging to this section.

 url: defines the url for the section’s site in elnuevodia.com

Methods /sections/ Returns the list of section objects corresponding to all the sections in El Nuevo Dia. URL: http://api.elnuevodia.com/sections/ Parameters: NONE Example output: [{ “id” : 1, “name” : “Noticias”, “url” : “http://www.elnuevodia.com/diario/home” “subsections” : [ { “id” : 1, “name” : “PR Hoy”, “path” : “/sections/noticias/subsections/prhoy/”, }, … ] },{ “id” : 2, “name” : “Deportes”, “url” : “http://www.elnuevodia.com/diario/seccion/deportes” “subsections” : […] }]

Subsections

Description

Subsections are a container item that contains paths to news items.

Here’s an example of a subsection as defined in JSON:

{ “id” : 1, “section_id” : 1, “name” : “PR Hoy”, “url” : “http://www.elnuevodia.com/diario/subseccion/noticias/puertoricohoy”, “news” : [ { “title” : “Primera Noticia Del Dia”, “subtitle” : “Todo el mundo feliz porque puede ver El Nuevo Día a través de REST.”, “path” : “/news/1/”, }, … ] }

Some notes:  Id: The internal id (integer) of the subsection, this can also be used to access the Subsection resource.

 News: It’s a list of the title, subtitle and paths of the news items belonging to this section.  url: defines the url for the subsection’s site in elnuevodia.com

Methods

/sections//subsections/ Returns the list of subsection objects corresponding to the section with id . URL: http://api.elnuevodia.com/sections//subsections/ Example URL(s): http://api.elnuevodia.com/sections/1/subsections/ http://api.elnuevodia.com/sections/diario/subsections/ Parameters: NONE Example output: [{ “id” : “1”, “section_id” : “1”, “name” : “PR Hoy”, “url” : “http://www.elnuevodia.com/diario/subseccion/noticias/puertoricohoy”, “news” : [ … ], }, { “id” : “2”, “section_id” : “1”, “name” : “Negocios”, “url” : “http://www.elnuevodia.com/diario/subseccion/noticias/negocios”, “news” : [ … ], },]

News

Description

News items are an object that describes a news article in depth and all the resources related to it.

Here’s an example of a news article as defined in JSON:

{ “id” : 1, “section_id” : 1, “subsection_id” : 1, “url” : “http://www.elnuevodia.com/diario/noticia/ciencia/noticias/rest_para_todos/1”, “title” : “Primera Noticia Del Dia”, “subtitle” : “Todo el mundo feliz porque puede ver El Nuevo Día a través de REST.”, “intro” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “author” : “Tyler Durden”, “body” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “related_news” : [ 2, 3, 4, 5, 6 … ], “related_photogalleries” : [ 1 ], “related_polls” : [ 1 ], “image” : { “url”: “http://www.elnuevodia.com/XStatic/endi/images/REST.png”, “title” : “REST Diagram”, “caption” : “REpresentational State Transfer is the architecture behind El Nuevo Día’s powerful API.”, “alt_text” : “A REpresentational State Transfer Diagram”, } “tags” : [“rest”, “programming”, “api”, “endi”, “apex”], “pub_date” : “YYYY-MM-DD”, “mod_date” : “YYYY-MM-DD”

}

Some notes:  Id: The internal id (integer) of the section.

 section_id: the integer id of the section containing this news article

 subsection_id: the integer id of the subsection containing this news article

 related_news (optional): an array of ids of news articles related to this one

 related_photogalleries (optional): an array of ids of photogalleries related to this news item (typically only a single gallery)

 related_polls (optional): an array of ids of polls related to this news item (typically only a single poll)

 image (optional): an image JSON object describing an image related to this news item

 tags: array of string tags describing the article

 pub_date/mod_date: ISO 8601 formatted string with the publication and last modification dates

Methods

/news/ Returns a list of the news articles, by default it returns the last 10 news articles sorted by date. URL: http://api.elnuevodia.com/news/ Example URL(s): http://api.elnuevodia.com/news/?section_id=1&tags=rest,programming&subsection_id=1&count=42 http://api.elnuevodia.com/news/?mod_date_start=2008-12-31&mod_date_end=2008-01-01 http://api.elnuevodia.com/news/?get_related_news=true Parameters:  count(optional): amount (int) of results to return (max 50, defaults to 10)  get_related_news (optional): set this to true to expand the related_news array to include the JSON object with all the data instead of just having the IDs. Use this instead of multiple queries if you’re always going to query the related news articles. (default: false)  get_related_photogalleries (optional): set this to true to expand the related_ photogalleries array to include the JSON object with data instead of just having the IDs. Use this instead of multiple queries if you’re always going to query the related photogalleries.  get_related_polls (optional): set this to true to expand the related_polls array to include the JSON object with data instead of just having the IDs. Use this instead of multiple queries if you’re always going to query the related polls.  mod_date_start(optional): ISO 8601 formatted string for the start of the modification dates to search for (only the last 7 days are available)  mod_date_end(optional): ISO 8601 formatted string for the end of the modification dates to search for  page(optional): page of results to return (defaults to 1).  pub_date_start(optional): ISO 8601 formatted string for the start of the publication dates to search for  pub_date_end(optional): ISO 8601 formatted string for the end of the publication dates to search for  section_id(optional): section (int id) to filter by  source(optional): source (“print” or “web”) to filter by  subsection_id(optional): subsection (int id) to filter by  tags(optional): a comma separated list of tags to filter by

Example output: [{ “id” : 1, “section_id” : 1, “subsection_id” : 1, “title” : “Primera Noticia Del Dia”, “subtitle” : “Todo el mundo feliz porque puede ver El Nuevo Día a través de REST.”, “intro” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “author” : “Tyler Durden”, “body” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “related_news” : [ 2, 3, 4, 5, 6 ], “related_photogalleries” : [ 1 ], “related_polls” : [ 1 ], “image” : { “url”: “http://www.elnuevodia.com/XStatic/endi/images/REST.png”, “title” : “REST Diagram”, “caption” : “REpresentational State Transfer is the architecture behind El Nuevo Día’s powerful API.”, “alt_text” : “A REpresentational State Transfer Diagram”, } “tags” : [“rest”, “programming”, “api”, “endi”, “apex”], “pub_date” : “2008-01-12”, “mod_date” : “2009-01-13”

}, {…}, ]

/news// Returns the news article with id equal to . URL: http://api.elnuevodia.com/news/ / Example URL(s): http://api.elnuevodia.com/news/1/ Parameters: NONE Example output: { “id” : 1, “section_id” : 1, “subsection_id” : 1, “title” : “Primera Noticia Del Dia”, “subtitle” : “Todo el mundo feliz porque puede ver El Nuevo Día a través de REST.”, “intro” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “author” : “Tyler Durden”, “body” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “related_news” : [ 2, 3, 4, 5, 6 ], “related_photogalleries” : [ 1 ], “related_polls” : [ 1 ], “image” : { “url”: “http://www.elnuevodia.com/XStatic/endi/images/REST.png”, “title” : “REST Diagram”, “caption” : “REpresentational State Transfer is the architecture behind El Nuevo Día’s powerful API.”, “alt_text” : “A REpresentational State Transfer Diagram”, } “tags” : [“rest”, “programming”, “api”, “endi”, “apex”], “pub_date” : “2008-01-12”, “mod_date” : “2009-01-13”

}

Comments

Description

A comment items is an object describing a comment on a news article.

Here’s an example of a news article as defined in JSON:

{ “id” : 1, “text” : “Primera Noticia Del Dia”, “author” : “Tyler Durden”, “post_date” : “2008-01-20 13:02:23-04”, }

Some notes:  Id: The internal id (integer) of the comment.

 Text: a string containing the text of the comment

 Author: the username of the author that posted the comment

 post_date: ISO 8601 formatted string with the comment post date

Methods

/news//comments/ Returns a list of the comments for a particular news article, by default it returns the last 10 news articles sorted by date. URL: http://api.elnuevodia.com/news/ Example URL(s): http://api.elnuevodia.com/news/1/comments/?count=42

Parameters:  count(optional): amount (int) of results to return (max 25, defaults to 10)  page(optional): page of results to return (defaults to 1).  post_date_start(optional): ISO 8601 formatted string for the start of the publication dates to search for  post_date_end(optional): ISO 8601 formatted string for the end of the publication dates to search for  section(optional): section (int id) to filter by  source(optional): source (“print” or “web”) to filter by  subsection(optional): subsection (int id) to filter by  tags(optional): a comma separated list of tags to filter by

Example output: [{ “id” : 1, “text” : “Primera Noticia Del Dia”, “author” : “Tyler Durden”, “post_date” : “2008-01-20 13:02:23-04”, }, {…} ]

Ultima Hora

Description

A Ultima Hora item is an object describing the most recent news article.

Here’s an example of a Ultima Hora item as defined in JSON:

{ "id" : 687115, "section_id" : 3445, "subsection_id" : 3451, "title" : "Supremo revierte más despidos de empleados públicos", "subtitle" : "", "intro" : "Victoria judicial para cesanteados en la Comisión de Relaciones", "author" : "Por Inter News Service", "body" : "

SAN JUAN -<\/b> Empleados de la Comisión de Relaciones del Trabajo del Servicio Público (CRTSP) lograron revertir las cesantías decretada s por la JREF (Junta de Reestructuración y Estabilización Fiscal".<\/p>", "image" : { }, "tags" : "", "pub_date" : "3/17/2010 12:00:00 AM", "mod_date" : "3/17/2010 10:17:13 AM", "url" : "/diario/noticia/noticias/puertoricohoy/elnuevodia/687115" } Some notes:  Id: The internal id (integer) of the news article.

 Section_id: the integer id of the section containing this news article

 subsection_id: the integer id of the subsection containing this news article

 author: The name of the writer for the news article.

 image (optional): an image JSON object describing an image related to this news item

 pub_date/mod_date: ISO 8601 formatted string with the publication and last modification dates

 url: Web address used when the news article was published originally. Methods

/news/ultimahora/ Returns a list of the latest news articles, by default it returns 10 news articles sorted by date. URL: http://api.elnuevodia.com/news/ultimahora/ Example URL(s): http://api.elnuevodia.com/news/ultimahora/ Parameters: NONE Example output: [{ "id" : 687152, "section_id" : 3446, "subsection_id" : 3479, "title" : "Regreso de Tiger Woods podría disparar audiencia de TV ",

"subtitle" : "", "intro" : "El golfista retornaría a juego el próximo 8 de abril", "author" : "Por RACHEL COHEN/AP", "body" : "

NUEVA YORK<\/b> Tiger Woods se encamina a superar sus propios logros ahora que intenta regresar al golf en busca de la reivindicación después de casi cuatro meses adversos.<\/p> ", "image" : { }, "tags" : "", "pub_date" : "3/17/2010 12:00:00 AM", "mod_date" : "3/17/2010 11:23:22 AM", "url" : "/diario/noticia/deportes/otrosdeportes/elnuevodia/687152" }, { "id" : 687130, "section_id" : 3445, "subsection_id" : 3465, "title" : "Joven se rinde tras espectacular asalto", "subtitle" : "", "intro" : "También delató a sus compinches, con los que robó 242,000 euros en un torneo de póquer", "author" : "Por Agencia EFE", "body" : "

La policía alemana ha dado por resuelto el caso de un espectacular asalto a un torneo de póquer el pasado 6 de marzo en el hotel Gran Hyatt de Berlín, en el que un grupo de cuatro hombres se llevó un botín de 242,000 euros.<\/p>", "image" : { }, "tags" : "", "pub_date" : "3/17/2010 12:00:00 AM", "mod_date" : "3/17/2010 11:13:07 AM", "url" : "/diario/noticia/noticias/mundiales/elnuevodia/687130" }, {…} ]

/news/ultimahora/ Returns a list of the latest news articles, by default it returns 10 news articles sorted by date. URL: http://api.elnuevodia.com/news/ultimahora// Example URL(s): http://api.elnuevodia.com/news/ultimahora/687152/ Parameters: NONE Example output: [ { "id" : 687152, "title" : "Regreso de Tiger Woods podría disparar audiencia de TV", "body" : "NUEVA YORK - Tiger Woods se encamina a superar sus propios logros ahora que intenta regresar al golf en busca de la reivindicación después de casi cuatro meses adversos.", "author" : "Por RACHEL COHEN/AP", "pub_date" : "3/17/2010 12:00:00 AM", "image_lg" : { "url" : "", "caption" : "" }, "url" : "http://www.elnuevodia.com/diario/noticia/deportes/otrosdeportes/eln uevodia/687152" } ]

Photogalleries

Description

Photogalleries items are an object that describes a photo gallery and the images that make it up.

Here’s an example of a photogallery as defined in JSON:

{ “id” : 1, “url” : “http://www.elnuevodia.com/diario/fotogaleria/1”, “title” : “REST Technology Gallery”, “intro” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “author” : “Tyler Durden”, “images” : [{ “url”: “http://elnuevodia.com/XStatic/endi/images/REST.png”, “title” : “REST Diagram”, “caption” : “REpresentational State Transfer is the architecture behind El Nuevo Día’s powerful API.”, “alt_text” : “A REpresentational State Transfer Diagram”, },{ “url”: “http://elnuevodia.com/XStatic/endi/images/42.png”, “title” : “42”, “caption” : “Answer to Life, the Universe, and Everything.”, “alt_text” : “Answer to Life, the Universe, and Everything.”, }, ], “tags” : [“rest”, “programming”, “api”, “endi”, “apex”], “pub_date” : “YYYY-MM-DD”,

}

Some notes:  Id: The internal id (integer) of the section.

 images: an array of image JSON objects describing images in this gallery

 tags: array of string tags describing the photogallery

 pub_date: ISO 8601 formatted string with the publication date

Methods /photogalleries/ Returns a list of the photogalleries, by default it returns the last 10 galleries sorted by date. URL: http://api.elnuevodia.com/ photogalleries / Example URL(s): http://api.elnuevodia.com/news/?section=1&tags=rest,programming&subsection=1&count=42 http://api.elnuevodia.com/photogalleries/?tags=rest,programming&count=42&page=2 http://api.elnuevodia.com/news/?pub_date_start=2008-12-31&pub_date_end=2008-01-01 Parameters:  count(optional): amount of results to return (max 50, defaults to 10)  mod_date_start(optional): ISO 8601 formatted string for the start of the modification dates to search for (only the last 7 days are available)  mod_date_end(optional): ISO 8601 formatted string for the end of the modification dates to search for  page(optional): page of results to return (defaults to 1).  pub_date_start(optional): ISO 8601 formatted string for the start of the publication dates to search for  pub_date_end(optional): ISO 8601 formatted string for the end of the publication dates to search for  section(optional): section (int id) to filter by  subsection(optional): subsection (int id) to filter by  tags(optional): a comma separated list of tags to filter by

Example output: [{ “id” : 1, “url” : “http://www.elnuevodia.com/diario/fotogaleria/1”, “title” : “REST Technology Gallery”, “intro” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “author” : “Tyler Durden”, “images” : [{ “url”: “http://elnuevodia.com/XStatic/endi/images/REST.png”, “title” : “REST Diagram”, “caption” : “REpresentational State Transfer is the architecture behind El Nuevo Día’s powerful API.”, “alt_text” : “A REpresentational State Transfer Diagram”, },{ “url”: “http://elnuevodia.com/XStatic/endi/images/42.png”, “title” : “42”, “caption” : “Answer to Life, the Universe, and Everything.”, “alt_text” : “Answer to Life, the Universe, and Everything.”, }, ], “tags” : [“rest”, “programming”, “api”, “endi”, “apex”], “pub_date” : “YYYY-MM-DD”,

}, {…}, ]

/photogalleries// Returns the photogallery with id equal to . URL: http://api.elnuevodia.com/photogalleries// Example URL(s): http://api.elnuevodia.com/photogalleries/1/ Parameters: NONE Example output: { “id” : 1, “url” : “http://www.elnuevodia.com/diario/fotogaleria/1”, “title” : “REST Technology Gallery”, “intro” : “Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nunc enim, sagittis a, pretium venenatis, faucibus placerat, nisl. Sed porta. Aliquam id felis sit amet.”, “author” : “Tyler Durden”, “images” : [{ “url”: “http://elnuevodia.com/XStatic/endi/images/REST.png”, “title” : “REST Diagram”, “caption” : “REpresentational State Transfer is the architecture behind El Nuevo Día’s powerful API.”, “alt_text” : “A REpresentational State Transfer Diagram”, },{ “url”: “http://elnuevodia.com/XStatic/endi/images/42.png”, “title” : “42”, “caption” : “Answer to Life, the Universe, and Everything.”, “alt_text” : “Answer to Life, the Universe, and Everything.”, }, ], “tags” : [“rest”, “programming”, “api”, “endi”, “apex”], “pub_date” : “YYYY-MM-DD”,

}

Horoscopes

Description

Horoscopes are a container item that has each sign’s horoscope.

Here’s an example of a horoscope as defined in JSON:

{ “sign” : “Gemini”, “horoscope” : “You’re gonna die. TWICE.” }

Methods

/horoscopes/ Returns the list of horoscopes for the current date. URL: http://api.elnuevodia.com/horoscopes/ Example URL(s): http://api.elnuevodia.com/ horoscopes /?birthdate=0000-12-21 http://api.elnuevodia.com/ horoscopes /?sign=aries http://api.elnuevodia.com/ horoscopes / Parameters:  birthdate(optional): ISO 8601 formatted string the horoscope to search, the year is ignored  sign(optional): lowercase string of the Zodiac sign to get Example output: [ … {“sign” : “Aquarius”, “horoscope” : “You’re gonna die.”}, {“sign” : “Capricorn”, “horoscope” : “You’re gonna die.”}, {“sign” : “Gemini”, “horoscope” : “You’re gonna die. TWICE.”} … ] /horoscopes/list/ Returns a detailed list of horoscopes for the current date. URL: http://api.elnuevodia.com/horoscopes/list/ Example URL(s): http://api.elnuevodia.com/horoscopes/list/ Parameters: NONE Example output: [ { "id" : 1, "sign" : "libra", "signperiod" : { "start" : "9/23", "end" : "10/22" }, "horoscope_today" : " Te cuidarás de no herir los sentimientos de otras personas.", "luckynumbers" : [ 5, 36, 1 ], "sacredword" : "unión" }, { "id" : 2, "sign" : "virgo", "signperiod" : { "start" : "8/23", "end" : "9/22" }, "horoscope_today" : "Necesitas buscar dentro de ti respuestas eso que te inquieta.", "luckynumbers" : [ 21, 7, 16 ], "sacredword" : "transformación" }, {…}]

Polls

Description

Polls currently active on the END site.

Here’s an example of a poll as defined in JSON:

{ “question” : “What Zodiac sign are you?”, “date_begin” : “2009-01-01”, “date_end” : “2009-01-12”, “total_votes” : 375, “answers” : [ { “text” : “Aries”, “votes” : 1 }, { “text” : “Aquarius”, “votes” : 2 }, { “text” : “Cancer”, “votes” : 3 }, { “text” : “Capricorn”, “votes” : 5 }, … { “text” : “Virgo”, “votes” : 144 }, ] }

Methods /polls/ Returns the list of polls sorted by date. URL: http://api.elnuevodia.com/polls/ Example URL(s): http://api.elnuevodia.com/polls/ Parameters: NONE Example output: [ { “question” : “What Zodiac sign are you?”, “date_begin” : “2009-01-01”, “date_end” : “2009-01-12”, “total_votes” : 375, “answers” : [ { “text” : “Aries”, “votes” : 1 }, { “text” : “Aquarius”, “votes” : 2 }, { “text” : “Cancer”, “votes” : 3 }, { “text” : “Capricorn”, “votes” : 5 }, … { “text” : “Virgo”, “votes” : 144 }, ] }, { “question” : “What... is the air-speed velocity of an unladen swallow?”, “date_begin” : “2009-01-01”, “date_end” : “2009-01-03”, “total_votes” : 3, “answers” : [ { “text” : “African or European swallow?”, “votes” : 1 }, { “text” : “Huh?”, “votes” : 1 }, { “text” : “Auuuuuugh”, “votes” : 1 } ] },

]

Movies

Description

Movies is an object that describes available movies in depth and all the resources related to them.

Here’s an example of a movie as defined in JSON:

[ { "id" : 80002, "title" : "Alice in Wonderland 3D", "image" : "http://cine.elnuevodia.com/images/cine/80002/80001_ab_iphone.jpg" , "actors" : [ "Johnny Depp", "Mia Wasikowska", "Helena Bonham Carter", "Anne Hathaway", "Crispin Glover" ], "director" : "Tim Burton", "producers" : [ "Richard Zanuck", "Joe Roth", "Suzanne Todd" ], "trailer" : "http://www.youtube.com/watch?v=LjMkNrX60mA", "synopsis" : "Now a teenager, Alice (Mia Wasikowska) returns to Underland, w here she must find her destiny and put an end to the Red Queen's reign of terror .", "running_time" : "109", "release_date" : "3/5/2010 12:00:00 AM", "theaters" : [ "AARKF", "AAUHG", "AARLE", "AARPY", "AARKU", "AARKK", "AARLC" , "AARKZ", "AARKR", "AARLF", "AARKJ", "AARKV", "AARKL", "AARKM", "AARKO", "AARKQ " ] } ]

Some notes:  Id: The internal id (integer) of the movie.

 actors: array of strings with the names of the actors in the movie.

 producers: array of strings with the names of the producers of the movie.

 trailer: url to the video short promoting the movie.

 synopsis: short description of the main theme for the movie.

 theaters: array of strings with the identification codes for the theaters currently showing the movie.

Methods

/movies/ Returns a list of the movies currently showing on theaters. URL: http://api.elnuevodia.com/movies/ Example URL(s): http://api.elnuevodia.com/movies/?MPAA= Parameters: NONE Example output: [ { "updated" : "2010-03-11T08:00:00.0000000-04:00" }, { "id" : 76113, "title" : "Green Zone", "image" : "http://cine.elnuevodia.com/images/cine/76113/76113_aa_iphone.jpg" , "actors" : [ "Matt Damon", "Greg Kinnear", "Brendan Gleeson", "Amy Ryan", "K halid Abdalla" ], "runningTime" : "115", "releaseDate" : "3/12/2010 12:00:00 AM", "audience_rating" : "PG" }, {…}]

/movies// Returns the movie information for the movie with an id of . URL: http://api.elnuevodia.com/movies// Example URL(s): http://api.elnuevodia.com/movies/80002/ Parameters: NONE Example output: [ { "id" : 80002, "title" : "Alice in Wonderland 3D", "image" : "http://cine.elnuevodia.com/images/cine/80002/80001_ab_iphone.jpg" , "actors" : [ "Johnny Depp", "Mia Wasikowska", "Helena Bonham Carter", "Anne Hathaway", "Crispin Glover" ], "director" : "Tim Burton", "producers" : [ "Richard Zanuck", "Joe Roth", "Suzanne Todd" ], "trailer" : "http://www.youtube.com/watch?v=LjMkNrX60mA", "synopsis" : "Now a teenager, Alice (Mia Wasikowska) returns to Underland, w here she must find her destiny and put an end to the Red Queen's reign of terror .", "running_time" : "109", "release_date" : "3/5/2010 12:00:00 AM", "theaters" : [ "AARKF", "AAUHG", "AARLE", "AARPY", "AARKU", "AARKK", "AARLC" , "AARKZ", "AARKR", "AARLF", "AARKJ", "AARKV", "AARKL", "AARKM", "AARKO", "AARKQ " ], "audience_rating" : "PG" } ]

/movies/theater// Returns a list of movies and showtimes for the specified theater id of . URL: http://api.elnuevodia.com/movies/theater// Example URL(s): http://api.elnuevodia.com/movies/theater/AARKJ/ Parameters: NONE Example output: [ { "updated" : "2010-03-11T08:00:00.0000000-04:00" }, { "id" : 80001, "title" : "Alice in Wonderland", "showtimes" : { "Lun - Vie" : "11:00AM, 1:35PM, 4:15PM, 6:55PM, 9:35PM", "Medianoche" : " 12:15AM", "Sab - Dom" : "11:00AM, 1:35PM, 4:15PM, 6:55PM, 9:35PM" } }, { "id" : 80002, "title" : "Alice in Wonderland 3D", "showtimes" : { "Lun - Vie" : "10:15AM, 10:50AM, 12:45PM, 1:25PM, 3:15PM, 4:00PM, 5:45PM, 6:40PM, 8:20PM, 9:20PM, 10:55PM", "Medianoche" : " 12:00AM", "Sab - Dom" : "10:15AM, 10:50AM, 12:45PM, 1:25PM, 3:15PM, 4:00PM, 5:45PM, 6:40PM, 8:20PM, 9:20PM, 10:55PM" } }, {…}]

/movies/showtimes// Returns a list of theaters and showtimes for the specified movie id of . URL: http://api.elnuevodia.com/movies/showtimes// Example URL(s): http://api.elnuevodia.com/movies/theater/80002/ Parameters: NONE Example output: [ { "updated" : "2010-03-11T08:00:00.0000000-04:00" }, { "theater_id" : "AARKF", "theater_name" : "Arecibo", "showtimes" : { "Lun - Vie" : "2:00PM, 4:05PM, 6:40PM, 9:15PM", "Medianoche" : " 11:50PM", "Sab - Dom" : "1:30PM, 4:05PM, 6:40PM, 9:15PM" } }, { "theater_id" : "AAUHG", "theater_name" : "Barceloneta Theater", "showtimes" : { "Lun - Vie" : "4:05PM, 6:40PM, 9:15AM", "Medianoche" : " 11:45PM", "Sab - Dom" : "1:30PM, 4:05PM, 6:40PM, 9:15PM" } }, {…}]

Climate

Description

Climate is an object that describes the climate for a location.

Here’s an example of climate as defined in JSON:

{ "updated" : "2010-03-11T13:53:23.6270000-04:00", "icon" : "18", "temperature" : "76", "legend" : "Lluvia", "high" : "81", "low" : "76", "humidity" : "93", "pressure" : "29.95", "wind" : "NE 8 MPH", "visibility" : "6", "radar" : "http://clima.elnuevodia.com/images/clima/maps/prradar.jpg", "satellite" : "http://clima.elnuevodia.com/images/clima/maps/prsat.jpg", "forecast" : [ { "day" : "viernes", "icon" : "14", "legend" : "Nubes y sol, con algún chubasco pasajero", "high" : "84", "low" : "73" }, { "day" : "sábado", "icon" : "02", "legend" : "Sol y algunas nubes", "high" : "86", "low" : "73" }, { "day" : "domingo", "icon" : "01", "legend" : "Mucho sol", "high" : "88", "low" : "75" }, { "day" : "lunes", "icon" : "01", "legend" : "Mucho sol", "high" : "90", "low" : "75" } ] }

Some notes:  updated: ISO 8601 formatted string for the date and time when the climate information was updated.  icon: number for the picture representing the climate condition. Possible values are:

Icon Number Description Flurries (AM and 19 PM) 01 Sunny Mostly Cloudy 20 with Flurries 02 Mostly Sunny Partly Sunny with 21 Flurries 03 Partly Sunny Snow (AM and 22 Intermittent PM) 04 Clouds Mostly Cloudy 23 with Snow 05 Hazy Sunshine

24 Ice (AM and PM) 06 Mostly Cloudy

25 Sleet (AM and PM) Cloudy (AM and 07 PM) Freezing Rain (AM 26 Dreary (AM and and PM) 08 PM) Icons 27, 28 have been retired Icons 9-10 have been retired Rain and Snow 29 Mixed (AM and 11 Fog (AM and PM) PM)

30 Hot (AM and PM) Showers (AM and 12 PM) 31 Cold (AM and PM) Mostly Cloudy 13 with Showers Windy (AM and 32 Partly Sunny with PM) 14 Showers Night Only ICONS Thunderstorms 15 (AM and PM) 33 Clear Mostly Cloudy 16 with Thunder 34 Mostly Clear Showers Partly Sunny with 17 35 Partly Cloudy Thunder Showers

Intermittent 18 Rain (AM and PM) 36 Clouds Partly Cloudy with 37 Hazy 41 Thunder Showers Mostly Cloudy 38 Mostly Cloudy 42 with Thunder Showers Partly Cloudy with Mostly Cloudy 39 43 Showers with Flurries

Mostly Cloudy Mostly Cloudy 40 44 with Showers with Snow

© AccuWeather, Inc. All Rights Reserved.

 station: each city in Puerto Rico has an assigned weather station. The valid choices are:

City Station_id Corozal TJCO Maricao USPR01 Adjuntas USPR01 Coto Laurel TJPS Maunabo X92 Aguada TJCP Culebra USPR03 Mayaguez TMAY Aguadilla TJBQ Dorado 06PR Mercedita TPON Aguas Buenas USPR02 Ensenada TJEN Moca TJBQ Aguirre USPR02 Fajardo 05PR Morovis USPR02 Aibonito USPR07 Florida USPR06 Naguabo 02PR Anasco TJMZ Fort Buchanan TJSJ Naranjito USPR02 Angeles USPR01 Garrochales PUAR Orocovis USPR07 Arecibo PUAR Guanica USPR04 Palmer TJLA Arroyo 01PR Guayama TJGU Patillas 01PR Bajadero 04PR Guayanilla USPR04 Penuelas X69 Barceloneta PUAR Guaynabo TJSJ Ponce TPON Barranquitas USPR07 Gurabo 07PR Puerto Real 05PR Bayamon USPR07 Hatillo 04PR Punta Santiago 02PR Boqueron TJEN Hormigueros TJMZ Quebradillas TJBQ Cabo Rojo TJMZ Humacao 02PR Rincon TJCP Caguas 07PR Isabela TJBQ Rio Blanco 02PR Camuy 04PR Jayuya USPR01 Rio Grande TJLA Canovanas 07PR Juana Diaz TJPS Roosevelt RoadsTJNR Carolina 07PR Juncos 02PR Rosario TJEN Castaner USPR01 La Plata USPR02 Sabana Grande USPR04 Catano TJSJ Lajas TJEN Sabana Hoyos PUAR Cayey USPR07 Lares USPR06 Sabana Seca 06PR Ceiba TJNR Las Marias TJMZ Saint Just 07PR Ciales 03PR Las Piedras X92 Salinas TJGU Cidra USPR07 Loiza TJLA San Antonio TJBQ Coamo USPR02 Luquillo TJLA San German USPR04 Comerio USPR02 Manati 03PR San Juan TJSJ San Lorenzo 02PR San Sebastian TJMZ Santa Isabel TJPS Toa Alta 06PR Toa Baja 06PR Trujillo Alto 07PR Utuado USPR05 Vega Alta 03PR Vega Baja 03PR Vieques TJMA Villalba USPR06 Yabucoa X92 Yauco USPR04  temperature: the number of the current temperature measured on degrees Fahrenheit.

 high: the number of the highest expected temperature measured on degrees Fahrenheit.

 low: the number of the lowest expected temperature measured on degrees Fahrenheit.

 visibility:

 radar:

 satellite:

 forecast: an array of JSON objects describing the climate for the next four days

Methods

/climate// Returns the current weather and icon number for the weather station with the station_id specified. URL: http://api.elnuevodia.com/climate// Example URL(s): http://api.elnuevodia.com/climate/TJSJ/ Parameters: NONE Example output: {"icon":"18","temperature":"76"}

/climate/detail// Returns the current weather information and the next four days forecast, for the station _id specified. URL: http://api.elnuevodia.com/climate/detail// Example URL(s): http://api.elnuevodia.com/climate/detail/TJSJ/ Parameters: NONE Example output: { "updated" : "2010-03-17T07:53:08.5330000-04:00", "icon" : "38", "temperature" : "78", "legend" : "Mayormente nublado", "high" : "82", "low" : "78", "humidity" : "84", "pressure" : "29.91", "wind" : "SE 3 MPH", "visibility" : "10", "radar" : "http://clima.elnuevodia.com/images/clima/maps/prradar.jpg", "satellite" : "http://clima.elnuevodia.com/images/clima/maps/prsat.jpg", "forecast" : [ { "day" : "jueves", "icon" : "02", "legend" : "Húmedo, con una buena cuota de sol", "high" : "88", "low" : "75" }, { "day" : "viernes", "icon" : "06", "legend" : "Sol seguido de nubes", "high" : "88", "low" : "75" }, { "day" : "sábado", "icon" : "01", "legend" : "Sol", "high" : "90", "low" : "75" }, { "day" : "domingo", "icon" : "01", "legend" : "Mucho sol y con brisa", "high" : "89", "low" : "73" } ] }

Lottery

Description

List of the most recent Lottery results for “Tradicional”, “Loto”, “Revancha”, “Pega 2” , “Pega 3” and “Pega 4” games.

Here’s an example of a lottery as defined in JSON:

{ "Tradicional" : [ { "id" : "504", "date" : "3/10/2010 12:00:00 AM", "winners" : [ "4023", "21519", "6481", "15483", "19558" ] }, { "id" : "503", "date" : "3/3/2010 12:00:00 AM", "winners" : [ "10934", "15130", "46225", "45502", "38594" ] } ] }

Methods

/lottery/ Returns the most recent Lottery results. URL: http://api.elnuevodia.com/lottery/ Example URL(s): http://api.elnuevodia.com/lottery/ Parameters: NONE Example output: [ { "Updated" : "2010-03-16T23:27:58.0000000-04:00" }, { "Tradicional" : [ { "id" : "504", "date" : "3/10/2010 12:00:00 AM", "winners" : [ "4023", "21519", "6481", "15483", "19558" ] }, { "id" : "503", "date" : "3/3/2010 12:00:00 AM", "winners" : [ "10934", "15130", "46225", "45502", "38594" ] } ] }, { "Loto" : [ { "id" : "915", "date" : "3/12/2010 12:00:00 AM", "winners" : [ "17", "20", "26", "31", "34", "40" ] }, { "id" : "914", "date" : "3/10/2010 12:00:00 AM", "winners" : [ "4", "5", "11", "35", "39", "40" ] } ] }, { "Revancha" : [ { "id" : "711", "date" : "3/12/2010 12:00:00 AM", "winners" : [ "11", "21", "35", "37", "41", "45" ] }, { "id" : "710", "date" : "3/10/2010 12:00:00 AM", "winners" : [ "8", "17", "19", "35", "37", "42" ] } ] }, { "Pega 2" : [ { "id" : "1723", "date" : "3/16/2010 12:00:00 AM", "winners" : [ "28" ] }, { "id" : "1722", "date" : "3/15/2010 12:00:00 AM", "winners" : [ "82" ] }, { "id" : "1721", "date" : "3/13/2010 12:00:00 AM", "winners" : [ "00" ] }, { "id" : "1720", "date" : "3/12/2010 12:00:00 AM", "winners" : [ "12" ] }, { "id" : "1719", "date" : "3/11/2010 12:00:00 AM", "winners" : [ "00" ] }, { "id" : "1718", "date" : "3/10/2010 12:00:00 AM", "winners" : [ "79" ] } ] }, { "Pega 3" : [ { "id" : "2194", "date" : "3/16/2010 12:00:00 AM", "winners" : [ "239" ] }, { "id" : "2193", "date" : "3/15/2010 12:00:00 AM", "winners" : [ "501" ] }, { "id" : "2192", "date" : "3/13/2010 12:00:00 AM", "winners" : [ "275" ] }, { "id" : "2191", "date" : "3/12/2010 12:00:00 AM", "winners" : [ "837" ] }, { "id" : "2190", "date" : "3/11/2010 12:00:00 AM", "winners" : [ "978" ] }, { "id" : "2189", "date" : "3/10/2010 12:00:00 AM", "winners" : [ "353" ] } ] }, { "Pega 4" : [ { "id" : "1769", "date" : "3/16/2010 12:00:00 AM", "winners" : [ "0173" ] }, { "id" : "1768", "date" : "3/15/2010 12:00:00 AM", "winners" : [ "7262" ] }, { "id" : "1767", "date" : "3/13/2010 12:00:00 AM", "winners" : [ "6275" ] }, { "id" : "1766", "date" : "3/12/2010 12:00:00 AM", "winners" : [ "9605" ] }, { "id" : "1765", "date" : "3/11/2010 12:00:00 AM", "winners" : [ "9548" ] }, { "id" : "1764", "date" : "3/10/2010 12:00:00 AM", "winners" : [ "9421" ] } ] } ]

Recommended publications