SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
API Basics
by Ritul Chaudhary
SDN - Software defined
networking
uses software to define/modify
networks.
Before SDN:
the data plane and control plane were
tied together as one.
What SDN does:
on a network device, data enters & leaves
through the data plane
decisions of what to do with the data are
made by the control plane
this allows network configuration &
decisions to be completed through a remote
control plane.
to make SDN features on these devices
accessible over the network, they are
exposed through an API
API: Application Programming Interface
REST: REpresentational State Transfer
An API enables 2 pieces of software to
communicate with each other.
What is REST?
REST is an API framework built on HTTP
when you combine REST and API, you see a
simple service interface that enables
applications or people to use HTTP protocol to
request objects/information
a REST API service sends all requests &
responses over TCP/TLS connections using text
A Look under the hood at REST
Protocol: http:// or https:// indicates whether the server
host is open (http) or secured (https).
Domain name: maps.googleapis.com is the domain name of the
server or host that is providing the web service, and may include port
number such as :8080.
Resource Path: /maps/api/geocode/json is the resource path
of the API call. This path tends to use plural nouns and English-
language descriptive words.
Parameter: ?address=sanjose is a parameter that provides
details for the service to filter, scope, or paginate the response data.
Often, parameters are optional.
HTTP verb CRUD action
POST create
GET read
PUT update
PATCH update
DELETE delete
A valid REST API request typically gets a 200 OK response
whereas an invalid request gets a 404 Not Found
Some REST APIs do not require authentication, but many do
Requests and responses may use headers to pass
information to form the service
Some APIs use custom headers for authentication
Some headers carry metadata to help define the request or
response
To know more about REST headers: https://www.ibm.com/
support/knowledgecenter/en/SSQP76_8.10.x/
com.ibm.odm.itoa.ref/topics/ref_rest_headers_codes.html
REST Payloads
Body of request/response may include a
payload that carries data to & from the
service
Data format of the payload: JSON or XML
JSON: JavaScript Object Notation
XML: eXtensible Markup Language
In JSON, the object is an unordered set of name-
value pairs.
An object begins with { (left brace) & ends with }
(right brace)
You can check the “Content-Type” header to
know for certain what the service is sending
Getting started with REST APIs
When documenting REST APIs, the trend is to use
open standards such as OpenAPI(Swagger) or
RAML to document requests, responses, headers &
parameters.
Read more about OpenAPI: https://swagger.io/
docs/specification/about/
Read more about RAML: https://raml.org/about-
raml
1. Finding the API documentation
2. Figuring out authentication
Read the documentation for the API
An endpoint is the URI where you send an HTTP
request. The path of an endpoint can include
notable information.
e.g. to ensure compatibility, your API provider
might specify a particular version of the API in the
endpoint itself.
An API provider can make an endpoint URI private
and accessible only through a VPN or make it
completely public on the Internet.
You can learn which end points are available by
reading the documentation.
3. Determining the end points
GET, POST, PUT, DELETE
Many API documentation sites use color-coding
for each verb.
To compose a request:
• determine the verb that reflects the action you
want to perform
• determine the endpoint upon which you want to
perform the action
4. Understanding REST API verbs
parameters help to scope, filter or clarify a
request
Pagination(returning pages of data from a
request) is sometimes implemented by using
query parameters in the URI
e.g.
• max: to specify max no. of items to return
• &: used between 2 parameters
5. Understanding REST API parameters
When sending a request, data formats are aka
payloads.
e.g. JSON, XML
For each data format, the data maybe
contained in the body of the request
POST, PUT, PATCH requests typically include
data requests or optional parameters as part
of the request.
GET responses nearly always include data.
6. Understanding REST API data formats
1. cURL: linux command line application
2. Postman: Chrome browser plugin &
application
3. Python Requests: Python library for
scripting
4. OpenAPI/Swagger: Dynamic API
documentation
Some REST API tools
References
https://developer.cisco.com/learning/modules/rest-api-
fundamentals/what-are-rest-apis/step/1
https://developer.cisco.com/learning/modules/rest-api-
fundamentals/getting-started-rest-apis/step/1

