Ero sivun ”Journeys API” versioiden välillä

720 merkkiä lisätty ,  5. heinäkuuta 2014 kello 04.04
Rivi 30: Rivi 30:
...
...
     "data" : {
     "data" : {
         "href" : "http://example.com/journeys/api/journeys/111",
         "journeys" : [
        "departureTime" : "08:00:00+0300",
        "dayTypes" : [
             {
             {
                 "href" : "http://example.com/journeys/api/day-types/weekdays"
                 "href" : "http://example.com/journeys/api/journeys/111",
            }
                 "route" : "http://example.com/journeys/api/routes/123",
        ],
                "validFrom" : "2013-01-01",
        "dayTypeExceptions" : [
                "validTo" : "2013-05-31",
            {
                "departureTime" : "08:00:00+0300",
                 "href" : "http://example.com/journeys/api/day-type-exceptions/111",
                "dayTypes" : ["Monday","Tuesday","Wednesday","Thursday","Friday"],
                 "date" : "2014-05-05",
                 "dayTypeExceptions" : [
                "runs" : "no"
                    {
            }
                        "date" : "2014-05-05",
        ],
                        "runs" : "no"
        "calls" : [
                    }
            {
                ],
                "href" : "http://example.com/journeys/api/calls/1123",
                "calls" : [
                "arrival" : "08:00:00+0300",
                    {
                "departure" : "08:00:00+0300",
                        "arrival" : "08:00:00+0300",
                "stopPoint" : {
                        "departure" : "08:00:00+0300",
                    "href" : "http://example.com/journeys/api/stop-points/222"
                        "stopPoint" : {
                 }
                            "href" : "http://example.com/journeys/api/stop-points/222"
                        }
                    },
                    {
                        "arrival" : "08:10:00+0300",
                        "departure" : "08:10:00+0300",
                        "stopPoint" : {
                            "href" : "http://example.com/journeys/api/stop-points/223"
                        }
                    },
                    {
                        "arrival" : "08:20:00+0300",
                        "departure" : "08:20:00+0300",
                        "stopPoint" : {
                            "href" : "http://example.com/journeys/api/stop-points/224"
                        }
                    }
                 ]
             }
             }
        ]
...
...
</pre>
</pre>
The JOURNEY itself has a href property (http://example.com/journeys/api/journeys/111) which points to the JOURNEY entity itself. A client can use this URL access this entity at any time. The dayType entity has also an href property which tells the client how to access the DAY TYPE data. Whenever a client encounters a href property in the response, the client should make a HTTP GET request to that url in order to access the entity data. The client the can "attach" the returned data to the original response. Depending on the request, the Journeys API might "expand" a entity in a response. For example, a DAY TYPE EXCEPTION element in the response above contains '''both''' href property as well as "date" and "runs" properties. This means that the client does not need to make a request to the href URL in order to access the entity data. Instead, the Journeys API has already included the full data of the entity into the request.
The JOURNEY itself has a href property (http://example.com/journeys/api/journeys/111) which points to the JOURNEY entity itself. A client can use this URL access this entity at any time. The stopPoint entity has also an href property which tells the client how to access the DAY TYPE data. Whenever a client encounters a href property in the response, the client should make a HTTP GET request to that url in order to access the entity data. The client the can "attach" the returned data to the original response. Depending on the request, the Journeys API might "expand" a entity in a response. An expanded entity has still the href property, but is accompanied by other properties too. This means that the client does not need to make a request to the href URL in order to access the entity data. Instead, the Journeys API has already included the full data of the entity into the request.
<br><br>
<br><br>
There are no rules when the Journeys API will expand an element (even though typically first level children of an element are typically expanded). Therefore, the client must follow these rules '''at all times'''.
There are no rules when the Journeys API will expand an element (even though typically first level children of an element are typically expanded). Therefore, the client must follow these rules '''at all times'''.
0

muokkausta