3 Livefx Cloud Apis

  • Uploaded by: Sivadon Chaisiri
  • 0
  • 0
  • December 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View 3 Livefx Cloud Apis as PDF for free.

More details

  • Words: 1,601
  • Pages: 41
Live Services Synchronizing Life

Live fx Cloud APIs

Live Services Synchronizing Life

No Problem.

But I don’t use .NET!

How about these?

Live Services Synchronizing Life

Live Framework

Live Services Synchronizing Life

Libraries .NET FX 3.5 APIs

Silverlight APIs

JavaScript APIs

Client Controls

Web Controls

Tools & Services



Resource Model ATOM AtomPub

JSON

POX

RSS

Binary XML

Developer Portal

FeedSync

CRUD

Sync

URI-LINQ

Resource Scripts

Data

Core

Triggers

Device Mesh Applications

Folders

News

Photos

Favorites

Contacts

Lists

Profile

Calendar

Hosting

Introspectio n

Communications

App Model

P2P

Catalog

Notifications

Hosting

Presence

Mesh Applications

User Mesh

Identity

Auth/Z

App Data & Settings Application Management

System

Provisioning / Account Management

Visual Studio Tools / Designers

Mapping Search

Live Operating Environment

Analytics

CRUD

Sync

App Hosting

CRUD

Sync

Hosting

Resource Script Engine

Auth/Z

Analytics

Resource Script Engine

Auth/Z

Local Store



P2P

File Sys



Cache

Windows “Strata”

Developer Sandbox

Client

Cloud Windows

Embedded

Windows Mobile

Other

Programming Models

Live Services Synchronizing Life

State model

Programming languages

XML and HTTP

Stateless Restful

Any programming Any platform that language that can work supports HTTP with Restful AtomPub

JavaScript

Stateful

JavaScript

Atom Publishing Protocol

Stateless Restful

Development model

Mesh Object Model Libraries

Stateful

Platforms

JavaScript on all browsers and all platforms Windows-based built Any programming on .NET 3.5 language that Silverlight 2 on all the supports .NET libraries supported browsers Windows-based built Any programming on .NET 3.5 language that Silverlight 2 on all the supports .NET libraries supported browsers and all platforms

Live Framework .NET Kit

Live Services Synchronizing Life

LiveOperatingEnvironment

Mesh

MeshObjects

Devices

NewsItems Members DataFeeds DataEntries

Contacts

News

Profiles

...

Resource Access • Relative URI • Optimistic Concurrency • HTTP verbs – GET – PUT – OPTIONS – DELETE

Live Services Synchronizing Life

Resource Access Points Resource

URIs

Applications

/Mesh/Applications/{applicationId}/

Application Instance

/Mesh/InstalledApplications/ {installedApplicationId}/ApplicationInstances/ {applicationInstanceId} /{IdentityId}/Contacts/{ContactId}

Contacts DataEntry

Live Services Synchronizing Life

DataFeed

/Mesh/{storageServiceId}/MeshObjects/ {coreObjectId}/DataFeeds/ {dataFeedDescriptorId}/ Entries/{dataEntryId} /Mesh/MeshObjects/{MeshObjectId}/DataFeeds/

NewsItem

/Mesh/News/{newsItemId}

Profile

/{IdentityId}/Profiles/{profileId}

{dataFeedId}

GET a resource • Retrieves the feed for the resource • Common return codes – OK – Internal Server Error

• Request Headers – – – – – –

Accept ContentLength ContentType IfModifiedSince Authorization Cookie

Live Services Synchronizing Life

GET Request

Live Services Synchronizing Life

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

GET Response

Live Services Synchronizing Life

HTTP/1.1 200 OK Cache-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 <service xmlns:atom="http://www.w3.org/2005/Atom" xml:base="https://user-ctp.windows.net/V0.1/" xmlns="http://www.w3.org/2007/ app"><workspace>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

PUT a resource • Updates the resource • Common return codes – OK – InternalServerError – PreconditionFailed

• Request Headers – – – – –

IfMatch ContentLength ContentType Authorization Cookie

Live Services Synchronizing Life

PUT Request

Live Services Synchronizing Life

PUT /V0.1/Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU HTTP/1.1 Accept: application/atom+xml Content-Type: application/atom+xml Authorization: dD1Fd0R3QVdyM0F3QVVja09xYW12ZEtTc1ZjK0F0QkdBYmhUSXdlWW1BQUFaV2FheWNxQWRVN m53eHRCemFiOUo5NjdhV2F0QUt6eWF0WE5ydE8yeEs2TjhtYi9sS3RrY1BNMnhJZ0gwYkw1Vn pHMU94TVpZMHV6K2YrZjdLbkc3ZGJHbXlFNlUzcXpSZW9MTFl3YS9hc2ErK2ZBQS9kQXFtcEE 1a0lsQm5jdFl5U2IwR2NjRXIwZ2poRTFOVmkxbExBcElMTHV0aUlFb0srejZjR004c0EyWUFB QWpkR3AxNndXand6MEFCL2NkZGw0WVVWRmxNYUtzOH Host: user-ctp.windows.net Content-Length: 209 Expect: 100-continue <entry xml:base="https://user-ctp.windows.net/V0.1/" xmlns="http:// www.w3.org/2005/Atom"> urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625 My new folder name!

PUT Response

Live Services Synchronizing Life

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 <entry xml:base="https://user-ctp.windows.net/V0.1/" xmlns="http://www.w3.org/2005/Atom">urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625My new folder name!2008-10-17T13:00:58Z2008-10-23T17:22:50ZBen Williams[email protected]/Profiles<email>[email protected] 0

