SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
TESTING AND
                       DOCUMENTING
                       PRAGMATIC/
                         RESTFUL
                          WEB API


              Arul Kumaran
Author of Restler - a Pragmatic/RESTful API framework
SETTING THE CONTEXT
           RIGHT
Reminding myself:
‣ I’m presenting in a
  JavaScript
  User Group

‣ I need to keep it short
  and simple at least to
  begin with
WHAT,WHY AND HOW

? is the beginning
‣ What is
  RESTful/Pragmatic API

‣ Why it requires
  documentation and testing

‣ How to do
  documentation and testing
WHAT IS RESTFUL/
         PRAGMATIC API
one leads to more
‣ What is Web API?
‣ What is REST?
‣ What is Pragmatic API?
WEB APPLICATION
PROGRAMMING INTERFACE
When it all started
Web is mainly used for
human to human           Data   + Presentation
communication using
HTML as the medium              =
which is Data and
Presentation put
together
WEB APPLICATION
PROGRAMMING INTERFACE
Then the change
By just sending pure
data as XML, JSON etc,     Data   Presentation
It can interpreted by a
client or another server
in a meaningful way
opening the door of
possibilities
REPRESENTATIONAL STATE
         TRANSFER
Set of constraints ‣
‣ Client-server
‣ Stateless        ‣ Code on demand
                       (optional)
‣ Cacheable
                   ‣ Uniform Interface
‣ Layered system
WHY PRAGMATIC WEB API

 REST is not easy
                                              is_request_ok
  500 Internal Server Error            B2
                               false                true


                                            false
                                              is_forbidden                            Accept exists?
       403 Forbidden                   B3                                        C3
                               true                                                        false
                                                                         true
                                             true

                                              is_authorized                           content_types_provided                   Accept-Language exists?
     401 Unauthorized                  B4                                        C4                                       D4
                               false                                                        true                                    false
                                                                         false                                    true
                                            false

                                              content_types_accepted:handler                                                   languages_provided                        Accept-Charset exists?
     400 Bad Request                   B5                                                                                 D5                                        E5
                               true                                                                                                 true                                      false
                                                                                                                  false                                     true
                                            false
                                              content_types_accepted                                                                                                     charsets_provided                     Accept-Encoding exists?
415 Unsupported Media Type             B6                                                                                                                           E6                                    F6
                               true                                                                                                                                           true                                  false
                                                                                                                                                            false                                 true
                                            false

                                              valid_entity_length                                                                                                                                              encodings_provided
413 Request Entity Too Large           B7                                                                                                                                                                 F7                                    G7
                               true                                                                                                                                                                                 true
                                                                                                                                                                                                  false                                  true
                                            false

                                              valid_content_headers                                                                                                      is_accept_ok
   501 Not Implemented                 B8                                                                      406 Not Acceptable                                   E8
                               true                                                                                                                 false                     true


                                            false
                                              options                                 If-Match exists?
DOCUMENTING API

Why it is needed?
‣ One Creates API and
 Another consumes

‣ There should be an
 easy way with out
 sitting next to each
 other
DOCUMENTING API

Why it is needed?
‣ Missing presentation
 layer makes it difficult
 to discover and
 navigate around API
DOCUMENTING API

How to do it?
‣ Where to write it?
‣ How to maintain it in
  sync with ever
  changing API
MEET SWAGGER

Start with JSON             ‣

‣ Write how your api will
 work
                            ‣ Build your API,
‣ What it takes in              Documentation and
                                Testing interface in one
‣ What it spits out             go
MEET SWAGGER UI

Or start with server            ‣

‣ It produces a resource list
‣ Declares each API             ‣ Swagger UI can use that to
  ‣ Available operations            produce a UI for testing &
  ‣ Parameters                      documentation
  ‣ Request Response models
  ‣ Error responses and
    description
RESOURCE LIST

