What is wrong with API wrappers and how can we do better


Formal Metadata

What is wrong with API wrappers and how can we do better
Title of Series
Part Number
Number of Parts
Ximenes, Filipe
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
Release Date
Production Place
Bilbao, Euskadi, Spain

Content Metadata

Subject Area
Filipe Ximenes - What is wrong with API wrappers and how can we do better Wrappers are an essential tool for interacting with web APIs. They reduce the amount of work needed to make requests and sometimes, only sometimes prevent the developer from dealing with extensive documentations. It’s common to encounter libs that require not only the study of their own documentation, but also the APIs one, duplicating the needed work. This is caused because wrappers do not follow a design pattern, each developer creates it’s own design, coding style and use their preferred tools. [Tapioca] is what can be called: "a wrapper generator”. Creating API wrappers with Tapioca is extremely easy and fast. For example, it took 1 hour to write the full wrapper for the [Parse.com] REST API. But this is not the more important thing, Tapioca libs have a similar interface so once understood how they work, developers can work with any other without the need to learn a new interface. Tapioca is also thought to comply with REST features and takes HATEOAS (Hypermedia as the engine of application state) seriously, so “following” links and pagination are natively supported. Explorability is also a key concept and developers are encouraged to play with Tapioca packages and find their way through APIs before writing their final code. Although there are some production ready [Tapioca wrappers], it is a work in progress, there are still many features to be explored.
EuroPython Conference
EP 2015
EuroPython 2015
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation Lecture/Conference
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
Computer animation
High School diction lessons so the learner on the full rooms so thank you
very much for your Our them in Information Minister in all this might Eurocouncil
and I'm from Brazil FIL and actually from this equality this effect and quite far so monitoring and I'm going on here so thank you all for that coming right through here you have a company there it's called the and we do web development tho we work with a lot of API we work a lot of integrate integration these exons services such reader face focused around and some private services we do a lot of angular we develop react yes need something like this just
look to the right so here I'll be talking to about it as just another argument for the application programming interface with which does not say a lot about what is but use ideas so if it's basically uh in IPA defines how we interact with the sulfur and when I software like India of white implies that the babies some library for a web services or or in the clothing so it's pretty broad definition so for example if you are of about that being aware of these the user applies the value the you will have like the attributes the name and you know and have the method the dead and talks so this would be the API of all
marked my user requests so for example if you go to a Web service and maybe I can mean is like the forest so the 1st method gets the immediate in the for reward you this 2nd method post a comment and the last 1 to it's so this is the a partial this region of the for
several so I'll be talking more about that means that this is so we folks here about where
the data right and answer let's say the customer comes to you and he asks you to develop a softer web sulfur uh whatever and you want the user to log in with Facebook and then he wants you to fetch like is the use the basic info for his Facebook account so I have some options here for what we can do all of the 1st option would be to go to Facebook segmentation and read it states that the mutation and we could use the you all the 2 that comes despite and to make the request that work problems a 2nd option would be again really good at that augmentation and a set of using your to we could use request library which is much more cleaner and I really like it it is induced and this will be and and a good option to and that 3rd option would be go on Google and just search for like something great you will to interact with Facebook and then you go to the beach that's like I suppose you could let's take a deeper look to see if this really possible so of
course of this 1st of all so we are on the same page when I say rapid and the apple will be just implementation of again documentation in a programming language and you can be imperative programming language today we will talk about Python with it can be on the rubber or there for a where there is a lot in english so it's basically just a little later on it should be and it will help you develop the software integration services so some things these joined to a major robberies of the kitchen it should be able to compose you out it should be able to prepare request before you you actually make it them and should be able to process responses and format that right so if you're OK with the API every 10 days on it should be able to convert cheese on to an active form of of those before talking at that we probably a
dictionary so all our example
for this task we could use by that's 1 of the most popular of rockers for Facebook API
of variables the it's basically on both of genetic differences again mad and you can't that's a pass and some options we can see on the example here we are building the end point on the back so I have to like write this string for the points and then I can just like based true and this when it when I fetch this endpoint million links it will return for me but not all of links in my Facebook wall returned base of it because the study it would be too much data to come from the ones always said these returns and on pages so in based best space should this by the way the rate with iteration over the response this by automatically affection new pages so I'd like to worry about getting the next phase and expertise I would just work with links to return also their internal links the arbitrary so
they're quite in the time right so next next method is the and this time we again have the to build point like string it now we don't know what this is supposed to we're trying to almost as in the 2nd word trying to post a new study to my Facebook wall I don't really know what the format of the dot the expected needed documentation tells me so I'll have to retrieve these books that plantation and again a petition and real at this so Our 1st we are were 1st thought we could just get like this proper from the internet and start using it without reading the limitation and when you get it you just see if not possible we have still have to go to the
documentation so some notes which is sad tho we have had to read about the representation you had to read about the the agenda
conditions well so an example would be by dendritic that's 1 of the most popular property which we needed
so but it's a bit different from the faced by the In instead of the beauty and it you are the end endpoints he gives me the other methods 2nd is best parameters and it will handle the the rest for me here's
some some of the methods of this library uh as we can see it does not follow that OPEC that date so it's only using come OK themselves in that case nothing wrong with this just not usual and he sort of redundant dictionaries returns classes so a
bit different so as right the
also used by documentation it's actually not the right time he has no additional parts so it cannot do what just such a spring curable faced by 1 and it has a medal for each endpoint and
it uses models is said to be tried of OK given this narrow let's imagine now and that this is a real scenario we actually happened in company a plant came to us asking too coarse integrate the Facebook said on reader tumbler and both bloggers a of integration and measure now I'm having to always read the representation and then there's a sedimentation sets a a it's really so the let's think of if you are trying to write like did the perfect the robbery what would you like to have a unit so altercation that's basically all rock as you have it I like requests is said to be like library of it you have made use of support and should uh would be nice to have like some exception raised so I know what's parable came the response right hypermedia support would also be nice so I could just follow links instead of using these links up a lot to be to be explorable so I can play with it before it's the final implementation and I would love to have a simple augmentation so so this is our have to read the get a condition anyway I like the rapporteur petition to be simple
so i don't waste much time on it and this brings us to tapioca so 1st
what's that right so that is this Brazilian forward he looks like at the left it's a bit softer and you're like you put whatever you want and cited you can be so it can be seen as candidate a chocolate can be made whatever you want it's with this so if you ever come to Brazil you should try so have a little demo for
this it so that's me provided
that your the but right now back to
the cold so you can library said my companies have also been softer flesh that you there she
proper in what city is basically a framework for creating whether they are very
rapid little books she let's say from the the more time let's see what we can do with the the joke
right so I will be using the details Facebook so that's the
that the open competition for the Facebook API and we also be using I quite on so we can better
explored cage the and he has some nice features when I'd like to so 1st of all right so that's
the way I can and right imported library from the field of book report Facebook let us so that is so weird yeah so 1st thing we have to get an access code stock it so can use the API
and we'll get these from data developers . facebook that call you bonded refuge explorers just grab tokenized
lectures much so right that's place but the 1st thing I like to
blow but if you if you press
that owned by quite and you can see the full list of methods available for the proper and we'll be looking at the user likes on that that we are like you know what this right now so let's see what what some people at the
user like and point so we can see there is a partially montage URL if you will go with a question mark begins the more info about it and that's
from the package so I I can see I think that's an ID to the URL and let's but is that not give like full information about this and points so let's open documentation for a descent points can send a
about it so you can just go
opened if you open your browser straight right so we can see don't do we return to the doctor and patient it that there is in and despite the
doctor has good news response will have become pages as and these are the other people i suppose for the response so yeah so we to I just took a look at directly at the end of augmentation and as you will but this problem here right the lecture
the code so the so now will be making the request so API user like and I Best Opus the idea they you will me so I'm getting the likes might be of my Facebook page and marking see the euro's feud the lights usually set off ideas usual me just a few that you are fully and now we actually do the request so response in the post like nicer
response now it's filled with the light we can't see it in the all my life all the 1st stage 4 for like what Facebook will be looking at the names of the like so the basal-like like a and you can see there's a Beijing and course in the next 2 so we
are exploring so we're looking at name if you could come back to this agenda mentation we can see this the response actually has a name sure that's it right so
let's get like the 1st like that has been on my on the response
so the doctor has in are a system the 1st item and and that and the name so pretty straightforward you just use or just navigate freely like and so
uh quite an object again consider let's write like for that the next page URL for the next page of results so it's fine responses Beijing next and we see and we can also fractured so response Bayesian next and objects so as you can see it's
pretty pretty straightforward so far apart to the thanks new stuff if you ever have a unique you can just get it pretty straightforward rights to now
it's let's use sound that's print all all the old because I like
Facebook so I can just go with the for like in response and bring it the name of each page so so a tapioca will be iterate over it and whenever you reach the
thing is this is the end of the page will fetch more that tonight so it not durable Bayesian it goes goes spiraling of that's my bikes and you can see it as like little break so this this is the library fetching more the sorry right so yeah that is as in Sierra College was too afraid of like do you analysis of so like let's try now to leave my my photos right so this I would be using the user photos and and I will personally again as the idea of this end point and get it now like is the results and now
I'd like to like to to that the 1st feature I have a model so the doctor foresight and then source all right so this is
the link for the the image and that's right for browser so against at 4 0 4 so open browser and we you can see the picture in the browser and you can do
this with any linking you want so this is our local quite user group a lot of people
end-to-end left just try to post something on my Facebook wall so this time to user fees then now just instead of using that will will begin to question the because I'm posting to my wall and I'll be posted the using the same interface as the request has so that 2nd best dictionary of this is information it and you will will convert to J bonds tend to Facebook so the message will be posted to my Facebook follow using tapioca right right that
the life on my face now this is a
very profound so sowetan an idea for the for the so
if I go to my profile yeah
that's the it just also
work nice so that's all for now
let's get back to the presentation so
congratulations just monolog about using that your library so once you you learn how to use 1 type that you library you are now able to play with any other so if you get that you get treated in right not to play it if it is just the same as showed on Facebook 1 in let me show you how how how easy it is to write the the upper for any service
you want so this and sample for the facebook on to our that the code for
screen and disorder calling needed to write the rapid display with so it's
for a line of lines of Python it's pretty straightforward not very difficult of the rest will be just resource mapping
so it's too much of it of dictionary with information about the endpoints and how to fewer than and that's just like documentation it's not like you quote so so these are
things that can go sleep any topic erupted they have a method for each endpoint the are actually extremely explorable as we saw on the on the dialog the user requests lead needs to make requests so you if you know request you already know how to believes that the of library of the have consistent support and that comes for free has hypermedia supports can follow links that's also for free and you can access documentation so it's nice to you know have like to know everything before you start coding you can just we
documentation as you go so some benchmark benchmarking at the top you like Facebook library has 250 lines of gold and the faced by 1 has thousand so 1 force besides the again this this includes the resources mapping because the picture I showed you so 0 it's not actually you know if you like writing ecologist you like documents uh for the 2 is the 1 in the difference much needed you that it either as 150 lines of code and the by the reader has 6
thousand so huge difference and for example we took me 1 hour to write the full record for the possibility of service or it's
pretty we but alright so some
notes about the project so again we are we are the self and having to read robbers augmentation and they get augmentation will be no reading just of they gather condition because where were we we already know how to use the wrapper but it's fun to explore so it's we you encouraged to play with the rapid before you actually do the find employment they should and write a new flavors new technical flavors it's pretty easy result of on reserve the parties you have fewer very few lines of code and and quot comes with batteries included so Earl nice then to finished goods there's a lot to prove it it's a new projects have been working on it for about 6 months and if you have some ideas and you have like something you'd like to add to it a you're very often there there are a lot of things I still want to add to it that there listed on the development of the project you can vol . the Europeans then yes thank you your question few fee the I have a great so I want to know where and how flexibility is working with to at the API is used Facebook and Twitter they're pretty RESTful in like http RESTful style how about this technical work with API eyes that I had generally conform Russell standards is that much flexibility for plugging into those as well gesture are I mean do you it doesn't matter what data is all we use like it will probably be should use the basic HTTP methods so get options and since it is used the same which methods you are able to write a particular phrase of the main not look like as good as it is a RESTful API look good yeah you can do it you possible another questions I thank you for it so I don't have any of any from implementation to manage different API versions for 1 endpoint for example Facebook as I've seen 2 . 2 of a desert when floor and some things are the front shares and were so this is I mean defined how how we work but my 1st idea for this would be have different libraries with different versions so if you want this book on 1 . 0 version you find a job efficient 1 the 0 and you find that you would have preference book to good I mean a moment you to new ideas and some just tell me and think the top I just some of the check which versions of Python that's the political support i goes from to 0 . 7 2 3 and 4 yeah but identical but hi I wanted to ask you how does top you can integrate with the asynchronous frameworks for example if I use a nation library like tornado all of this you can hold with the Internet because the default to block on request it is possible to make the colicin synchronous on on the Earth the currently uh again effects ideas just tell me in thinking of something the on intensive but now it doesn't support another questions what a bike our supporters to besides the Facebook and Twitter right so right now we have Facebook Twitter possible columns many and by someone I don't remember how would like is also a nice and if you had if you want to to implement the new 1 please come to me and I'll help you or I mean it's open source want to do it on their or all just to it but if you have any and doubts just come to me and I don't have no help you write and specific implementations for for services of questions I think that's it thank you very much


  731 ms - page object


AV-Portal 3.9.2 (c7d7a940c57b22d0bc6d7f70d6f13fde2ef2d4b8)