DELETE a resource • Deletes the resource • Common return codes – OK – InternalServerError – PreconditionFailed

• Request Headers – IfMatch – Authorization – Cookie

Live Services Synchronizing Life

OPTIONS for a resource •

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

Live Services Synchronizing Life

OPTIONS Request

Live Services Synchronizing Life

OPTIONS /V0.1/Mesh/MeshObjects/ Q743YJVSRIWEZP476W2G4KCWEU HTTP/1.1 Accept: application/atom+xml Content-Type: application/atom+xml Authorization: dD1Fd0R3QVdyM0F3QVVja09xYW12ZEtTc1ZjK0F0QkdBYmhUSXd lWW1BQUJBMlhZWFpONkQ3OXMxTDBadTdjTmhyeU16RlJsWURCR3 kzaTZWVWN5ZGw4cXU1eUgybDUzaUNVMzltSUI5WEc0TEZGNGg2c md2U1IrOG1EVUQxUE5oWk4rdTBUUVlmL2VoRGd5THQvS0JVRVZN M1ZkTjQvUDgwNkUwOHBvL3dKRytzRkFoMFVPTUVoTlJjUVBXQ0p TU09FREg5eWticmRQZ2kzY3JMM2NvSEEyWUFBQWpOM3pLcENaNE k3VUFCL2hSRFd2UDh6b25tdURZU2h2dGZqaVVNRVZCeTB3Q29RT 2pacGR1ZDE3OExMSDVoUDArHost: user-ctp.windows.net

OPTIONS Response

Live Services Synchronizing Life

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 <name of the link relationship> $format json, pox, xml, atom, rss $callback

Demo

Live Services Synchronizing Life

The Resource Browser is your friend!

Live Services Synchronizing Life

No problem.

But I don’t know ATOM!

Multiple Formats

Live Services Synchronizing Life

• Feed types available today – – – –

ATOM RSS JSON POX

Can you use one of those?

I thought you could!

ATOM

Live Services Synchronizing Life

<entry xml:base="https://user-ctp.windows.net/V0.1/" xmlns="http://www.w3.org/2005/Atom"> urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625 My Folder! <summary type="text">Live Mesh folder to synchronize and share data. 2008-10-17T13:00:58Z 2008-10-17T13:00:58Z Ben Williams [email protected]/Profiles <email>[email protected]

JSON { "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"

Live Services Synchronizing Life

RSS

Live Services Synchronizing Life

urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625 [email protected] LiveMeshFolder MeshObject LiveDesktop My Folder! <description>Live Mesh folder to synchronize and share data. Fri, 17 Oct 2008 13:00:58 Z 2008-10-17T13:00:58Z

POX <MeshObject xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://user.windows.net"> [email protected]/Profiles Ben Williams [email protected]/Profiles <Email>[email protected] https://user-ctp.windows.net/V0.1/ MeshObject <Scheme>http://user.windows.net/Resource LiveDesktop urn:uuid:26bcf987-8ab2-4c2c-bf9f-f5b46e285625 2008-10-17T13:00:58Z 2008-10-17T13:00:58Z <SelfLink>Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU <Summary>Live Mesh folder to synchronize and share data. <Title>My Folder! Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Activities Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/DataFeeds <MappingsLink>Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Mappings <MembersLink>Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Members Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/News <SubscriptionLink>Mesh/MeshObjects/Q743YJVSRIWEZP476W2G4KCWEU/Subscriptions LiveMeshFolder

Live Services Synchronizing Life

Demo

Live Services Synchronizing Life

Resource Browser, still your friend!

Live Services Synchronizing Life

No problem.

But I have a lot of data!

Sorting & Filtering • Don’t pull all the data down • Pre-sort the data • Use the power of the server

Live Services Synchronizing Life

Filter Queries

Live Services Synchronizing Life

• Used only on GETs • Add clauses to regular queries https://user.windows.net/v0.1/Moe/Mesh/MeshObjects/? $filter=(Title%20eq%20'My%20Junk')

Filter Query Operators • Equivalence – eq, ne, gt, lt

• Boolean – and, not, or

• Output Parameters – orderby, skip, take, top

Live Services Synchronizing Life

Filter Query Example

Live Services Synchronizing Life

Return the second dozen Mesh Objects that 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

Live Services Synchronizing Life

Can I automate it?

Resource Scripts

Resource Scripts

Live Services Synchronizing Life

• 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 efficiency – Extend the Request processing pipeline with custom business logic

Resource Scripts • 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

Live Services Synchronizing Life

Statements • SequenceStatement – Sequentially executes child statements

• InterleaveStatement – Executes child statements in parallel

• ConditionalStatement – If … Else … execution

• CRUD statements – Operate on resources

Live Services Synchronizing Life

Client vs Server • 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

Live Services Synchronizing Life

Triggers

Live Services Synchronizing Life

• Attach to a resource instance • Pre and post logic on Create, Update and Delete Examples: – Create a thumbnail after an image resource is created – Remove a folder if the last child object is removed

Authoring and Running • Create the statement DOM • Compile the DOM and generate the ResourceScript instance • Execute the ResourceScript instance • If a trigger, attach to the resource

Live Services Synchronizing Life

Demo

Live Services Synchronizing Life

Resource Script Sample

To use the cloud API • Understand the Resource Model • Use standard HTTP requests • Use the format you are comfortable with

Live Services Synchronizing Life

Questions?

Live Services Synchronizing Life

Related Documents

3 Livefx Cloud Apis
November 2019 15
Web Apis & Google Apis
June 2020 11
Cloud
June 2020 24
Cloud
November 2019 27
Apis Bluetooth
May 2020 5

More Documents from "Sergio Pino"