{"apiVersion" : "0.2", "swaggerVersion" : "1.1", "basePath" : "http://
petstore.swagger.wordnik.com/api", "apis" : [
   {
      "path" : "/api-docs.{format}/user",
      "description" : ""
   },                                                 It’s like
   {                                              site-map to
      "path" : "/api-docs.{format}/pet",             your API
      "description" : ""
   }
]}
API DESCRIPTION
{"apiVersion" : "0.2", "swaggerVersion" : "1.1", "basePath" : "http://petstore.swagger.wordnik.com/api",
"resourcePath" : "/pet", "apis" : [
   {
       "path" : "/pet.{format}/{petId}",
       "description" : "Operations about pets",
       "operations" : [
            {
              "httpMethod" : "GET", "summary" : "Find pet by ID",
              "notes" : "Returns a pet based on ID",
              "responseClass" : "Pet", "nickname" : "getPetById",
              "parameters" : [ {
                     "name" : "petId", "description" : "ID of pet that needs to be fetched",
                     "paramType" : "path", "required" : true, "allowMultiple" : false, "dataType" : "string"
                 } ],
              "errorResponses" : [
                 { "code" : 400, "reason" : "Invalid ID supplied" },
                 { "code" : 404, "reason" : "Pet not found" }
              ]
            }
       ]
   }, //...
END RESULT
MEET LURACAST
              RESTLER
Write OO PHP           ‣

‣ Well written, Well
 commented PHP
 API becomes Well      ‣ RESTler Explorer
                           provides the
 written, Well
                           documentation and
 documented Web
                           testing interface
 API
OBJECT ORIENTED PHP
<?php
use	
  LuracastRestlerRestException;
use	
  DB_Session;
class	
  Authors
{
	
  	
  	
  	
  public	
  $dp;
	
  	
  	
  	
  /**
	
  	
  	
  	
  	
  *	
  @status	
  201
	
  	
  	
  	
  	
  *
	
  	
  	
  	
  	
  *	
  @param	
  string	
  $name	
  	
  {@from	
  body}
	
  	
  	
  	
  	
  *	
  @param	
  string	
  $email	
  {@type	
  email}	
  {@from	
  body}
	
  	
  	
  	
  	
  *
	
  	
  	
  	
  	
  *	
  @return	
  mixed
	
  	
  	
  	
  	
  */
	
  	
  	
  	
  function	
  post($name,	
  $email)
	
  	
  	
  	
  {
	
  	
  	
  	
  	
  	
  	
  	
  return	
  $this-­‐>dp-­‐>insert(compact('name',	
  'email'));
	
  	
  	
  	
  }
API EXPLORER
BEHAVIOR DRIVEN API
           DEVELOPMENT


Scenario:	
  Multiply                                                        Gherkin
	
  	
  	
  	
  Given	
  that	
  "n1"	
  is	
  set	
  to	
  "10"
	
  	
  	
  	
  And	
  "n2"	
  is	
  set	
  to	
  "5"
	
  	
  	
  	
  When	
  I	
  request	
  "/examples/_002_minimal/math/multiply/{n1}/{n2}"
	
  	
  	
  	
  And	
  the	
  response	
  is	
  JSON
	
  	
  	
  	
  And	
  the	
  response	
  has	
  a	
  "result"	
  property
	
  	
  	
  	
  And	
  the	
  "result"	
  property	
  equals	
  50
                                                                         Savoury pickled cucumber
WHAT,WHY AND HOW

RECAP
‣ What is
  RESTful/Pragmatic API

‣ Why it requires
  documentation and testing

‣ How to do
  documentation and testing
ABOUT ME




@_Arul     @Luracast

Contenu connexe

Plus de Arul Kumaran

Accelerating Xamarin Development
Accelerating Xamarin DevelopmentAccelerating Xamarin Development
Accelerating Xamarin DevelopmentArul Kumaran
 
iOS Native Development with Xamarin
iOS Native Development with XamariniOS Native Development with Xamarin
iOS Native Development with XamarinArul Kumaran
 
Less Verbose ActionScript 3.0 - Write less and do more!
Less Verbose ActionScript 3.0 - Write less and do more!Less Verbose ActionScript 3.0 - Write less and do more!
Less Verbose ActionScript 3.0 - Write less and do more!Arul Kumaran
 
Using Titanium for multi-platform development including iPhone and Android
Using Titanium for multi-platform development including iPhone and AndroidUsing Titanium for multi-platform development including iPhone and Android
Using Titanium for multi-platform development including iPhone and AndroidArul Kumaran
 
UI Interactions Testing with FlexMonkey
UI Interactions Testing with FlexMonkeyUI Interactions Testing with FlexMonkey
UI Interactions Testing with FlexMonkeyArul Kumaran
 
Flex Production Tips & Techniques
Flex Production Tips & TechniquesFlex Production Tips & Techniques
Flex Production Tips & TechniquesArul Kumaran
 

Plus de Arul Kumaran (6)

Accelerating Xamarin Development
Accelerating Xamarin DevelopmentAccelerating Xamarin Development
Accelerating Xamarin Development
 
iOS Native Development with Xamarin
iOS Native Development with XamariniOS Native Development with Xamarin
iOS Native Development with Xamarin
 
Less Verbose ActionScript 3.0 - Write less and do more!
Less Verbose ActionScript 3.0 - Write less and do more!Less Verbose ActionScript 3.0 - Write less and do more!
Less Verbose ActionScript 3.0 - Write less and do more!
 
Using Titanium for multi-platform development including iPhone and Android
Using Titanium for multi-platform development including iPhone and AndroidUsing Titanium for multi-platform development including iPhone and Android
Using Titanium for multi-platform development including iPhone and Android
 
UI Interactions Testing with FlexMonkey
UI Interactions Testing with FlexMonkeyUI Interactions Testing with FlexMonkey
UI Interactions Testing with FlexMonkey
 
Flex Production Tips & Techniques
Flex Production Tips & TechniquesFlex Production Tips & Techniques
Flex Production Tips & Techniques
 

Dernier

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Dernier (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Testing and Documenting Pragmatic / RESTful Web API

  • 1. TESTING AND DOCUMENTING PRAGMATIC/ RESTFUL WEB API Arul Kumaran Author of Restler - a Pragmatic/RESTful API framework
  • 2. SETTING THE CONTEXT RIGHT Reminding myself: ‣ I’m presenting in a JavaScript User Group ‣ I need to keep it short and simple at least to begin with
  • 3. WHAT,WHY AND HOW ? is the beginning ‣ What is RESTful/Pragmatic API ‣ Why it requires documentation and testing ‣ How to do documentation and testing
  • 4. WHAT IS RESTFUL/ PRAGMATIC API one leads to more ‣ What is Web API? ‣ What is REST? ‣ What is Pragmatic API?
  • 5. WEB APPLICATION PROGRAMMING INTERFACE When it all started Web is mainly used for human to human Data + Presentation communication using HTML as the medium = which is Data and Presentation put together
  • 6. WEB APPLICATION PROGRAMMING INTERFACE Then the change By just sending pure data as XML, JSON etc, Data Presentation It can interpreted by a client or another server in a meaningful way opening the door of possibilities
  • 7. REPRESENTATIONAL STATE TRANSFER Set of constraints ‣ ‣ Client-server ‣ Stateless ‣ Code on demand (optional) ‣ Cacheable ‣ Uniform Interface ‣ Layered system
  • 8. WHY PRAGMATIC WEB API REST is not easy is_request_ok 500 Internal Server Error B2 false true false is_forbidden Accept exists? 403 Forbidden B3 C3 true false true true is_authorized content_types_provided Accept-Language exists? 401 Unauthorized B4 C4 D4 false true false false true false content_types_accepted:handler languages_provided Accept-Charset exists? 400 Bad Request B5 D5 E5 true true false false true false content_types_accepted charsets_provided Accept-Encoding exists? 415 Unsupported Media Type B6 E6 F6 true true false false true false valid_entity_length encodings_provided 413 Request Entity Too Large B7 F7 G7 true true false true false valid_content_headers is_accept_ok 501 Not Implemented B8 406 Not Acceptable E8 true false true false options If-Match exists?
  • 9. DOCUMENTING API Why it is needed? ‣ One Creates API and Another consumes ‣ There should be an easy way with out sitting next to each other
  • 10. DOCUMENTING API Why it is needed? ‣ Missing presentation layer makes it difficult to discover and navigate around API
  • 11. DOCUMENTING API How to do it? ‣ Where to write it? ‣ How to maintain it in sync with ever changing API
  • 12. MEET SWAGGER Start with JSON ‣ ‣ Write how your api will work ‣ Build your API, ‣ What it takes in Documentation and Testing interface in one ‣ What it spits out go
  • 13. MEET SWAGGER UI Or start with server ‣ ‣ It produces a resource list ‣ Declares each API ‣ Swagger UI can use that to ‣ Available operations produce a UI for testing & ‣ Parameters documentation ‣ Request Response models ‣ Error responses and description
  • 14. RESOURCE LIST {"apiVersion" : "0.2", "swaggerVersion" : "1.1", "basePath" : "http:// petstore.swagger.wordnik.com/api", "apis" : [ { "path" : "/api-docs.{format}/user", "description" : "" }, It’s like { site-map to "path" : "/api-docs.{format}/pet", your API "description" : "" } ]}
  • 15. API DESCRIPTION {"apiVersion" : "0.2", "swaggerVersion" : "1.1", "basePath" : "http://petstore.swagger.wordnik.com/api", "resourcePath" : "/pet", "apis" : [ { "path" : "/pet.{format}/{petId}", "description" : "Operations about pets", "operations" : [ { "httpMethod" : "GET", "summary" : "Find pet by ID", "notes" : "Returns a pet based on ID", "responseClass" : "Pet", "nickname" : "getPetById", "parameters" : [ { "name" : "petId", "description" : "ID of pet that needs to be fetched", "paramType" : "path", "required" : true, "allowMultiple" : false, "dataType" : "string" } ], "errorResponses" : [ { "code" : 400, "reason" : "Invalid ID supplied" }, { "code" : 404, "reason" : "Pet not found" } ] } ] }, //...
  • 17. MEET LURACAST RESTLER Write OO PHP ‣ ‣ Well written, Well commented PHP API becomes Well ‣ RESTler Explorer provides the written, Well documentation and documented Web testing interface API
  • 18. OBJECT ORIENTED PHP <?php use  LuracastRestlerRestException; use  DB_Session; class  Authors {        public  $dp;        /**          *  @status  201          *          *  @param  string  $name    {@from  body}          *  @param  string  $email  {@type  email}  {@from  body}          *          *  @return  mixed          */        function  post($name,  $email)        {                return  $this-­‐>dp-­‐>insert(compact('name',  'email'));        }
  • 20. BEHAVIOR DRIVEN API DEVELOPMENT Scenario:  Multiply Gherkin        Given  that  "n1"  is  set  to  "10"        And  "n2"  is  set  to  "5"        When  I  request  "/examples/_002_minimal/math/multiply/{n1}/{n2}"        And  the  response  is  JSON        And  the  response  has  a  "result"  property        And  the  "result"  property  equals  50 Savoury pickled cucumber
  • 21. WHAT,WHY AND HOW RECAP ‣ What is RESTful/Pragmatic API ‣ Why it requires documentation and testing ‣ How to do documentation and testing
  • 22. ABOUT ME @_Arul @Luracast