21
Mirror PI Mirror introduction slideshare.net/ linkedin.com/in/ twitter.com/ google.com/+ } radeksimko

Mirror API introduction

Embed Size (px)

DESCRIPTION

Introduction to the Mirror API basics for #hack4wear at Campus London on 30th Nov 2013

Citation preview

Page 1: Mirror API introduction

Mirror PIMirrorintroduction

slideshare.net/

linkedin.com/in/

twitter.com/

google.com/+} radeksimko

Page 3: Mirror API introduction
Page 4: Mirror API introduction

How?

Page 6: Mirror API introduction

Insert a new cardPOST /mirror/v1/timeline HTTP/1.1Host: www.googleapis.comAuthorization: Bearer auth tokenContent-Type: application/jsonContent-Length: 26

{ "text": "Hello world" }

Page 7: Mirror API introduction

Card with HTMLPOST /mirror/v1/timeline HTTP/1.1Host: www.googleapis.comAuthorization: Bearer auth tokenContent-Type: application/jsonContent-Length: 26

{ "html": "<article><section><p>This <em>quotation</em>is <strong>strong</strong></p></section></article>" }

Page 8: Mirror API introduction

Updating an existing cardPUT /mirror/v1/timeline/{id} HTTP/1.1Host: www.googleapis.comAuthorization: Bearer auth tokenContent-Type: application/json

{ "text": "Hello world", "location": { ... } "menuItems": [ { "action": "NAVIGATE" } ]}

Page 9: Mirror API introduction

Updating an existing cardPATCH /mirror/v1/timeline/{id} HTTP/1.1Host: www.googleapis.comAuthorization: Bearer auth tokenContent-Type: application/json

{ "text": "Hello world" }

Page 10: Mirror API introduction

Deleting a cardDELETE /mirror/v1/timeline/{id} HTTP/1.1Host: www.googleapis.comAuthorization: Bearer auth token

Page 11: Mirror API introduction

Menu ItemsPOST /mirror/v1/timeline HTTP/1.1Host: www.googleapis.comAuthorization: Bearer auth tokenContent-Type: application/json

{ "text": "Lorem ipsum dolor sit amet.", "speakableText": "Some boring sample words", "menuItems": [ { "action": "READ_ALOUD" }, { "action": "TOGGLE_PINNED" }, ]}

Page 12: Mirror API introduction

Subscriptions APIWhen a user selects a menu item

When a user shares content with a contact

The user's location, every 10 mins

Page 13: Mirror API introduction

Subscribe to a user's locationPOST /mirror/v1/subscriptions HTTP/1.1Authorization: Bearer auth tokenContent-Type: application/jsonContent-Length: length

{ "collection": "location", "operation": [ "UPDATE" ], "callbackUrl": "https://example.com/callback"}

Page 14: Mirror API introduction

Location APIGET /mirror/v1/locations HTTP/1.1Authorization: Bearer auth tokenContent-Type: application/jsonContent-Length: length

{ "id": "latest"}

Page 15: Mirror API introduction

Insert a new contact with callbackPOST /mirror/v1/contacts HTTP/1.1Authorization: Bearer auth tokenContent-Type: application/jsonContent-Length: length

{ "id": "instagram", "displayName": "Instagram", "acceptTypes": [ "image/*" ], "imageUrls": [ "instagram.jpg" ]}

Page 16: Mirror API introduction

When user shares a picturePOST /mirror/v1/subscriptions HTTP/1.1Authorization: Bearer auth tokenContent-Type: application/jsonContent-Length: length

{ "collection": "timeline", "operation": [ "UPDATE" ], "callbackUrl": "https://example.com/callback"}

Page 17: Mirror API introduction

When user shares a picture{ "collection": "timeline", "itemId": "3hidvm0xez6r8_dacdb3103b8b604_h8rpllg", "operation": "UPDATE", "userActions": [ { "type": "SHARE" } ]}

Page 18: Mirror API introduction

When user shares a picture{ "id": "3hidvm0xez6r8_dacdb3103b8b604_h8rpllg", "attachments": [ { "contentType": "image/jpeg", "id": "<ATTACHMENT_ID>" } ], "recipients": [ { "kind": "glass#contact", "source": "api:<SERVICE_ID>", "id": "<CONTACT_ID>", "displayName": "<CONTACT_DISPLAY_NAME>", "imageUrls": [ "<CONTACT_ICON_URL>" ] } ]}

Page 19: Mirror API introduction

GuidelinesDesign for Glass

Keep it timely and relevant

Do not get in the way (CNN, Twitter, GMail)

Avoid the unexpected (time, frequency, location)

Page 20: Mirror API introduction
Page 21: Mirror API introduction

Thanks, stay in touchslideshare.net/

linkedin.com/in/

twitter.com/

google.com/+} radeksimko