Weitere ähnliche Inhalte

Was ist angesagt?

ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
habib_786
 

Was ist angesagt? (20)

Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 
Swagger
SwaggerSwagger
Swagger
 
What is an API?
What is an API?What is an API?
What is an API?
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
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
 
Basic of API
Basic of APIBasic of API
Basic of API
 
Rest api standards and best practices
Rest api standards and best practicesRest api standards and best practices
Rest api standards and best practices
 
Introduction to API
Introduction to APIIntroduction to API
Introduction to API
 
Django Rest Framework - Building a Web API
Django Rest Framework - Building a Web APIDjango Rest Framework - Building a Web API
Django Rest Framework - Building a Web API
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0API Docs with OpenAPI 3.0
API Docs with OpenAPI 3.0
 
Introduction to APIs (Application Programming Interface)
Introduction to APIs (Application Programming Interface) Introduction to APIs (Application Programming Interface)
Introduction to APIs (Application Programming Interface)
 
Rest api-basic
Rest api-basicRest api-basic
Rest api-basic
 
REST-API introduction for developers
REST-API introduction for developersREST-API introduction for developers
REST-API introduction for developers
 
Designing APIs with OpenAPI Spec
Designing APIs with OpenAPI SpecDesigning APIs with OpenAPI Spec
Designing APIs with OpenAPI Spec
 
API Presentation
API PresentationAPI Presentation
API Presentation
 
Communication Strategies for a Virtual Age Peer Graded Assignment - LINKEDIN
Communication Strategies for a Virtual Age Peer Graded Assignment - LINKEDINCommunication Strategies for a Virtual Age Peer Graded Assignment - LINKEDIN
Communication Strategies for a Virtual Age Peer Graded Assignment - LINKEDIN
 
REST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical LookREST vs. GraphQL: Critical Look
REST vs. GraphQL: Critical Look
 
Introduction to Swagger
Introduction to SwaggerIntroduction to Swagger
Introduction to Swagger
 

Ähnlich wie API Basics

Ähnlich wie API Basics (20)

Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
Apitesting.pptx
Apitesting.pptxApitesting.pptx
Apitesting.pptx
 
Best Practices in Api Design
Best Practices in Api DesignBest Practices in Api Design
Best Practices in Api Design
 
ReSTful API Final
ReSTful API FinalReSTful API Final
ReSTful API Final
 
Lunacloud's Compute RESTful API - Programmer's Guide
Lunacloud's Compute RESTful API - Programmer's GuideLunacloud's Compute RESTful API - Programmer's Guide
Lunacloud's Compute RESTful API - Programmer's Guide
 
Rest API Automation with REST Assured
Rest API Automation with REST AssuredRest API Automation with REST Assured
Rest API Automation with REST Assured
 
WebApp #3 : API
WebApp #3 : APIWebApp #3 : API
WebApp #3 : API
 
API Testing Basics.pptx
API Testing Basics.pptxAPI Testing Basics.pptx
API Testing Basics.pptx
 
Salesforce REST API
Salesforce  REST API Salesforce  REST API
Salesforce REST API
 
Api design and development
Api design and developmentApi design and development
Api design and development
 
Rest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbookRest api best practices – comprehensive handbook
Rest api best practices – comprehensive handbook
 
Slim Framework
Slim FrameworkSlim Framework
Slim Framework
 
Rest web service
Rest web serviceRest web service
Rest web service
 
Session 8 Android Web Services - Part 1.pdf
Session 8 Android Web Services - Part 1.pdfSession 8 Android Web Services - Part 1.pdf
Session 8 Android Web Services - Part 1.pdf
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
 
C# REST API
C# REST APIC# REST API
C# REST API
 
Restful api
Restful apiRestful api
Restful api
 
