Ero sivun ”Journeys API” versioiden välillä

1 264 merkkiä poistettu ,  6. lokakuuta 2014 kello 01.13
Rivi 75: Rivi 75:
...
...
</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 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.
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 can make a HTTP GET request to the url to obtain more details on the object in question.
<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'''.
 
* If any entity (including nested child entities) contains href property, and no other properties, the client needs to make a HTTP GET request to the URL the href property specifies
* If any entity (including nested child entities) contains href property, and other properties, the client should not make a HTTP GET request, since Journeys API has already expanded the entity (and all its child entities) in the response. The expanded entity can however contain child entities which have only href property present; in this case, the client is expected to make HTTP GET request for that child entity.


=== API-Wide URL parameters ===
=== API-Wide URL parameters ===
0

muokkausta