SlideShare a Scribd company logo
DAY03
Web Services
INTERVIEW WITH A MOBILE DEVELOPER
Sara (MISS_ANDROID_94) is a Mobile Developer
She is a lovely person
She loves every one except the back end team
her company
They caused so many problems for her and
wasted her time and energy
Lets dig deeper in Sara’s problems
SOME OF SARA’S PROBLEMS
 Any changes in request / response structure done in the
back end breaks a feature in Sara’s app that takes time to
be working
 No consistency across the API in terms of data formats,
Json structure, status codes
 No navigation links are sent, so I have to
construct/concatenate all URIs of the API’s resources
 No proper documentation to use the API with examples
1- VERSIONING
API versioning is another feature we should
implement to achieve the robustness that is
especially important for mobile apps. Mobile
developers don't always have the luxury of
forcing software updates for all end users, so
our API is going to have to be able to handle
both old and new requests. We'll do this by
routing requests with a version number.
2- HYPERMEDIA
Day03   api
3- CONSISTENCY
Data Formats always JSON
JSON structure (single out put function
for all success and errors)
When dealing with dates and times,
remember that consistency is key.
4- DOCUMENTATION
DOCUMENTATION STEPS
Install npm with nodejs
Install APIDOC
Npm install apidoc –g
 Create a configuration file for apidoc
like this one
 Document your functions like this ->
 Run command
apidoc -i Model/ -o apidoc/
 Enjoy the help for your API
 Send it to the front end and
Mobile team or any team that
will consume your REST API
SOAP APIS
Part 4 (Last Part)
PHP AND XML
XML is another data formats to use
with API beside JSON
Human Readable
Easy to parse and Query
Better structural
WILL YOU CHOOSE JSON OR XML IN
THESE SITUATIONS AND WHY?
1. You are Designing a Backend in your company for a Mobile
and front end web team to have an interface to manage
some data (CRUD operations)
2. You are working in a tourism API for hotel availability (like
booking.com) and returning data about room types ,
availabilities, prices and amenities ( internet , breakfast,..etc)
this API will be consumed by many other websites .
3. You are making an API for prayer times per city that will be
consumed by many websites
CONVERT PHP ARRAY TO XML
Code Output
XML CLASSES IN PHP
AddChiled($key,$valu
e)
AddAttribute
($key,$value)
AsXML($filename)
PARSING XML TO PHP ARRAY
Code OutPut
PARSE RSS FEED
RSS Feed
 RSS Feed ( example) It is a way to easily distribute a
list of headlines, update notices, and sometimes content
to a wide number of people.
 The wonderful thing about RSS feeds is that they all
implement the same basic structure. Every feed
contains a wrapping "channel" tag. Then, each posting
in your feed will be wrapped within an "item" tag. All of
the information that we need can be accessed this way.
SOAP AND WSDL
SOAP
 A - WSDL is the standard format
for describing a web service.
 B - WSDL definition describes how
to access a web service and what
operations it will perform.
 C - WSDL is a language for
describing how to interface with
XML-based services
WSDL
 Simple Object access protocol
 RPC style services
 Uses WSDL
 Based on XML only
 One URL with methods as
parameters
 SOAP UI
COMPARISON SHEET
REST
 Mainly JSON based but can use XML and text
 Only HTTP
 One end point per resource (pretty URL)
 offer an effective way for interacting with
lightweight clients, such as smartphones.
 A REST client is more like a browser. It's a
generic client that knows how to use a
protocol and standardized methods,
 70% of public APIs are REST
SOAP
 XML based
 HTTP and other protocols (SMTP)
 WSDL
 One end point
 SOAP, the client needs previous knowledge on