Standards of rest api
Standards of rest apiStandards of rest api
Standards of rest api
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
 
What are restful web services?
What are restful web services?What are restful web services?
What are restful web services?
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

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...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

API Basics

  • 2. SDN - Software defined networking uses software to define/modify networks. Before SDN: the data plane and control plane were tied together as one.
  • 3. What SDN does: on a network device, data enters & leaves through the data plane decisions of what to do with the data are made by the control plane this allows network configuration & decisions to be completed through a remote control plane. to make SDN features on these devices accessible over the network, they are exposed through an API
  • 4. API: Application Programming Interface REST: REpresentational State Transfer An API enables 2 pieces of software to communicate with each other.
  • 5. What is REST? REST is an API framework built on HTTP when you combine REST and API, you see a simple service interface that enables applications or people to use HTTP protocol to request objects/information a REST API service sends all requests & responses over TCP/TLS connections using text
  • 6. A Look under the hood at REST Protocol: http:// or https:// indicates whether the server host is open (http) or secured (https). Domain name: maps.googleapis.com is the domain name of the server or host that is providing the web service, and may include port number such as :8080. Resource Path: /maps/api/geocode/json is the resource path of the API call. This path tends to use plural nouns and English- language descriptive words. Parameter: ?address=sanjose is a parameter that provides details for the service to filter, scope, or paginate the response data. Often, parameters are optional.
  • 7. HTTP verb CRUD action POST create GET read PUT update PATCH update DELETE delete
  • 8. A valid REST API request typically gets a 200 OK response whereas an invalid request gets a 404 Not Found Some REST APIs do not require authentication, but many do Requests and responses may use headers to pass information to form the service Some APIs use custom headers for authentication Some headers carry metadata to help define the request or response To know more about REST headers: https://www.ibm.com/ support/knowledgecenter/en/SSQP76_8.10.x/ com.ibm.odm.itoa.ref/topics/ref_rest_headers_codes.html
  • 9. REST Payloads Body of request/response may include a payload that carries data to & from the service Data format of the payload: JSON or XML JSON: JavaScript Object Notation XML: eXtensible Markup Language
  • 10. In JSON, the object is an unordered set of name- value pairs. An object begins with { (left brace) & ends with } (right brace) You can check the “Content-Type” header to know for certain what the service is sending
  • 11. Getting started with REST APIs When documenting REST APIs, the trend is to use open standards such as OpenAPI(Swagger) or RAML to document requests, responses, headers & parameters. Read more about OpenAPI: https://swagger.io/ docs/specification/about/ Read more about RAML: https://raml.org/about- raml 1. Finding the API documentation 2. Figuring out authentication Read the documentation for the API
  • 12. An endpoint is the URI where you send an HTTP request. The path of an endpoint can include notable information. e.g. to ensure compatibility, your API provider might specify a particular version of the API in the endpoint itself. An API provider can make an endpoint URI private and accessible only through a VPN or make it completely public on the Internet. You can learn which end points are available by reading the documentation. 3. Determining the end points
  • 13. GET, POST, PUT, DELETE Many API documentation sites use color-coding for each verb. To compose a request: • determine the verb that reflects the action you want to perform • determine the endpoint upon which you want to perform the action 4. Understanding REST API verbs
  • 14. parameters help to scope, filter or clarify a request Pagination(returning pages of data from a request) is sometimes implemented by using query parameters in the URI e.g. • max: to specify max no. of items to return • &: used between 2 parameters 5. Understanding REST API parameters
  • 15. When sending a request, data formats are aka payloads. e.g. JSON, XML For each data format, the data maybe contained in the body of the request POST, PUT, PATCH requests typically include data requests or optional parameters as part of the request. GET responses nearly always include data. 6. Understanding REST API data formats
  • 16. 1. cURL: linux command line application 2. Postman: Chrome browser plugin & application 3. Python Requests: Python library for scripting 4. OpenAPI/Swagger: Dynamic API documentation Some REST API tools