• Aucun résultat trouvé

API Blender

N/A
N/A
Protected

Academic year: 2022

Partager "API Blender"

Copied!
35
0
0

Texte intégral

(1)

1

API Blender

A Uniform Interface to Social Platform APIs

{georges.gouriten, pierre.senellart}

@telecom-paristech.fr

(2)

Outline

Interacting with social platforms ...

is usually painful, ...

but API Blender makes it easy!

(3)

3

Authenticate Make

request

Parse response

Process response

Generic interactions with a Web API

(4)

Authenticate Make request

Parse response

Process response

Generic interactions with a Web API

Maintain

authentication

Respect policy

(5)

5

(6)
(7)

7

(8)
(9)

9

Heterogeneous Sometimes obscure

Error-prone

(10)

Authenticate Make request

Parse response

Process response

Generic interaction with a Web service

Ensure

authentication

Respect policy

(11)

11

Home-made development

What most people do

Redundant efforts

(12)

What about collective efforts?

Top-down WSDL WADL

Bottom-up

Spring Social SPORE-DL

Error 404

Promising direction

(13)

13

API Blender

Social Web APIs description files Python implementation

(14)

API Blender

Social Web APIs description files Python implementation

(15)

15

Lightweight social Web API description format {

“name”: "twitter-search",

“host”: "search.twitter.com", “port”: 80,

“authentication”: authentication_object, “policy”: policy_object,

“interactions”: [interaction_object]

}

(16)

Simple Authentication

{

“type”: “simple”,

“path”: “/oauth/access_token”, “parameters”: {

“client_id”: “x2836”,

“client_secret”: “z45725”,

“grant_type”: “client_credentials”

}

(17)

17

Oauth Authentication

{

“type”: “oauth”,

“consumer_key”: “x4565482s”,

“consumer_secret”: “tsouintsouin”,

“request_token_url”: “https://api.twitt...”, “access_token_url”: “https://api.twitt...”, “authorize_url”: “https://api.twitt...”

}

(18)

Policy

{

“active”: true,

“requests_per_hour”: 400,

“too_many_calls_response_code”: 420, “too_many_calls_waiting_seconds”: 600 }

(19)

19

Interaction

{ “name”: “search”,

“description”: “search for tweets”,

“request”: {

“url_root_path”: “/search.json”,

“method”: “GET”,

“url_params”: [

[ “q”, “string”, false, null ], [ “rpp”, “int”, true, 100 ], }, ]

“response”: {

“expected_status_code”: 200,

“serialization_format”: “JSON”,

“extractor”: extractor_object } }

(20)

Extractor

{ “data.field1”: “mydata.there.fieldx”,

“data.field2”: “mydata.there.fieldy”

}

(21)

21

“data”: {

“field1”: <field1_value>,

“field2”: <field2_value>

}

“mydata”: {

“there”: {

“fieldx”: <field1_value>

“fieldy”: <field2_value>

} }

{ “data.field1”: “mydata.there.fieldx”,

“data.field2”: “mydata.there.fieldy” }

(22)

“results”: {

“from_user”: ...

}

“posts”: {

“user_name”: ...

“data”: {

“from”: {

“name”: ...

} }

(23)

23

Lightweight social Web API description format {

“name”: "twitter-search",

“host”: "search.twitter.com", “port”: 80,

“authentication”: authentication_object, “policy”: policy_object,

“interactions”: [interaction_object]

}

(24)

API Blender

Social Web APIs description files Python implementation

(25)

25

Standard library

of Web APIs Config files

(auth, extractors)

Python implementation

github.com/netiru/apiblender

(26)

How the apiblender works (1)

import apiblender

blender = apiblender.Blender() blender.list_servers()

.load_server('flickr') .list_interactions()

.load_interaction('photos_search')

(27)

27

How the apiblender works (2)

blender.list_url_params()

blender.set_url_params({'tags': 'good spirit'}) result = blender.blend()

result['raw_content']

result['prepared_content']

result['headers']

(28)

Authenticate Make request

Parse response

Process response

Generic interaction with a Web service

Ensure

authentication

Respect policy

(29)

29

3 pages search 'good spirit'

User's followers and followees

Tweets and users

For each user

Example

(30)

Interactions made easy (1)

blender.load_server("twitter-search") blender.load_interaction("search")

users = set()

for p in range(1,3):

blender.set_url_params({"q": 'good spirit', "page": p })

response=blender.blend()

results=response['raw_content']['results']

for twitt in results:

(31)

31

Interactions made easy (2)

blender.load_server("twitter-generic") for user in users:

blender.load_interaction('followers')

blender.set_url_params({"screen_name":

user}) followers = blender.blend()

(32)

demo

(33)

33

Summary Policy management

Persistent authentication Data integration

User-friendly interactions chaining

(34)

Coming soon

> 5 APIs (and more methods) Request chaining libraries

(35)

35

It's open source!

github.com/netiru/apiblender/

Références

Documents relatifs

Our work addresses the new problem of adapting the principles and technolo- gies of Web API management to the landscape of the IoT, which poses challenges stemming from the

Dans ce premier article, nous allons créer une application composée seulement d'une fenêtre principale, dont le but et de montrer l'architecture d'un programme Windows.. Prenez

De plus en plus de site propose une API sous la forme d’une &lt;iframe&gt; (déprécié pour les sites en https) ou un widget dans une balise &lt;div&gt; à intégrer directement dans

However, most popular social platforms includ- ing Facebook, Twitter, or Google+ and many other Web services are not currently offering any WSDL description of their API and do not

In this paper, we focus in particular on supporting the Web API search and discovery tasks by enhancing the descriptions with: 1) information about the type of provided

This case study serves three main goals: (i) an API framework (implementation and specification) for ver- ification of J AVA C ARD applet source code, (ii) consis- tency of the

Syntaxe pour se promener dans l’abre dom et en extraire des partie (noeuds, attributs,. ), plus détails sur w3schools..

We also compare the performance of Zhou’s algorithm with respect to three baselines: a global ranking method, a collaborative filtering method, and the keyword-based