Presentation is loading. Please wait.

Presentation is loading. Please wait.

access to everything over the web

Similar presentations

Presentation on theme: "access to everything over the web"— Presentation transcript:

1 access to everything over the web
cloud services access to everything over the web Disclaimer: This document is provided “as-is”. Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. You bear the risk of using it. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes. © 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, and Windows Live are trademarks of the Microsoft group of companies. All other trademarks are property of their respective owners.

2 what it is “meta API” build on web standards
retrieve all information visible in touchdevelop app outlook: callbacks, plugins (meta apps) build on web standards HTTP, REST, JSON ✿

3 architecture front-ends Windows Identity Foundation Azure
TouchDevelop WP7 app talks with Azure Web Service (any) browser talks with Azure Web App Windows Identity Foundation allows users to authenticate with Windows Live ID, Facebook Azure web site talks with Azure Web Service web service controls Azure Storage storage (public data) storage (private data)

4 Windows Identity Foundation
Azure Storage (public) Azure Storage (private) Azure Web Service Azure Web Site Windows Identity Foundation WP7 devices with TouchDevelop app web browser

5 HTTP HyperText Transfer Protocol
the protocol used by the World Wide Web

6 HTTP example Request Headers Response Headers
GET HTTP/1.1 Host: Cache-Control: max-age=0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Encoding: gzip,deflate,sdch Response Headers HTTP/ OK Content-Length: 451 Expires: -1 Date: Fri, 10 Feb :51:48 GMT Content-Type: application/json; charset=utf-8 Cache-Control: no-cache, no-store Pragma: no-cache

7 REST REST (Representational State Transfer) is a lightweight alternative to mechanisms like RPC (Remote Procedure Calls) and Web Services (SOAP, WSDL, et al.). RESTful applications use HTTP requests to post data (create and/or update), read data (e.g., make queries), and delete data. Thus, REST uses HTTP for all four CRUD (Create/Read/Update/Delete) operations.

8 REST here Currently, only supported verb is ‘GET’
All accesses are stateless

9 JSON JSON (JavaScript Object Notation) is a lightweight data-interchange format. two building blocks: a collection of name/value pairs (“object”, “record”, …) an ordered list of values (“array”, …)

10 JSON grammar json: string | number | boolean | array | object string/number/boolean follow grammar of corresponding JavaScript literals array: “[“ [json (“,” comma)*] “]” field: string “:” json object: “[“ field [(“,” field)*] “]” example [ “elem0”, 1, { “x” : “value of field x”, “y” : 42 }, false ]

11 JSON example GET HTTP/1.1
{ "kind":"script", "time": , "id":"ezdf", "url":"", "name":"Smart Rail Table", "description":"", "userid":"yvfc", "username":"Sascha M. B.", "icon":"directions", "iconbackground":"#008000", "iconurl":"", "positivereviews":0, "comments":0, …

12 JSON example … "capabilities":[
{"name":"sourcegeolocation","iconurl":""}, {"name":"sinkweb","iconurl":""} ], "flows":[], "haserrors":false, "rootid":"dgig", "updateid":"ezdf", "ishidden":false, "islibrary":false, "installations":0, "runs":0 }

13 main lists /api/new-scripts /api/top-scripts /api/featured-scripts
/api/search?text=[text] /api/users /api/comments /api/screenshots /api/reviews optional list parameters: ?count=[number]&continuation=[token]

14 publication properties
/api/[id] /api/[scriptid]/text /api/[scriptid]/ast /api/[scriptid]/successors /api/[scriptid]/base /api/[userid]/scripts /api/[scriptid or userid or commentid]/comments /api/[scriptid or userid]/screenshots /api/[commentid or scriptid or userid]/reviews /api/[userid]/picture

15 apis: json Web→download json Downloads a web service response as a JSON data structure Json Object→kind Gets a json kind (string, number, boolean, object, array) string: Json Object→to string number: Json Object→to number boolean: Json Object→to boolean object: Json Object→keys, Json Object→field array: Json Object→at, Json Object→count

16 exercise ► in touchdevelop, write code that…
Posts the names of new scripts Posts links to the urls of new scripts ► in touchdevelop, write code that figures out… of the (around) 100 new scripts, which have at least one ♥ ? ☁ (solution)

17 homework ► in your favorite language, write code that figures out…
how many scripts are there? how many AST nodes does the biggest script have? which script got the most ♥ ? which user gave the most ♥ ? what is the longest script (number of lines)? which script got updated the most?

18 title item 1 Item 2 ☀ anecdote song→post to wall
☁ (link to sample) ► an exercise ✿ a reference

Download ppt "access to everything over the web"

Similar presentations

Ads by Google