no app is an island
play

NO APP IS AN ISLAND Stewart Gleadow @stewgleadow - PowerPoint PPT Presentation

NO APP IS AN ISLAND Stewart Gleadow @stewgleadow stew@rea-group.com http://www.flickr.com/photos/markselliott/48699538/ Mobile APIs: More than just object.to_json Stewart Gleadow @stewgleadow stew@rea-group.com


  1. NO APP IS AN ISLAND Stewart Gleadow @stewgleadow stew@rea-group.com http://www.flickr.com/photos/markselliott/48699538/

  2. Mobile APIs: More than just object.to_json Stewart Gleadow @stewgleadow stew@rea-group.com http://www.flickr.com/photos/markselliott/48699538/

  3. NO APP IS AN ISLAND Stewart Gleadow @stewgleadow stew@rea-group.com http://www.flickr.com/photos/markselliott/48699538/

  4. ›❰ Mobile APIs and REST ›❰ Discoverable iOS APIs ›❰ Evolvin g APIs and mobile apps ›❰ Simple apps, smart backends

  5. ›❰ Mobile APIs and REST ›❰ Discoverable iOS APIs ›❰ Evolvin g APIs and mobile apps ›❰ Simple apps, smart backends

  6. Is there an API for that? Can I see your API?

  7. POST /InStock HTTP/1.1 Host: www.example.org Content-Type: application/soap+xml; charset=utf-8 Content-Length: 299 SOAPAction: "http://www.w3.org/2003/05/soap-envelope" <?xml version="1.0"?> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"> <soap:Header> </soap:Header> <soap:Body> <m:GetStockPrice xmlns:m="http://www.example.org/stock"> <m:StockName>IBM</m:StockName> </m:GetStockPrice> </soap:Body> </soap:Envelope>

  8. We have a REST API , just construct one of these “RESTful calls”

  9. THAT’S NOT AN API http://schmidtbrotherscutlery.com/blo g /ta g /crocodile-dundee/ http://www.flickr.com/photos/juan-alo g ico/10935384913/

  10. THAT’S NOT AN API http://schmidtbrotherscutlery.com/blo g /ta g /crocodile-dundee/ http://www.flickr.com/photos/juan-alo g ico/10935384913/

  11. How should we build our API ?

  12. Level 0 Level 1 Level 2 Level 3

  13. Level 0 The swamp of POX Level 1 Level 2 Level 3

  14. Level 0 The swamp of POX Level 1 URIs and Resources Level 2 Level 3

  15. Level 0 The swamp of POX Level 1 URIs and Resources Level 2 HTTP verbs and status codes Level 3

  16. Level 0 The swamp of POX Level 1 URIs and Resources Level 2 HTTP verbs and status codes Level 3 Hypermedia controls

  17. Roy Fieldin g - http://roy. g biv.com/untan g led/2008/rest-apis-must-be-hypertext-driven

  18. “What needs to be done to make the REST architectural style clear on the notion that hypertext is a constraint ?” Roy Fieldin g - http://roy. g biv.com/untan g led/2008/rest-apis-must-be-hypertext-driven

  19. “What needs to be done to make the REST architectural style clear on the notion that hypertext is a constraint ?” “Is there some broken manual somewhere that needs to be fixed ?” Roy Fieldin g - http://roy. g biv.com/untan g led/2008/rest-apis-must-be-hypertext-driven

  20. “What needs to be done to make the REST architectural style clear on the notion that hypertext is a constraint ?” “Is there some broken manual somewhere that needs to be fixed ?” “Please try to adhere to them or choose some other buzzword for your API. ” Roy Fieldin g - http://roy. g biv.com/untan g led/2008/rest-apis-must-be-hypertext-driven

  21. This g uy is possibly an island… http://www.flickr.com/photos/50144889@N08/8711099493/

  22. ›❰ Mobile APIs and REST ›❰ Discoverable iOS APIs ›❰ Evolvin g APIs and mobile apps ›❰ Simple apps, smart backends

  23. Navi g atin g your API http://www.flickr.com/photos/calsidyrose/4925267732/

  24. Navi g atin g your API The location of service endpoints chan g e Paths to resources within a service chan g e http://www.flickr.com/photos/calsidyrose/4925267732/

  25. HAL JSON : Standardized hypermedia links in JSON

  26. Example: Sign in and retrieve user details

  27. Sign in response Sign in request POST “http://example.com/session” HTTP/1.1 201 Created { { email : "dundee", user_id : “c3Rld0ByZWEtZ3Jvd” password : "password" } }

  28. Sign in response Sign in request POST “http://example.com/session” HTTP/1.1 201 Created { { email : "dundee", user_id : “c3Rld0ByZWEtZ3Jvd” password : "password" } } Which actions are available now? Where do I perform those actions?

  29. Sign in response Sign in request POST “http://example.com/session” HTTP/1.1 201 Created { { email : "dundee", user_id : “c3Rld0ByZWEtZ3Jvd” password : "password" } } Which actions are available now? Where do I perform those actions?

  30. Sign in & get details from an iOS client NSDictionary *params = @{ @"email" : @"dundee", @"password" : @"password" }; self.manager = [AFHTTPRequestOperationManager manager]; [self.manager POST:@"http://example.com/session" parameters:params success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.userId = response[@"user_id"]; } failure:nil];

  31. Sign in & get details from an iOS client NSDictionary *params = @{ @"email" : @"dundee", @"password" : @"password" }; self.manager = [AFHTTPRequestOperationManager manager]; [self.manager POST:@"http://example.com/session" parameters:params success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.userId = response[@"user_id"]; } failure:nil]; NSString *detailsUrl = [NSString stringWithFormat:@"http://example.com/details?id=%@", self.userId]; [self.manager GET:detailsUrl parameters:nil success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.name.text = response[@"name"]; self.phone.text = response[@"phone"]; } failure:nil];

  32. Sign in & get details from an iOS client NSDictionary *params = @{ @"email" : @"dundee", @"password" : @"password" }; self.manager = [AFHTTPRequestOperationManager manager]; [self.manager POST:@"http://example.com/session" parameters:params success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.userId = response[@"user_id"]; } failure:nil]; NSString *detailsUrl = [NSString stringWithFormat:@"http://example.com/details?id=%@", self.userId]; [self.manager GET:detailsUrl parameters:nil success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.name.text = response[@"name"]; self.phone.text = response[@"phone"]; } failure:nil];

  33. Sign in & get details from an iOS client NSDictionary *params = @{ @"email" : @"dundee", @"password" : @"password" }; self.manager = [AFHTTPRequestOperationManager manager]; [self.manager POST:@"http://example.com/session" parameters:params success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.userId = response[@"user_id"]; } failure:nil]; NSString *detailsUrl = [NSString stringWithFormat:@"http://example.com/details?id=%@", self.userId]; [self.manager GET:detailsUrl parameters:nil success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.name.text = response[@"name"]; self.phone.text = response[@"phone"]; } failure:nil];

  34. Sign in & get details from an iOS client NSDictionary *params = @{ @"email" : @"dundee", @"password" : @"password" }; self.manager = [AFHTTPRequestOperationManager manager]; [self.manager POST:@"http://example.com/session" parameters:params success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.userId = response[@"user_id"]; } failure:nil]; NSString *detailsUrl = [NSString stringWithFormat:@"http://example.com/details?id=%@", self.userId]; [self.manager GET:detailsUrl parameters:nil success:^(AFHTTPRequestOperation *op, NSDictionary *response) { self.name.text = response[@"name"]; self.phone.text = response[@"phone"]; } failure:nil];

  35. Response HTTP/1.1 201 Created { user_id : “c3Rld0ByZWEtZ3Jvd”, _links : { details : { href : “http://example.com/users/c3Rld0ByZWEtZ3Jvd/details” } } }

  36. Response HTTP/1.1 201 Created { user_id : “c3Rld0ByZWEtZ3Jvd”, _links : { details : { href : “http://example.com/users/c3Rld0ByZWEtZ3Jvd/details” } } } Which actions are available now? Where do I perform those actions?

  37. Response HTTP/1.1 201 Created { user_id : “c3Rld0ByZWEtZ3Jvd”, _links : { details : { href : “http://example.com/users/c3Rld0ByZWEtZ3Jvd/details” } } } Which actions are available now? Where do I perform those actions?

  38. Response HTTP/1.1 201 Created { user_id : “c3Rld0ByZWEtZ3Jvd”, _links : { details : { href : “http://example.com/users/c3Rld0ByZWEtZ3Jvd/details” } } } Which actions are available now? Where do I perform those actions?

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend