3 LiveFX Cloud APIs

download 3 LiveFX Cloud APIs

of 41

Transcript of 3 LiveFX Cloud APIs

  • 8/14/2019 3 LiveFX Cloud APIs

    1/41

  • 8/14/2019 3 LiveFX Cloud APIs

    2/41

    No Problem.

  • 8/14/2019 3 LiveFX Cloud APIs

    3/41

  • 8/14/2019 3 LiveFX Cloud APIs

    4/41

  • 8/14/2019 3 LiveFX Cloud APIs

    5/41

    Development model State model Programminglanguages

    Platforms

    XML and HTTP Stateless RestfulAny programminglanguage that can workwith Restful AtomPub

    Any platform thatsupports HTTP

    avaScript Stateful avaScriptavaScript on allbrowsers and all

    Atom PublishingProtocol

    Stateless RestfulAny programminglanguage thatsupports .NET libraries

    Windows-based built

    on .NET 3.5Silverlight 2 on all thesupported browsers

    Mesh Object ModelLibraries

    StatefulAny programminglanguage thatsupports .NET libraries

    Windows-based builton .NET 3.5Silverlight 2 on all thesupported browsersand all platforms

  • 8/14/2019 3 LiveFX Cloud APIs

    6/41

    LiveOperatingEnvironment

    NewsItems

    Members

    DataFeeds

    DataEntries

    Devices NewsMeshObjects

    Contacts Profiles . . .Mesh

  • 8/14/2019 3 LiveFX Cloud APIs

    7/41

    Relative URI Optimistic Concurrency

    HTTP verbs GET

    PUT OPTIONS

    DELETE

  • 8/14/2019 3 LiveFX Cloud APIs

    8/41

    Resource URIs

    Applications /Mesh/Applications/{applicationId}/

    ApplicationInstance

    /Mesh/InstalledApplications/{installedApplicationId}/ApplicationInstances/

    Contacts /{IdentityId}/Contacts/{ContactId}

    DataEntry /Mesh/{storageServiceId}/MeshObjects/{coreObjectId}/DataFeeds/ {dataFeedDescriptorId}/

    DataFeed /Mesh/MeshObjects/{MeshObjectId}/DataFeeds/{dataFeedId}

    NewsItem /Mesh/News/{newsItemId}

    Profile /{IdentityId}/Profiles/{profileId}

  • 8/14/2019 3 LiveFX Cloud APIs

    9/41

    Retrieves the feed for the resource Common return codes

    OK Internal Server Error

    Request Headers Accept ContentLength ContentType IfModifiedSince

    Authorization Cookie

  • 8/14/2019 3 LiveFX Cloud APIs

    10/41

    GET / HTTP/1.1

    Accept: application/atom+xml

    Content-Type: application/atom+xml

    Authorization:

    dD1Fd0R3QVdyM0F3QVVja09xYW12ZEtTc1ZjK0F0QkdBYmhUSXd

    lWW1BQUJBMlhZWFpONkQ3OXMxTDBadTdjTmhyeU16RlJsWURCR3

    kzaTZWVWN5ZGw4cXU1eUgybDUzaUNVMzltSUI5WEc0TEZGNGg2c

    md2U1IrOG1EVUQxUE5oWk4rdTBUUVlmL2Vo

    Host: user-ctp.windows.net

    Connection: Keep-Alive

  • 8/14/2019 3 LiveFX Cloud APIs

    11/41

    HTTP/1.1 200 OKCache-Control: no-cache

    Pragma: no-cache

    Content-Type: application/atomsvc+xml

    Content-Location: https://user-ctp.windows.net/

    LiveFX-Request-Id: [7745a1ea-d785-4dde-87bb-b3517cb92c01::]

    Date: Mon, 20 Oct 2008 15:07:09 GMT

    Content-Length: 1216

    V0.1Meshapplication/atomsvc+xmlapplication/jsontext/xmlbinary/xmlScriptapplication/resourceScript+xmlapplication/xmltext/xmlProfilesapplication/atom+xml;type=feedapplication/jsontext/xmlbinary/xmlContactsapplication/atom+xml;type=feedapplication/jsontext/xmlbinary/xml

  • 8/14/2019 3 LiveFX Cloud APIs

    12/41

    Updates the resource Common return codes

    OK InternalServerError PreconditionFailed

    Request Headers IfMatch ContentLength ContentType

    Authorization Cookie

  • 8/14/2019 3 LiveFX Cloud APIs

    13/41

    PUT /V0.1/Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU HTTP/1.1Accept: application/atom+xml

    Content-Type: application/atom+xml

    Authorization:dD1Fd0R3QVdyM0F3QVVja09xYW12ZEtTc1ZjK0F0QkdBYmhUSXdlWW1BQUFaV2FheWNxQWRVNm53eHRCemFiOUo5NjdhV2F0QUt6eWF0WE5ydE8yeEs2TjhtYi9sS3RrY1BNMnhJZ0gwYkw1VnpHMU94TVpZMHV6K2YrZjdLbkc3ZGJHbXlFNlUzcXpSZW9MTFl3YS9hc2ErK2ZBQS9kQXFtcEE1a0lsQm5jdFl5U2IwR2NjRXIwZ2poRTFOVmkxbExBcElMTHV0aUlFb0srejZjR004c0EyWUFBQWpkR3AxNndXand6MEFCL2NkZGw0WVVWRmxNYUtzOH

    Host: user-ctp.windows.net

    Content-Length: 209

    Expect: 100-continue

    urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625

    My new folder name!

  • 8/14/2019 3 LiveFX Cloud APIs

    14/41

    HTTP/1.1 200 OK

    Cache-Control: no-cache

    Pragma: no-cache

    Transfer-Encoding: chunked

    Content-Type: application/atom+xml

    Content-Location: https://user-ctp.windows.net/V0.1/Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU

    ETag: 170690609048835

    LiveFX-Request-Id: [adf64a2a-adf2-4066-a7fe-7193da751c9a::]

    Date: Thu, 23 Oct 2008 17:22:50 GMT

    5e4

    urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625My new folder name!2008-10-17T13:00:58Z2008-10-23T17:22:50ZBen [email protected]/[email protected]

    0

  • 8/14/2019 3 LiveFX Cloud APIs

    15/41

    Deletes the resource Common return codes

    OK

    InternalServerError

    PreconditionFailed

    Request Headers IfMatch

    Authorization

    Cookie

  • 8/14/2019 3 LiveFX Cloud APIs

    16/41

    Returns information about the resource

    Authentication model Concurrency control

    Whether the resource is subscribable

    Whether the resource is extensible

    List of supported media types

    List of supported query parameters

    List of relationships for the resource

    List of supported methods (Verbs)

    XML Schema Definition (XSD) for the resource

    Common return codes OK

    InternalServerError

    PreconditionFailed

    Request Headers IfMatch

  • 8/14/2019 3 LiveFX Cloud APIs

    17/41

    OPTIONS /V0.1/Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU HTTP/1.1

    Accept: application/atom+xml

    Content-Type: application/atom+xml

    Authorization:

    dD1Fd0R3QVdyM0F3QVVja09xYW12ZEtTc1ZjK0F0QkdBYmhUSXd

    lWW1BQUJBMlhZWFpONkQ3OXMxTDBadTdjTmhyeU16RlJsWURCR3kzaTZWVWN5ZGw4cXU1eUgybDUzaUNVMzltSUI5WEc0TEZGNGg2c

    md2U1IrOG1EVUQxUE5oWk4rdTBUUVlmL2VoRGd5THQvS0JVRVZN

    M1ZkTjQvUDgwNkUwOHBvL3dKRytzRkFoMFVPTUVoTlJjUVBXQ0p

    TU09FREg5eWticmRQZ2kzY3JMM2NvSEEyWUFBQWpOM3pLcENaNE

    k3VUFCL2hSRFd2UDh6b25tdURZU2h2dGZqaVVNRVZCeTB3Q29RT

    2pacGR1ZDE3OExMSDVoUDArHost: user-ctp.windows.net

  • 8/14/2019 3 LiveFX Cloud APIs

    18/41

    HTTP/1.1 200 OK

    Cache-Control: no-cache

    Pragma: no-cache

    Transfer-Encoding: chunked

    Content-Type: text/xml

    Content-Location: https://user-ctp.windows.net/V0.1/Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU

    LiveFX-Request-Id: [b01aa71f-67b5-41ab-8933-31b184e6bd9b::]

    Date: Mon, 20 Oct 2008 15:28:06 GMT

    17ff

    Mesh/{storageServiceId}/MeshObjects/{coreObjectId}

    WindowsLiveIDAuthentication,WindowsLiveDelegatedAuth

    $expand

    $format

    json, pox, xml, atom, rss

    $callback

  • 8/14/2019 3 LiveFX Cloud APIs

    19/41

  • 8/14/2019 3 LiveFX Cloud APIs

    20/41

    No problem.

  • 8/14/2019 3 LiveFX Cloud APIs

    21/41

    Feed types available today ATOM RSSJSON

    POX

    Can you use one of those?

    I thought youcould!

  • 8/14/2019 3 LiveFX Cloud APIs

    22/41

    urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625

    My Folder!

    Live Mesh folder to synchronize and share data.

    2008-10-17T13:00:58Z

    2008-10-17T13:00:58Z

    Ben Williams

    [email protected]/Profiles

    [email protected]

  • 8/14/2019 3 LiveFX Cloud APIs

    23/41

    {

    "AuthorProfileLink" : "[email protected]/Profiles",

    "Authors" : [

    {

    "Name" : "Ben Williams",

    "Uri" : "[email protected]/Profiles",

    "Email" : "[email protected]"

    }

    ],

    "BaseUri" : "https://user-ctp.windows.net/V0.1/",

    "Categories" : [

    {

    "Label" : "MeshObject",

    "Name" : "MeshObject",

    "Scheme" : "http://user.windows.net/Resource"

    },

    {

    "Label" : "Creator",

    "Name" : "LiveDesktop"

    }

    ],

    "Id" : "urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625",

    "LastUpdatedTime" : "/Date(1224248458000)/",

    "PublishDate" : "/Date(1224248458000)/",

    "SelfLink" : "Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU",

    "Summary" : "Live Mesh folder to synchronize and share data.",

    "Title" : "My Folder!",

    "ActivitiesLink" : "Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Activities",

    "DataFeedsLink" : "Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/DataFeeds",

    "MappingsLink" : "Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Mappings",

    "MembersLink" : "Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Members",

    "NewsFeedLink" : "Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/News",

    "SubscriptionLink" : "Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Subscriptions",

    "Type" : "LiveMeshFolder"

  • 8/14/2019 3 LiveFX Cloud APIs

    24/41

    urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625

    [email protected]

    LiveMeshFolder

    MeshObject

    LiveDesktop

    My Folder!

    Live Mesh folder to synchronize and share data.

    Fri, 17 Oct 2008 13:00:58 Z

    2008-10-17T13:00:58Z

  • 8/14/2019 3 LiveFX Cloud APIs

    25/41

    [email protected]/Profiles

    Ben Williams

    [email protected]/Profiles

    [email protected]

    https://user-ctp.windows.net/V0.1/

    MeshObject

    MeshObject

    http://user.windows.net/Resource

    Creator

    LiveDesktop

    urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625

    2008-10-17T13:00:58Z

    2008-10-17T13:00:58Z

    Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU

    Live Mesh folder to synchronize and share data.

    My Folder!

    Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Activities

    Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/DataFeeds

    Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Mappings

    Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Members

    Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/News

    Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Subscriptions

    LiveMeshFolder

  • 8/14/2019 3 LiveFX Cloud APIs

    26/41

  • 8/14/2019 3 LiveFX Cloud APIs

    27/41

    No problem.

  • 8/14/2019 3 LiveFX Cloud APIs

    28/41

    Dont pull all the data down Pre-sort the data

    Use the power of the server

  • 8/14/2019 3 LiveFX Cloud APIs

    29/41

    Used only on GETs Add clauses to regular queries

    https://user.windows.net/v0.1/Moe/Mesh/MeshObjects/?$filter=(Title%20eq%20'My%20Junk')

  • 8/14/2019 3 LiveFX Cloud APIs

    30/41

    Equivalence eq, ne, gt, lt

    Boolean and, not, or

    Output Parameters orderby, skip, take, top

  • 8/14/2019 3 LiveFX Cloud APIs

    31/41

    Return the second dozen Mesh Objectsthat are folders and sort them by title

    https://user.windows.net/v1.0/Mesh/MeshObjects/?$filter=(Type%20eq%20'LiveMeshFolder')&$skip=12&

    $take=12&$orderby=Title

  • 8/14/2019 3 LiveFX Cloud APIs

    32/41

    Can I automate it?

  • 8/14/2019 3 LiveFX Cloud APIs

    33/41

    What are they?

    Small domain specific language

    Declarative way to interact with LOE

    Logical equivalent of batched procedures

    Why use them? Frees you from the lower level details of

    the HTTP protocol

    Improves efciency

    Extend the Request processing pipelinewith custom business logic

  • 8/14/2019 3 LiveFX Cloud APIs

    34/41

    Declarative modeling for

    Control Flow Statements Sequence, Interleave, Conditional, CRUD

    Data Flow Statements Bind statements

    Run locally or on the server

    Can run as triggers

    Serialized as POX or JSON

  • 8/14/2019 3 LiveFX Cloud APIs

    35/41

    SequenceStatement

    Sequentially executes child statements

    InterleaveStatement Executes child statements in parallel

    ConditionalStatement If Else execution

    CRUD statements

    Operate on resources

  • 8/14/2019 3 LiveFX Cloud APIs

    36/41

    Server Side Execution

    Script.RunAtServer(credentials)

    Single HTTP request/response

    Client Side (In Process) Execution

    Script.Run(credentials)

    Multiple HTTP requests/responses

    Each statement generates request

  • 8/14/2019 3 LiveFX Cloud APIs

    37/41

    Attach to a resource instance

    Pre and post logic on Create, Updateand Delete

    Examples:

    Create a thumbnail after an imageresource is created

    Remove a folder if the last child object isremoved

  • 8/14/2019 3 LiveFX Cloud APIs

    38/41

    Create the statement DOM Compile the DOM and generate the

    ResourceScript instance

    Execute the ResourceScript instance

    If a trigger, attach to the resource

  • 8/14/2019 3 LiveFX Cloud APIs

    39/41

  • 8/14/2019 3 LiveFX Cloud APIs

    40/41

    Understand the Resource Model

    Use standard HTTP requests

    Use the format you are comfortablewith

  • 8/14/2019 3 LiveFX Cloud APIs

    41/41