everything it will be using, or it won't even
begin the interaction
SOAP
Simple Object Access
Protocol
Uses XML
WSDL Example :
http://api.radioreference.c
om/soap2/?wsdl&v=latest
SOAP IN PHP
Consuming a SOAP SERVICE
SOAPClient (?)
Think as PHP, what
should the constructor of
this class takes ?
Creating a SOAP Service
SOAPServer(?)
Think as PHP what else
is needed ?
CONSUMING A SOAP SERVICE
1. Make sure SOAP extension is installed in your PHP
 Phpinfo
 Extension_loaded
2. Create object from soapClient Class and pass the WSDL
file of your service to its constructor
3. Call any method of the WSDL
4. Enjoy
LET SEE WE WANT TO CALL THE GET
COUNTRIES LIST FUNCTION
SOAP UI
Can you test same service via just SOAP
UI ?
OUTPUT
CREATING A SOAP WEB SERVICE VIA
PHP STEP BY STEP
1. Prepare the class which includes your
methods (api documentation is a MUST)
2. Install PHP2WSDL tool via our sweet
composer
3. Generate the WSDL file for your service
4. Create the service
5. Test by SOAP UI
PREPARE THE CLASS
NO DOCUMENTATION = WSDL PROBLEMS
INSTALL PHP2WSDL
GENERATE WSDL
THE SERVICE
TEST THE SERVICE BY SOAP UI
Ad

More Related Content

What's hot (20)

Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
Ankita Mahajan
 
Http and REST APIs.
Http and REST APIs.Http and REST APIs.
Http and REST APIs.
Rahul Tanwani
 
Basic auth implementation using raml in mule
Basic auth implementation using raml in muleBasic auth implementation using raml in mule
Basic auth implementation using raml in mule
Adithya Kuchan
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
Prem Sanil
 
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | EdurekaWhat is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
 
Consuming raml
Consuming ramlConsuming raml
Consuming raml
Davide Rapacciuolo
 
What is an API?
What is an API?What is an API?
What is an API?
Muhammad Zuhdi
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
Tessa Mero
 
Raml
RamlRaml
Raml
Ankush Sharma
 
Play with force.com metadata
Play with force.com metadataPlay with force.com metadata
Play with force.com metadata
Rakesh Kumar Kedia
 
05 Web Services
05 Web Services05 Web Services
05 Web Services
crgwbr
 
The Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTThe Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReST
Bruno Kessler Foundation
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
Brad Genereaux
 
REST-API's for architects and managers
REST-API's for architects and managersREST-API's for architects and managers
REST-API's for architects and managers
Patrick Savalle
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 Slides
Suraj Gupta
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
Angelin R
 
Rest API
Rest APIRest API
Rest API
Rohana K Amarakoon
 
REST, RESTful API
REST, RESTful APIREST, RESTful API
REST, RESTful API
Hossein Baghayi
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
Inviqa
 
Introduction To REST
Introduction To RESTIntroduction To REST
Introduction To REST
Bhavya Siddappa
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
Ankita Mahajan
 
Basic auth implementation using raml in mule
Basic auth implementation using raml in muleBasic auth implementation using raml in mule
Basic auth implementation using raml in mule
Adithya Kuchan
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
Prem Sanil
 
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | EdurekaWhat is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
 
Understanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple StepsUnderstanding REST APIs in 5 Simple Steps
Understanding REST APIs in 5 Simple Steps
Tessa Mero
 
05 Web Services
05 Web Services05 Web Services
05 Web Services
crgwbr
 
The Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReSTThe Internet as Web Services: introduction to ReST
The Internet as Web Services: introduction to ReST
Bruno Kessler Foundation
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
Brad Genereaux
 
REST-API's for architects and managers
REST-API's for architects and managersREST-API's for architects and managers
REST-API's for architects and managers
Patrick Savalle
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 Slides
Suraj Gupta
 
Restful Web Services
Restful Web ServicesRestful Web Services
Restful Web Services
Angelin R
 
Rest and the hypermedia constraint
Rest and the hypermedia constraintRest and the hypermedia constraint
Rest and the hypermedia constraint
Inviqa
 

