Ero sivun ”Journeys API” versioiden välillä

936 merkkiä poistettu ,  6. lokakuuta 2014 kello 01.14
Rivi 30: Rivi 30:
==Queries and Responses==
==Queries and Responses==
=== REST styled API ===
=== REST styled API ===
Journeys API follows RESTful design pattern. This means that all entities returned by the API have an unique URL via which the entity can be accessed at all times. The returned entities refer to each other via these URLs, and each entity URL is always included in the entity itself as "href" property. Following is a fragment from JOURNEY entity response:
Journeys API follows RESTful design pattern. This means that all entities returned by the API have an unique URL via which the entity can be accessed at all times. The returned entities refer to each other via these URLs, and each entity URL is always included in the entity itself as "href" property. Following is a fragment from STOP POINT entity response:
<pre>
<pre>
...
...
"body" : [
"body" : [
     {
     {
        "href" : "http://data.itsfactory.fi/journeys/api/1/journeys/111",
    "url" : "http://data.itsfactory.fi/journeys/api/1/stop-points/0001",
        "route" : "http://data.itsfactory.fi/journeys/api/1/routes/123",
    "location" : "61.49751,23.76151",
        "validFrom" : "2013-01-01",
    "name" : "Keskustori M",
        "validTo" : "2013-05-31",
    "shortName" : "0001",
        "departureTime" : "08:00:00",
    "tariffZone" : "1",
        "arrivalTime" : "08:20:00",
    "muncipality" : {
        "dayTypes" : ["Monday","Tuesday","Wednesday","Thursday","Friday"],
      "url" : "http://data.itsfactory.fi/journeys/api/1/muncipalities/837",
        "dayTypeExceptions" : [
      "shortName" : "837",
            {
      "name" : "Tampere"
                "date" : "2014-05-05",
                "runs" : "no"
            }
        ],
        "calls" : [
            {
                "arrival" : "08:00:00",
                "departure" : "08:00:00",
                "stopPoint" : {
                    "href" : "http://data.itsfactory.fi/journeys/api/1/stop-points/222"
                }
            },
            {
                "arrival" : "08:10:00",
                "departure" : "08:10:00",
                "stopPoint" : {
                    "href" : "http://data.itsfactory.fi/journeys/api/1/stop-points/223"
                }
            },
            {
                "arrival" : "08:20:00",
                "departure" : "08:20:00",
                "stopPoint" : {
                    "href" : "http://data.itsfactory.fi/journeys/api/1/stop-points/224"
                }
            }
        ]
     }
     }
  }
]
]
...
...
0

muokkausta