Presentación
HTML (pincha para descargar)
Vídeo
Transcripción
Extracto de la transcripción automática del vídeo realizada por YouTube.
okay we're going to get started here so this is the rest and serialization in duple eight presentation and have to say that there's a lot of food on the side so that does have the side effect of making it somewhat difficult to read them from further
back if you are interested in those details you might want to move closer we also have the slides available on github pages so if you go to presentation the session page on triple dot org at the bottom you'll see that our link to the slides unfortunately
we didn't optimize the images and everything so it might take a while for them to get down to your computer but um but you can look at them there when they come in so i am lynne floor i am an independent developer I've been working on serialization
issues and Drupal for the past nine months or six six nine months I've been working out people ate and before that I was working on other ways of getting data in and out of people and rupal 7 and this close I'm close I'm working for ethical or
company based we're doing their coolest abuse and I really walk with services for some time now you might also know me from the total that we face excuse so I drew a lot of code review and helping onboarding new contributors so first I'm going to start
with this what is rest you know people have been really really excited about the fact that we have rest and tuefel eight but i'm not sure that um everybody's on the same page as to what rest actually is so I want to do a little bit of just insert doctor
you get everybody on the same page and then Klaus is going to go into how it actually works as it is right now is equally and then I'm going to come back and talk a little bit about the serialization stuff and also talk about what the next steps for making
it a more restful system are so I'm spurs going to start with some pretty dry definitions for you know it's stressful web services so wikipedia defines a web service as a method of communication between two electronic devices over the world wide web
and so that's really a boring way of paying what you do every single day where you go on the web now say that you have an iphone app and that's connected to openstreetmap and you know you send her a class maybe to get portland mac data or add a new
road and you know open three methods is rewrite so basically the two electric devices here are the client on your phone and the server that has all the data so one service is basically a way of telling you know getting the command or the operation from the
client to the server and having communication between us and rest is a piece of architecture for doing with Hampton city a style of software architecture burn contributed system such as the World Wide Web so the guy who came up with this concept of rest he
was a heavily involved in a ctp development of the early early web standards and so he actually our email addresses a formalization of what they have been doing a way of describing how the things actually work so whenever you're using why lab you're
actually using a very bassy at the minimal set of rest architecture so I just want to get everybody a picture of what rest in Drupal is right now so I'm going to run the most basic rest request I'm going to get a note I'm going to get it in JSON
so to do that I go to a particular you are I this worked before let's so I'm going to go to a URI and i'm going to use get to actually get the node and you'll see here that i actually have a an acceptor I'm telling it what version of you
know what syntax I want this note to come back in and that's it application JSON and then when I said you see it actually gives me that note at Jason so there are four components to this record request there's the base form at the HTTP verbs the URI
and the media type also known as the work i'm going to go through and explain what how these all the way so these format that is just you know you're pretty familiar with big papa there's a syntax that you put data into so they fawn is one example
of a base for matt and xml is another version and there are your eyes when you're working with a ref service of your working with a set of you our eyes so you are eyes and be your eyes for resource for example we have entities last note / one see you all
right that you interact with to work on top on a resource and Drupal we're actually hoping to change it so that you don't actually have to have entity in the past that something that we would like to have happen and we'll see if that gets in and
you can also have your eyes for what are called mini relations so the resource you know that's what you're interacting with the Luke relation is somewhat different I'm actually going to talk more about link relations later in the presentation so
I will just leave your background so an example of what you know using your eyes and not using your eyes look like is as well as if you work at work with n points before where you just actually like send something in JSON or XML that gives all of the information
about you know what the identifier for the thing is that you want to interact with and what the operation you want to have what you want to do on that thing is that is not restful instead you actually want to have a URI that represents the thing that you're
interacting what you don't want it tunnel everything through so media type people often get the media type confused with the base formats but I think Jade long as a media type which it is application JSON is a media type but you can also have more specific
media types for example one that we're using in Drupal and the Hound module is application how plus jigsaw and what that media type does is it gives a little bit more information about what the consumer can expect too far in the response so if al a consumer
can expect to find links or embedded you know those are reserved keywords and the consumer knows what to do with the data that is but those key words though you can also provide patio I'll is actually a standardized media type it's an ietf draft but
you can also have vendor specific media types so different have their only and they have their own rules for what consumers can expect when they receive on something that's application then github be fun they say that all resources may have one or more
underscore URL properties linking to other resources so that's basically providing the same functionality as what how is doing but in a way that's very specific ticket and so an example that this is something I love cotton a depressed people will actually
say you should do where you actually have the file format now so you have dot gaze on and that's the way you switch the cumin HTML and JSON version but it gets a little bit software you have media sites like tackle because you know you're basically
creating your own pilots there and that gets a little confusing so instead the best thing in my opinions do is use the exact header and actually specify explicitly which media site you are expecting and in a Facebook post which you are something so HTTP methods
these are how you specify which operation you want to have done to the listing on the server yes means go fetch this page or the three source and bring it back to you don't take it a lot of people who want to get in a way where they actually you can change
things using yet but that's not a very good thing to do get should not change this post and our application works thank you saying here's some data go making thing for me Coast doesn't have strict rules so you can't actually use in other ways
but a lot of people use it basically for the create operation we are using French instead of foot and act as basically waiting here at some change feels go update on the existing thing so this is your update functionality and then there's delete which
basically means get rid of that thing and so an example of doing this wrong would be actually put are not wrestling would be to put the operation directly in your you are so instead of that you actually use the Asian fever to the ancient you connect it say
what you want to have done so let's look back at that request that I did and see how these all come into play so we have our bait format which is Jail on the URI which is actually node 1 these TP method which is gaps and the media type which is application
/ do now if I change of UT things for example i change the uri two entities lymph node method post and the media type let's take a look at what that so here's the uri i'm tanking HTTP method and here you see I'm using quantum tape instead of
except for my cutter on having application palace JSON and now when i send it you'll see that i actually created a node all my site the tool one created that's a status message a status code and that tells me the highway success well i could have gotten
other things like a 500 error or other kinds of status messages but since i got it to a one I know it's been created and I should also mention that it's what i'm showing you here this is an HTTP client it's one for chrome isn't it center
for cone called def HTTP client but you can actually you can get different browser extensions you can all things pearl and you can also use HTTP directly from the code in your closet so now i want to take a look at how this all fits into restfulness camp there's
a really good model for talking about a restful something as it's called the richardson maturity model and this is a guy named martin fowler we meet her before he actually wrote about a long slog to this this image is from his blog but level 0 that's
basically when you are not doing anything roughly all called the swamp basically when you're sending XML messages that contain the operation the identifier everything that you need and you send an extranet point if you're totally back to your network
so that is level variable level one is actually when you start using those resources when you start using those your eyes to interact with things so instead of sending the identifier as part of the body you actually want to you are I like things last three
which is corresponding to your third thing and we actually we have that in place like I said when I change you are a little bit but that's pretty much inflated level two is the HTTP verbs so let's get patch close we have that pretty much replace there
are few bugs that we need to resolve but that's pretty much in place level 3 that's where we start getting through the things that we haven't fully designed yet and I'm actually negative result asleep at the hypermedia controls I'll explain
later but right now Klaus is going to show you everything that we do have a more right now and how to use it so before I get into details found we are taking questions while with our tester hashtag craft I think it was not a good idea because other people
[ ... ]
Nota: se han omitido las otras 5.526 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.