Similar to Day03 api (20)

Apitesting.pptx
Apitesting.pptxApitesting.pptx
Apitesting.pptx
NamanVerma88
 
Rest web service
Rest web serviceRest web service
Rest web service
Hamid Ghorbani
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Jackson F. de A. Mafra
 
Best practices and advantages of REST APIs
Best practices and advantages of REST APIsBest practices and advantages of REST APIs
Best practices and advantages of REST APIs
Aparna Sharma
 
Web services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGigWeb services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGig
Mandakini Kumari
 
REST full API Design
REST full API DesignREST full API Design
REST full API Design
Christian Guenther
 
What are restful web services?
What are restful web services?What are restful web services?
What are restful web services?
Aparna Sharma
 
Ebook undisturbed rest-v1 [res_tful apis]
Ebook undisturbed rest-v1 [res_tful apis]Ebook undisturbed rest-v1 [res_tful apis]
Ebook undisturbed rest-v1 [res_tful apis]
johnkbutcher
 
Flutter development Lecture 17 full powerpoint
Flutter development Lecture 17 full powerpointFlutter development Lecture 17 full powerpoint
Flutter development Lecture 17 full powerpoint
TayyabArif8
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
Er. Prashant Veer Singh
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST API
stephenbhadran
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
Compare Infobase Limited
 
Undisturbed rest chapter01
Undisturbed rest chapter01Undisturbed rest chapter01
Undisturbed rest chapter01
Cuong Tran
 
Modern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfModern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdf
Aparna Sharma
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
Sreeni I
 
Web Programming
Web ProgrammingWeb Programming
Web Programming
VijayapriyaP1
 
SOAP--Simple Object Access Protocol
SOAP--Simple Object Access ProtocolSOAP--Simple Object Access Protocol
SOAP--Simple Object Access Protocol
Masud Rahman
 
Java Web Service - Summer 2004
Java Web Service - Summer 2004Java Web Service - Summer 2004
Java Web Service - Summer 2004
Danny Teng
 
Xamarin Workshop Noob to Master – Week 5
Xamarin Workshop Noob to Master – Week 5Xamarin Workshop Noob to Master – Week 5
Xamarin Workshop Noob to Master – Week 5
Charlin Agramonte
 
soap toolkit
soap toolkitsoap toolkit
soap toolkit
elliando dias
 
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015Phalcon 2 High Performance APIs - DevWeekPOA 2015
Phalcon 2 High Performance APIs - DevWeekPOA 2015
Jackson F. de A. Mafra
 
Best practices and advantages of REST APIs
Best practices and advantages of REST APIsBest practices and advantages of REST APIs
Best practices and advantages of REST APIs
Aparna Sharma
 
Web services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGigWeb services soap and rest by mandakini for TechGig
Web services soap and rest by mandakini for TechGig
Mandakini Kumari
 
What are restful web services?
What are restful web services?What are restful web services?
What are restful web services?
Aparna Sharma
 
Ebook undisturbed rest-v1 [res_tful apis]
Ebook undisturbed rest-v1 [res_tful apis]Ebook undisturbed rest-v1 [res_tful apis]
Ebook undisturbed rest-v1 [res_tful apis]
johnkbutcher
 
Flutter development Lecture 17 full powerpoint
Flutter development Lecture 17 full powerpointFlutter development Lecture 17 full powerpoint
Flutter development Lecture 17 full powerpoint
TayyabArif8
 
LAJUG Napster REST API
LAJUG Napster REST APILAJUG Napster REST API
LAJUG Napster REST API
stephenbhadran
 
Undisturbed rest chapter01
Undisturbed rest chapter01Undisturbed rest chapter01
Undisturbed rest chapter01
Cuong Tran
 
Modern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdfModern REST API design principles and rules.pdf
Modern REST API design principles and rules.pdf
Aparna Sharma
 
