Más contenido relacionado
120305 intro-rest
- 4. REST ist eine Architektur
HTTP ist eine konkrete
Implementierung davon
- 6. Repräsentationen
{ „account“ : {
„id“ : 4582,
„firstName“ : „Singh“,
„lastName“ : „Darshan“,
„balance“ : 25382.20,
„openDate“ : „2002-02-20“ }
}
<?xml version=“1.0“?>
<account>
<id>4582</id>
<firstName>Singh</firstName>
<lastName>Darshan</lastName>
<balance>25382.20</balance>
<openDate>2002-02-20</openDate>
</account>
- 10. Hypermedia
Person
Transfer Person
Account
Statement
Balance
- 11. Zustandslose Kommunikation
Keine Sessions
Keine Cookies
Jede Anfrage enthält alle Informationen, die der
Server für die Verarbeitung benötigt.
- 16. Vermischung Ressource
und Repräsentation
GET /accounts/4982.json?apikey=912864
GET /accounts/4982
Accept: application/json
X-apikey: 912864
- 17. Keine Links
{ „account“ :
{
„id“ : 4582,
„firstName“ : „Singh“,
„lastName“ : „Darshan“,
„balance“ : 25382.20,
„openDate“ : „2002-02-20“
}
}
- 18. Nur interne IDs
{ „account“ :
{
„id“ : 4582,
„owner“ : 56120,
„balance“ : 25382.20,
„openDate“ : „2002-02-20“
}
}
- 19. Keine Links zu
Sub-Ressourcen
{ „account“ :
{
„id“ : 4582,
„owner“ : „http//www.mybank.com/clients/561202“,
„balance“ : 25382.20,
„openDate“ : „2002-02-20“
}
}
- 20. Korrekt:
{ „account“ :
{
„id“ : 4582,
„owner“ : „http//www.mybank.com/clients/561202“,
„statements“ : „http://www.mybank.com/accounts/
4582/statements“,
„transfers“ : „http://www.mybank.com/accounts/
4582/transfers“,
„balance“ : 25382.20,
„openDate“ : „2002-02-20“
}
}
- 21. HTTP Status Codes
GET /accounts/4982
HTTP/1.1 200 OK
Content-Type: application/json
{ „error:
{ „code“ : 491,
„message“ : „Not authorized“ } }