2 what it is “meta API” build on web standards retrieve all information visible in touchdevelop appoutlook: callbacks, plugins (meta apps)build on web standardsHTTP, REST, JSON✿ touchdevelop.com/help/cloudservices
3 architecture front-ends Windows Identity Foundation Azure TouchDevelop WP7 app talks with Azure Web Service(any) browser talks with Azure Web AppWindows Identity Foundationallows users to authenticate with Windows Live ID, FacebookAzureweb site talks with Azure Web Serviceweb service controls Azure Storagestorage (public data)storage (private data)
4 Windows Identity Foundation AzureStorage (public)AzureStorage (private)AzureWeb ServiceAzureWeb SiteWindows Identity FoundationWP7 devices withTouchDevelop appweb browser
5 HTTP HyperText Transfer Protocol the protocol used by the World Wide Web
6 HTTP example Request Headers Response Headers GET HTTP/1.1Host:Cache-Control: max-age=0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Encoding: gzip,deflate,sdchResponse HeadersHTTP/ OKContent-Length: 451Expires: -1 Date: Fri, 10 Feb :51:48 GMTContent-Type: application/json; charset=utf-8Cache-Control: no-cache, no-storePragma: no-cache
7 RESTREST (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
13 main lists /api/new-scripts /api/top-scripts /api/featured-scripts /api/search?text=[text]/api/users/api/comments/api/screenshots/api/reviewsoptional 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: jsonWeb→download json Downloads a web service response as a JSON data structureJson Object→kind Gets a json kind (string, number, boolean, object, array)string: Json Object→to stringnumber: Json Object→to numberboolean: Json Object→to booleanobject: Json Object→keys, Json Object→fieldarray: Json Object→at, Json Object→count
16 exercise ► in touchdevelop, write code that… Posts the names of new scriptsPosts 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