Restful web services by Sreeni Inturi
Restful web services by Sreeni InturiRestful web services by Sreeni Inturi
Restful web services by Sreeni Inturi
Sreeni I
 
SOAP--Simple Object Access Protocol
SOAP--Simple Object Access ProtocolSOAP--Simple Object Access Protocol
SOAP--Simple Object Access Protocol
Masud Rahman
 
Java Web Service - Summer 2004
Java Web Service - Summer 2004Java Web Service - Summer 2004
Java Web Service - Summer 2004
Danny Teng
 
Xamarin Workshop Noob to Master – Week 5
Xamarin Workshop Noob to Master – Week 5Xamarin Workshop Noob to Master – Week 5
Xamarin Workshop Noob to Master – Week 5
Charlin Agramonte
 
Ad

More from ABDEL RAHMAN KARIM (13)

Date Analysis .pdf
Date Analysis .pdfDate Analysis .pdf
Date Analysis .pdf
ABDEL RAHMAN KARIM
 
Agile Course
Agile CourseAgile Course
Agile Course
ABDEL RAHMAN KARIM
 
Agile course Part 1
Agile course Part 1Agile course Part 1
Agile course Part 1
ABDEL RAHMAN KARIM
 
Software as a service
Software as a serviceSoftware as a service
Software as a service
ABDEL RAHMAN KARIM
 
Search engine optimization
Search engine optimization Search engine optimization
Search engine optimization
ABDEL RAHMAN KARIM
 
Seo lec 3
Seo lec 3Seo lec 3
Seo lec 3
ABDEL RAHMAN KARIM
 
Seo lec 2
Seo lec 2Seo lec 2
Seo lec 2
ABDEL RAHMAN KARIM
 
Tdd for php
Tdd for phpTdd for php
Tdd for php
ABDEL RAHMAN KARIM
 
OverView to PMP
OverView to PMPOverView to PMP
OverView to PMP
ABDEL RAHMAN KARIM
 
Security fundamentals
Security fundamentals Security fundamentals
Security fundamentals
ABDEL RAHMAN KARIM
 
Software Design principales
Software Design principalesSoftware Design principales
Software Design principales
ABDEL RAHMAN KARIM
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitecture
ABDEL RAHMAN KARIM
 
تلخيص مختصر لكتاب التوحيد و التوكل للامام الغزالى من سلسلة احياء علوم الدين
تلخيص مختصر لكتاب التوحيد و التوكل للامام الغزالى من سلسلة احياء علوم الدينتلخيص مختصر لكتاب التوحيد و التوكل للامام الغزالى من سلسلة احياء علوم الدين
تلخيص مختصر لكتاب التوحيد و التوكل للامام الغزالى من سلسلة احياء علوم الدين
ABDEL RAHMAN KARIM
 
Ad

Recently uploaded (20)

Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Marie Boran Special Collections Librarian Hardiman Library, University of Gal...
Library Association of Ireland
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Michelle Rumley & Mairéad Mooney, Boole Library, University College Cork. Tra...
Library Association of Ireland
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 

