 Hello, good afternoon My name is Nick Vidal. I'm from the Brazilian community and it's a great honor for me to present Fernando From Peru from the Peruvian community. He has been a great community leader Helping spread Drupal in Latin America and he's going to present about Drupal services And I really look forward to it. So Fernando. Thank you Thanks for your kind words Nick So hi everyone Thanks for coming to the Drupal con For coming to my session and really surprised for the many people that is here So I have a question for you But I just wanted to show my this light about me perhaps, you know about the guinea pig you know and my nickname the Valkuy And I really In love of the community I so that's why I used to spread Drupal in Latin America as much as I can But there are there are lots of many folks there, but let's talk about web services The question is what do you use Drupal for? The do you have the you have the microphone there, can you please stand up and tell me in Two words what what do you use use Drupal for rapid prototyping? Okay, that's that's one good another Apart from rapid prototyping you use Drupal for web development, right? You make modules Sims what else? CMS some e-commerce API What do you use API for? Sorry, okay, that's interesting, but Why don't we think about more of the web stuff that we shared, you know a few hours ago the web experience management and that New vision we have as a community. I think that needs a New technology, you know, it's not that new but it needs it needs more, you know More of it perhaps So wanted to share you real quick about Cara Cara is a product. I've been part of for about four months last year. It's Don't buy the it's created by the immersive laps easy startup So it's really amazing the project. So it's like imagine there is a webcam Up there in the screen and it's taking a photo of You know 25 people only Unfortunately yet, but there will be many of them and it can graph the statistics from the real world What we track right now with Google Analytics and The other alternatives are only 10% of the data So there is a world and universe left to conquer to measure, you know and that technology needs sorry that that Technology of current it's another technology called software as a service Drupal services perhaps or others, you know all else and that that's part of the one what I when wanted to show you today This session is inspired of the it's inspired on the tools that we use it in that project, okay and There is a lesson learned from this first part, you know, is that Drupal will help you to mature your ideas Okay, who have you used Drupal? For a product not only a website a classic website perhaps something like buzzer or You know similar, okay Perhaps you come from a PHP script or just a HTML website then you wanted to make it dynamic and there is a moment when the product is Really growing so fast you go perhaps an angel capital, you know, and that's what happened to To this project the car project. They are they move it to Singapore and they have to change the technology They have to move off Drupal and that's fine actually because they needed a technology better suited For their moments, I mean the right technology for the right time for Drupal help it a lot for this product to mature and to test many possibilities of for this project real quick because there are thousands and thousands of modules and things and you know possibilities you can add Many many many functionalities to Drupal real quick, you know, and once you have the Righting, you know, you have your idea real mature and it's really valuable. You have, you know, the money to make it a scale and you get rich Well, it's perhaps I don't know perhaps you can stay in Drupal or you can Move out it depends on what the technology, you know, what technology is the best Drupal is not the is not the best for everything But my my session is now focused in The product when it's on Drupal. So what Drupal can offer you now to make your ideas mature, okay? thinking on ideas as software as a service, you know, there is the the Theory of this basically is a software delivery method that provides access to software and its functions Remotely as a web-based service Many people call it on them and software or application service providers is the same, you know, it's It's also about Communicating not a person Because regularly is a person you many of you have a computer here We interact with the web to a web browser, but web services are most more about Data So one system Gets data interacts with another system talks to another system, you know In this way the request request and the response the client It will be a server. It will be a web browser. It will be backbone. J is talking to a a server This server in the case would be Drupal Okay, that's the basic architecture and there are many, you know software as a service products out there like Buster and Drupal Twitter Amazon Mailchain Flickr Authorizing it and many many of them there there are just examples, you know, one of one of some of them have Drupal in the back end and I would like you to Put your name there the the name of your product, you know So there is this module called services. Have you ever used the services module? Okay, and who have you called our developers? Yeah, that's why This is a coding class development track But you know, there are there are not a no You know coders for the session to talk in code to show you code examples, perhaps we can organize a BOF leader But it's more theory now. So you can know what the technology is and how it can help you to Make money for it to make a business, you know with this technology Of course, there are some famous clients like many many mobile apps You know, you can actually with the services module create create a web service and Create a web app or sorry a mobile app that connects to it We know the tweedek I love buffer But backbone JS there. I have heard about one product that is very famous. It's called I'm followers me is using Drupal He decreed this here percent is using Drupal in the backbone. It's sorry in the in the back in the back end so the front end is backbone the idea also is to Move part of the computing load from the back end to the front end You know, so we don't have to exhaust the servers, you know calculating the front end when we can just Allow the browsers to cache the interface of or most of this like Gmail You know, you have this nice interface that is built on JavaScript and there are some servers in the back end serving the actual Data and also credit credit is an example of a client But a service of the same time at the same time because it connects to your Twitter Right, it grabs your data and it makes some analytics and you can also connect to create to Instrument that data grab it from credit So when we talk about web services software as a service while talking about Another principles like interoperability, you know, and we are able to string one service to the other Like a production line perhaps Okay, so the data is coming from Perhaps the real world with a camera But it will pass over or through a long process with many services in the middle and they could be triple or others you know and At the end it will serve for a lot of purposes If you want to play with with web services if you want to consume services using triple Okay, perhaps you want to create another credit like website Or you wanted to connect to a web service or a service provided by the by the bank or a enterprise proprietary Software or or system perhaps you can use gas all gasoline core and it's a really amazing tool I have used in this in this car project It helps a lot because it's not using The cool library, who are you know the cool library? Have you heard about yeah, only a few people because it's really it's really a pain in the neck to work with it It's really complex. It is using flux all the time and you don't know Excited how this will behave and you don't have a nice way to debunk this You know instead with gasoline you have a beautiful class and you have this object oriented Programming interface for you it improves a lot the the experience of the coders of the programmers, you know, so it's good for For for your experience when you can you code I mean that now let's talk about More about How we are supposed to interact with the services when you are when you are connecting to a service like perhaps events.com or Twitter, you know, it supports it listens now to some formats and it speaks in other formats Okay, so say you want to you send a request in Jason you can ask to the To make a response in XML Okay, so if you are planning to implement a Web service to create the web service. I recommend you to Support the standard ones preferably Jason who is It's really easy to to parse there. There are virtually a A parser of Jason format for every language created and Also, it's very short very compact, you know, and it helps the Believe it or not. It helps the performance of the web service When you use XML, you know what the XML format It's really a lot of text and if you want to reply as we're through, you know Your your script is connecting to to the service and it's requesting for a tweet the last to it And it was it replies in in XML, you know, it's a lot of code and you have to parse it using the DOM Librarian, it's it's really difficult when you can just parse this in Jason format and you have everything almost ready You know It's really handy and you can also use any serial but serializable Actually, it's just about having some array and memory and you dump it to a format You can create your own format if you want the banks Networks to use the bank a binary format. They created your own binary format to to communicate between the network of the banks So it's up to you it perhaps that would be a proprietary, you know, but I Supercommend you Jason lot. So I I want to set one conclusion here Is that sauce encourage you to invent new services, you know, I'm focused on the core business You can you can you can Buy services from other providers and most common is in e-commerce. You buy the payment gateway, right? so you don't have to be an expert and and in Payment getaways you can just connect to paper and it just works But you can here in Drupal con you have heard about many technologies perhaps not So many of them, but there are new startups creating products with Drupal. So Let's decide your business Saying okay, this web service will hand me with this this part and this part and this part and this part And I will make the my web service to focus in this part. This is the core of my business We I will let the others focus on their own core business. Okay, and though I'm talking about Again communication interaction between systems So that that we have been in the in the system level you basically will automate all the staff You would just need to connect the plaques and you will get a solid system Supposedly, you know To work So let's continue with the presentation. I would like to show you how this works, you know in Drupal so we could have a Drupal site call it Drupal dot org. Okay, perhaps. I don't I'm not sure if this the this conference has a app a mobile app for it, but let's imagine that we have a mobile app For the conference and this app will show us the list of the sessions I am I am subscribed to and it will show me You know the my schedule my personal schedule Yeah, and will email me about the next session. I have would remind me about my session my sessions so I have in this case some mobile apps and it has a client for a desktop application and It will be connected to all their Drupal sites. It will be connected to Drupal event site The Drupal call, you know the Drupal call Websites website that is a calendar of all the events happening In in the world of the all the Drupal events happening in the world So perhaps this website of the conference will be connected to that other website and will be they will be sharing information data, you know some data and Perhaps we can have a kiosk out there that is connected also to the website and I want you to interact, you know real time with the With the schedule, you know, so there we can we are starting to extend with this software as a service technology Drupal from the digital world to the real world, you know, we we are Leading letting other systems connected to our data source You know to our source of data To access this information and to make it valuable for the right time and the right moment You know, I would like actually to have a kiosk application here, you know To see the schedule and connect it to the to the conference website You know as I am saying the example So continue with more of this theory, I would like to Talk about Open data Open data is related To the services, you know, because this is not only about Profitable business. I think that We are also Connected with the government many of the governments many of the newspapers, you know, there is a lot a world and of data and there is there is a lot of years of information in newspapers that are stored in Some database in my sequel in some place, you know and that information is accessible only through the web browser so if you want to Gather some of this data that is publicly available, but but it's not semantic It's not easy to gather and to make sure, you know Perhaps we will need some kind of web services that allows us that Perhaps we need some tool that opens it and the services module will help to that you know We have only a problem that It's not that easy as just install the services module and you can share everything Actually, the services module is an API. We need to code The interface we have to code a service, you know, perhaps for the my example We just have to to to call some some view and make it accessible to a web service thanks to the services module and It shows the list of all the news of this web newspaper from the first in 1950 to the last one, okay It sounds easy, but it's need to be designed, you know, but that would be I mean the web a bit better There is another effort for this. It's called the semantic web and there is a micro format And there is all the stuff, you know, that makes the websites Readable for the humans are for the computers. You can do more data meaning with that but I Don't think that that's the only solution I think that we can directly open the the data just the data and let them the computers calculate And access the direct data know they're not only a website, you know, that is showing some some news there I Think that also is democratic And if you are if you have you are connected to some to some newspaper site If you are connected to a ONG or non-profit or the government I invite you to encourage your organization to open to your data to it's really not that hard It will take you like eight hours to code a new service, you know, so please Make it happen. It's not that hard Also It's a it was not in the session but Or in the slides, but it's it actually is better performance If you create a web service, you are just printing Jason and that's a lot easier than print than format Then rendering the the world page, you know So if somebody really wants to grab your your whole database led, you know, let it do it It would be so easy. We'll take you just one pitch pre-script to parcel the data. They store it They do the calculations and done or you can also sell it No, you can market it and you sell it for some money. And that's it, but It I think that would be make it, you know, easier even that way So let's talk about high performance and it's coming it is color ability Let's say that we have opened a newspaper to the world. We have been web service that again is in Jason it's it has a The ability to list the news by month by day You can search you can pass a Keyword to filter the news and it will look the news related to it and we'll show you the title and And the body, okay I am I am going to be more teacher at this point because It's why it was supposed to be a code plus development session. So But we have that example in mind, okay, so we need to design we need to design The performance of this web service, you know, so we have to set some limits Because we are talking about now the cloud or data is in the cloud That newspaper is in the cloud. We want to share that information or that information to the world But we cannot share the world, okay, that's just download, you know, the world newspaper to your To your computer, you know, that would be crazy. We need to set some limits like Max connections max rows we can use by Pagination so we can serve the data each hundred records, okay We can we can limit the size of the the output and We have to set not only save limits but reasonable Okay, because I have seen some web services that when you connect to them they are really They don't doesn't make sense it they just limit you so much It looks like some IT department manager, you know have look at other specs and say no, that's not safe And it will break the servers and you can only lease ten rows per per connection, you know, and we have we have to include it in You have to pass this web service to be to a VPN We have to make these and that and you make it so complex that you don't let it You know, I'm you are not making your clients the life easy, you know And I'm going to talk about that later how to make easy to your clients I mean you have your own one web service how to make that web service Easy to to work with to the clients to the people who is going to use that web service to the developers actually to are going to To are coding the clients to connect with to the web service So that's why I'm recommending all out as a standard That helps with the performance here I have seen it in the services module that you have these Drupal authentication So you you pass your user and password to the web service and it returns a Jason array With the wall user object It has your username. It has your password hash It has your email and like hundred more Properties there in that array, you know, and that's it doesn't really make any any sense for me to To serve all that information You know when what when why? The only thing I want is perhaps Welcome to the web service to You are you are connected login to this web service and the service we return to you are looking or error or false You know something more small and easier to work with You know and allows helps you with that in other way, perhaps not the way I am I am saying and going to talk that about about later So I am almost finished I am close to finish this another point another Think we have to think about in the in this presentation about web services the interoperability So there are some session lessons there for from from my experience I would like to share with to you and perhaps you have Some lessons to Cheryl to the audience I would like to ask you the finish when there is it the question time You have experience with web services and there is some lesson that you want to share some lesson there, please share it So I asked you if you are implementing or creating web service, please make it open ears Make it a speak as many standard formats as it can Okay, and to read them also, you know the ones that are be able So also make it them wise In the sense that it only serves the data that is actually needed in the context as I told you before and Make it compact and expressive, you know, I have seen some web services that are really confusing They have keys in the properties, you know in the imagined one Jason right again It has the it says the username like you You the value of the username and the password is P And you have another field that is that is T. I don't know what is T. It's a number. Perhaps it's the time you know and But this this value is writing in in a string So I only you know, it's really hard and many times there these web services don't have documentation You know they sometimes they think that when I connect to the web service and I grab the data and I read to the fields. It's all I need and that's not right Actually, you know when you have the web services, like I am Interoperating with a system. So the system has to tell me You have to first go to this endpoint to this web service. You have to connect here You will you will get this data and it will say it will Serve you this information and we have you to connect to this order You know part of the system and you can use this for that and and that you know and It's even better when you provide with code examples because in some implementations You cannot even connect to the system because you are passing one integer when the system expected one a string But the system even told you that it was expecting some string So there is no way to debug it for you and you have to guess so you have to call you provide it until you I am You know, you have to see it. I am using this This this script I have created. I am pretty sure that this works I am pretty sure this working really well and that happened that happened to you to me many times They told me what run what I'm making wrong, you know, I am using Ruben rays I said my customer Well, the web services in PHP and I don't code In Ruben rays really, honestly, I don't know how to how can I help you because I don't know Ruben rays? and He told me have you documented what the system expects as an input and with what will it output Or is there any error message that I have to look for is there any log? I can watch to to know what's there So it was really embarrassing for me because I was thinking that you know just interactive with the plain system Will provide in a documentation. That's not right You know it makes sense For all the systems to have well documentation a good one so any conclusion we might have here is that Drupal empowers you to innovate It provides you with thousands of modules and teams. You can plug into your system And it it provides you with faster It helps you to to develop faster and gives you more time to mature your process as as I told you So you can you can focus on marketing your product on time Okay, if you have this great business idea It would be really sad that you marketed so late Right, it will not make sense to release so late to make it Successful and You may you may have all these inconveniences along the way and I wanted to show you what what that those will be So let's start now the the last part of my presentation It's about all of All of is a standard and is a child of open ID When I can remember the name of the author, but he was working with open ID Trying to provide some authentication that is different to authorization. He was trying to provide some authorization for a System I he told okay open ID is interesting. It provides me with you know many interesting tools and I think it will fit to my requirements so he was confused with between the Sorry, I Don't know what Okay No problem. I have my I have ended my presentation with all else my computer just turned off I don't know what's going on but Sorry for sorry about that, but he was he he was confused about author between come authorization and Authentication, okay, so it was time for him to establish clearly that difference so you have your You have your ID Okay, imagine I am in the airport. I present my ID and it It says who I am For it says I am Fernando Okay, so that's my ID, that's my identity and In the web we used to have many identities. We create an account on each single Possible, you know web application we can Sorry, so you we create an account, you know in Yahoo in Google in Facebook in Twitter You we have many passwords and we have Fitted our name and our last name are and many of our data Sensible data to many many web applications So we have these many identities all over, you know, the internet That doesn't make any sense. So then the people created open ID And it says we are going to have this open this identity provider So it will centralize your identity and this will Authorize other systems to access your identity Okay, and this then this central system will provide you with an Authorization You understand the difference now so The immigration control in the airport Gives me a B sign my passport and that's my authorization so I can get into the country Okay, and all out is about that. It's about authorization It's about the permission you give in a limited context within a limited period because my identity is Perpetual I am Fernando Fernando all the time. I don't change my identity Okay But I I have restrictions like in the conference I have a batch It provides me with access with authorization to the conference Okay, and all out is about managing and architecting with a With a really flex flexible and scalable way the resources you have in your system So you can you can now think and on your website not as a bunch of sections, but as a Concussion of resources so you have a resource that allows you to post content you have a resource that allows you to Pull To list content you have a resource that allows you to access the users to you have another resource to access these and that and Other stuff, you know, so you distribute your system in different resources together and just a sec and Then you provide access to the to the users Sorry to the clients to this particular part of the system okay, and and We are doing that all the time and perhaps you don't know it We are using Facebook and Twitter and Google. So these systems have all out implemented already that when you are using your iPhone or your smartphone and you are using the Twitter application it has you to provide you to provide the system with the user and the password That's your identity key So you say that this app connect Using this user and password to the system to Twitter, okay? So your application There in the in the in this device will get authorization to tweet and to access your tweets so you don't know that but actually it will get it will get a all key That will allow the system Okay, so say This is the this is the server and I am the tweet application I am trying to connect here. So here is the user and the user will connect will bring me The user and password. I will connect to the server and the server will will provide me with an authorization Okay, I get the authorization and then Any time for a limited period that is not defined yet. I can Tweet the user would ask me to tweet something the user will ask me to get the list of the new tweets tweets, you know so I am the interface and Here in the server is data and here is the user and the user can connect to the system And Through the website that that is another interface and we'll say I don't want this device to connect anymore So you can this hollow? Me the user can this allow me to connect to the server Okay, it's like when you go to into an hotel you get a card And this card for a limited period allows you to open the door of a room Okay, so off is all about that it Provides you with a way to authorize Users to access resources and it has all the this is standard has all the architecture. This is standard has All the philosophy on it Well, I tried to make my my best to explain you with my limited skills skills in English And with all these lights in this part. I'm sorry about that so If you have any question now to ask me and I am done and thanks for listening Anybody has a question? Please come up to the microphone. I just looked at the boff schedule and there's no open sessions, unfortunately so maybe if you want to Twitter and like give us a spot We can all meet up at some time over the next two days They could be really awesome to get down on the code for anybody else that's done this a little bit But maybe wants to like see how you've done it and compare different methods Sure, okay We've talked a lot about like sending content to different and data And you talked about guzzle and mention that it's part of Drupal 8 Can you go into a little bit more detail about your standard? Protocol for using guzzle or is there any other tools that you use to consume content that's provided by an API? Okay, so the question was what I am using as a standard my Regular date to connect to web services or to create of services Like what are you using to pull down the data? Oh, okay Before that just a sec. I have a friend who wants to share a An idea about web services technology created with Drupal, right? You have the cards. He's going to Actually, I wrote a free e-book about how to create a social network using web services So if you guys want I'll be distributing the cards Over here in the front. Thank you for another Ron you're welcome. So usually what I am using To pull the data in guzzle is its function get So I I instance a class. I provided with the endpoint URL and then I Provided with a parameter like Connect using JSON. I pass it the RI with the parameters And I specify if the parameters are you know, if they are in post format format or in get format This is all HTTPS a bit complex if you don't code and it Then I say connect or send so it sends the data in the right format To the to the server and it grabs the data once is it grabs the data is like the Database layer of Drupal it gets you the information Parcet so if this is in JSON, it will get it will provide you with an RI already parsed It will not provide you with the you know Row data only but you can access out what it you can access the property row and It will show you the row data if you need it, you know to process in other way That's how I do it usually Do you have any other question? Okay, so thanks again