Day03 api

  • 2. INTERVIEW WITH A MOBILE DEVELOPER Sara (MISS_ANDROID_94) is a Mobile Developer She is a lovely person She loves every one except the back end team her company They caused so many problems for her and wasted her time and energy Lets dig deeper in Sara’s problems
  • 3. SOME OF SARA’S PROBLEMS  Any changes in request / response structure done in the back end breaks a feature in Sara’s app that takes time to be working  No consistency across the API in terms of data formats, Json structure, status codes  No navigation links are sent, so I have to construct/concatenate all URIs of the API’s resources  No proper documentation to use the API with examples
  • 4. 1- VERSIONING API versioning is another feature we should implement to achieve the robustness that is especially important for mobile apps. Mobile developers don't always have the luxury of forcing software updates for all end users, so our API is going to have to be able to handle both old and new requests. We'll do this by routing requests with a version number.
  • 7. 3- CONSISTENCY Data Formats always JSON JSON structure (single out put function for all success and errors) When dealing with dates and times, remember that consistency is key.
  • 9. DOCUMENTATION STEPS Install npm with nodejs Install APIDOC Npm install apidoc –g
  • 10.  Create a configuration file for apidoc like this one  Document your functions like this ->
  • 11.  Run command apidoc -i Model/ -o apidoc/  Enjoy the help for your API  Send it to the front end and Mobile team or any team that will consume your REST API
  • 12. SOAP APIS Part 4 (Last Part)
  • 13. PHP AND XML XML is another data formats to use with API beside JSON Human Readable Easy to parse and Query Better structural
  • 14. WILL YOU CHOOSE JSON OR XML IN THESE SITUATIONS AND WHY? 1. You are Designing a Backend in your company for a Mobile and front end web team to have an interface to manage some data (CRUD operations) 2. You are working in a tourism API for hotel availability (like booking.com) and returning data about room types , availabilities, prices and amenities ( internet , breakfast,..etc) this API will be consumed by many other websites . 3. You are making an API for prayer times per city that will be consumed by many websites
  • 15. CONVERT PHP ARRAY TO XML Code Output
  • 16. XML CLASSES IN PHP AddChiled($key,$valu e) AddAttribute ($key,$value) AsXML($filename)
  • 17. PARSING XML TO PHP ARRAY Code OutPut
  • 18. PARSE RSS FEED RSS Feed  RSS Feed ( example) It is a way to easily distribute a list of headlines, update notices, and sometimes content to a wide number of people.  The wonderful thing about RSS feeds is that they all implement the same basic structure. Every feed contains a wrapping "channel" tag. Then, each posting in your feed will be wrapped within an "item" tag. All of the information that we need can be accessed this way.
  • 19. SOAP AND WSDL SOAP  A - WSDL is the standard format for describing a web service.  B - WSDL definition describes how to access a web service and what operations it will perform.  C - WSDL is a language for describing how to interface with XML-based services WSDL  Simple Object access protocol  RPC style services  Uses WSDL  Based on XML only  One URL with methods as parameters  SOAP UI
  • 20. COMPARISON SHEET REST  Mainly JSON based but can use XML and text  Only HTTP  One end point per resource (pretty URL)  offer an effective way for interacting with lightweight clients, such as smartphones.  A REST client is more like a browser. It's a generic client that knows how to use a protocol and standardized methods,  70% of public APIs are REST SOAP  XML based  HTTP and other protocols (SMTP)  WSDL  One end point  SOAP, the client needs previous knowledge on everything it will be using, or it won't even begin the interaction
  • 21. SOAP Simple Object Access Protocol Uses XML WSDL Example : http://api.radioreference.c om/soap2/?wsdl&v=latest
  • 22. SOAP IN PHP Consuming a SOAP SERVICE SOAPClient (?) Think as PHP, what should the constructor of this class takes ? Creating a SOAP Service SOAPServer(?) Think as PHP what else is needed ?
  • 23. CONSUMING A SOAP SERVICE 1. Make sure SOAP extension is installed in your PHP  Phpinfo  Extension_loaded 2. Create object from soapClient Class and pass the WSDL file of your service to its constructor 3. Call any method of the WSDL 4. Enjoy
  • 24. LET SEE WE WANT TO CALL THE GET COUNTRIES LIST FUNCTION
  • 25. SOAP UI Can you test same service via just SOAP UI ?
  • 27. CREATING A SOAP WEB SERVICE VIA PHP STEP BY STEP 1. Prepare the class which includes your methods (api documentation is a MUST) 2. Install PHP2WSDL tool via our sweet composer 3. Generate the WSDL file for your service 4. Create the service 5. Test by SOAP UI
  • 28. PREPARE THE CLASS NO DOCUMENTATION = WSDL PROBLEMS
  • 32. TEST THE SERVICE BY SOAP UI