(Go: >> BACK << -|- >> HOME <<)

SlideShare a Scribd company logo
API Design & Devp with AT
What is an API
Similarly, an API lists a bunch of
operations that developers can use,
along with a description of what they
do.
How an API works
API protocols and Architecture
SOAP
XML used as data format,
- Too verbose on client and
server side
- Still used by banks and
Telcos
REST
GraphQL
HTTP Basics
Anatomy of an HTTP Request
- The version of the HTTP protocol.
- Optional headers that convey additional information
for the servers.
- Body, for some methods like POST, similar to those in
responses, which contain the resource sent.
Anatomy of an HTTP Response
- HTTP version protocol they follow.
- Status code indicating if the
request has been successful, or
not, and why.
- Status message a
non-authoritative short description
of the status code.
- HTTP headers like those for
requests.
- Optionally a body containing the
fetched resource.
Representing Data: REST Data formats
curl -i -u application_name:application_password
--data '{"password": "my_password"}'
http://localhost/myapi/1/auth?username=my_usernam
e --header 'Content-Type: application/json'
--header 'Accept: application/json'
API Authentication
- There are three common API
authentication schemes;
- Basic Auth
- API keys
- OAuth
Authentication: Basic Authentication
- Basic Auth only requires a
username and password.
- Passed on via Authorization
HTTP header
- Server returns http code 401 to let
client know authorization failed
API Key Authentication
- key is usually a long series of letters
and numbers that is distinct from the
account owner's login password
- keys are used simply so the user
does not have to give out their
password
- You can put the key in the
Authorization header or add the key
onto the URL
(http://example.com?api_key=my_se
cret_key)
Open Authorization (OAuth)
- Automates key exchange by providing a
standard way for the client to get a key from
server through walking user via simple steps.
- OAuth 2 involves;
- User: Person who wants to connect two
websites they use
- Client: Website that will be granted
access to the user's data
- Server: website that has the user's
data
API design basics
- Resources are the nouns of APIs
- Key pointers;
- Decide what resource(s) need to be
available.
- Assign URLs to those resources.
- Decide what actions the client should
be allowed to perform on those
resources.
- Figure out what pieces of data are
required for each action and what
format they should be in.
Example Rest API actions & url endpoints
API Development & testing tools
Try out Africa’s Talking APIs
Thank You
David Okwii,
Developer relations, Africa’s talking
dokwi@africastalking.com
@oquidave on Twitter
More cool Resources:
● Api security checklist
https://github.com/shieldfy/API-Security-Checklist
● API best practices:
https://www.vinaysahni.com/best-practices-for-a-prag
matic-restful-api
● Mozilla:
https://developer.mozilla.org/en-US/docs/Web/HTTP/
Overview
● Zapier: https://zapier.com/learn/apis/

More Related Content

What's hot

REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
Halil Burak Cetinkaya
 
Bt0083, server side programming theory
Bt0083, server side programming theoryBt0083, server side programming theory
Bt0083, server side programming theory
smumbahelp
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
Robert Wilson
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
nbuddharaju
 
Site opsys
Site opsysSite opsys
Site opsys
Thomas George
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
Mahek Merchant
 
SQL Injection Attacks
SQL Injection AttacksSQL Injection Attacks
SQL Injection Attacks
Compare Infobase Limited
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
Robert MacLean
 
REST and RESTful Web Services
REST and RESTful Web ServicesREST and RESTful Web Services
REST and RESTful Web Services
Kasun Madusanke
 
gofortution
gofortutiongofortution
gofortution
gofortution
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State Transfer
Peter R. Egli
 
Top open source tools to consider for web service performance testing
Top open source tools to consider for web service performance testingTop open source tools to consider for web service performance testing
Top open source tools to consider for web service performance testing
Alisha Henderson
 
Intro to flask2
Intro to flask2Intro to flask2
Intro to flask2
Mohamed Essam
 
Representational State Transfer (REST)
Representational State Transfer (REST)Representational State Transfer (REST)
Representational State Transfer (REST)
Abhay Ananda Shukla
 
Web crawler
Web crawlerWeb crawler
Web crawler
anusha kurapati
 
Day01 api
Day01   apiDay01   api
Rest api-basic
Rest api-basicRest api-basic
Rest api-basic
Amila Sampath
 
Cors (cross origin request sharing) in mule
Cors (cross origin request sharing) in muleCors (cross origin request sharing) in mule
Cors (cross origin request sharing) in mule
Ankit Lawaniya
 
Restful api
Restful apiRestful api
Restful api
Anurag Srivastava
 
Learn How To Use CA PPM REST API in 2 minutes!
Learn How To Use CA PPM REST API in 2 minutes!Learn How To Use CA PPM REST API in 2 minutes!
Learn How To Use CA PPM REST API in 2 minutes!
Prominder Nayar
 

What's hot (20)

REST & RESTful Web Services
REST & RESTful Web ServicesREST & RESTful Web Services
REST & RESTful Web Services
 
Bt0083, server side programming theory
Bt0083, server side programming theoryBt0083, server side programming theory
Bt0083, server side programming theory
 
The Rest Architectural Style
The Rest Architectural StyleThe Rest Architectural Style
The Rest Architectural Style
 
Overview of RESTful web services
Overview of RESTful web servicesOverview of RESTful web services
Overview of RESTful web services
 
Site opsys
Site opsysSite opsys
Site opsys
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
 
SQL Injection Attacks
SQL Injection AttacksSQL Injection Attacks
SQL Injection Attacks
 
JSON and REST
JSON and RESTJSON and REST
JSON and REST
 
REST and RESTful Web Services
REST and RESTful Web ServicesREST and RESTful Web Services
REST and RESTful Web Services
 
gofortution
gofortutiongofortution
gofortution
 
REST - Representational State Transfer
REST - Representational State TransferREST - Representational State Transfer
REST - Representational State Transfer
 
Top open source tools to consider for web service performance testing
Top open source tools to consider for web service performance testingTop open source tools to consider for web service performance testing
Top open source tools to consider for web service performance testing
 
Intro to flask2
Intro to flask2Intro to flask2
Intro to flask2
 
Representational State Transfer (REST)
Representational State Transfer (REST)Representational State Transfer (REST)
Representational State Transfer (REST)
 
Web crawler
Web crawlerWeb crawler
Web crawler
 
Day01 api
Day01   apiDay01   api
Day01 api
 
Rest api-basic
Rest api-basicRest api-basic
Rest api-basic
 
Cors (cross origin request sharing) in mule
Cors (cross origin request sharing) in muleCors (cross origin request sharing) in mule
Cors (cross origin request sharing) in mule
 
Restful api
Restful apiRestful api
Restful api
 
Learn How To Use CA PPM REST API in 2 minutes!
Learn How To Use CA PPM REST API in 2 minutes!Learn How To Use CA PPM REST API in 2 minutes!
Learn How To Use CA PPM REST API in 2 minutes!
 

Similar to Api design and development

Best Practices in Api Design
Best Practices in Api DesignBest Practices in Api Design
Best Practices in Api Design
Muhammad Aamir ...
 
Restful web services
Restful web servicesRestful web services
Restful web services
MD Sayem Ahmed
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
Jeelani Shaik
 
Hia 1691-using iib-to_support_api_economy
Hia 1691-using iib-to_support_api_economyHia 1691-using iib-to_support_api_economy
Hia 1691-using iib-to_support_api_economy
Andrew Coleman
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
Tiago Knoch
 
Apitesting.pptx
Apitesting.pptxApitesting.pptx
Apitesting.pptx
NamanVerma88
 
RAML - The architecture
RAML  - The architectureRAML  - The architecture
RAML - The architecture
Ankush Sharma
 
IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay NagchowdhuryIBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
Karen Broughton-Mabbitt
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
Er. Prashant Veer Singh
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
Jitendra Bafna
 
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
Lunacloud
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
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
 
Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207
Lori Head
 
Rest and Sling Resolution
Rest and Sling ResolutionRest and Sling Resolution
Rest and Sling Resolution
DEEPAK KHETAWAT
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
BIOVIA
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
Li Yi
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
Compare Infobase Limited
 
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
 
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
 

Similar to Api design and development (20)

Best Practices in Api Design
Best Practices in Api DesignBest Practices in Api Design
Best Practices in Api Design
 
Restful web services
Restful web servicesRestful web services
Restful web services
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
Hia 1691-using iib-to_support_api_economy
Hia 1691-using iib-to_support_api_economyHia 1691-using iib-to_support_api_economy
Hia 1691-using iib-to_support_api_economy
 
ASP.NET Mvc 4 web api
ASP.NET Mvc 4 web apiASP.NET Mvc 4 web api
ASP.NET Mvc 4 web api
 
Apitesting.pptx
Apitesting.pptxApitesting.pptx
Apitesting.pptx
 
RAML - The architecture
RAML  - The architectureRAML  - The architecture
RAML - The architecture
 
IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay NagchowdhuryIBM Integration Bus and REST APIs - Sanjay Nagchowdhury
IBM Integration Bus and REST APIs - Sanjay Nagchowdhury
 
Salesforce Integration
Salesforce IntegrationSalesforce Integration
Salesforce Integration
 
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
MuleSoft Surat Virtual Meetup#21 - MuleSoft API and RAML Design Best Practice...
 
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
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
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
 
Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207Advanced Web Design And Development BIT 3207
Advanced Web Design And Development BIT 3207
 
Rest and Sling Resolution
Rest and Sling ResolutionRest and Sling Resolution
Rest and Sling Resolution
 
(ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service (ATS6-PLAT04) Query service
(ATS6-PLAT04) Query service
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
 
Web services - REST and SOAP
Web services - REST and SOAPWeb services - REST and SOAP
Web services - REST and SOAP
 
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
 
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
 

Recently uploaded

Accelerating Migrations = Recommendations
Accelerating Migrations = RecommendationsAccelerating Migrations = Recommendations
Accelerating Migrations = Recommendations
isBullShit
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
Baishakhi Ray
 
Integrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecaseIntegrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecase
shyamraj55
 
Retrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with RagasRetrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with Ragas
Zilliz
 
History and Introduction for Generative AI ( GenAI )
History and Introduction for Generative AI ( GenAI )History and Introduction for Generative AI ( GenAI )
History and Introduction for Generative AI ( GenAI )
Badri_Bady
 
Uncharted Together- Navigating AI's New Frontiers in Libraries
Uncharted Together- Navigating AI's New Frontiers in LibrariesUncharted Together- Navigating AI's New Frontiers in Libraries
Uncharted Together- Navigating AI's New Frontiers in Libraries
Brian Pichman
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
DianaGray10
 
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and DisadvantagesBLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
SAI KAILASH R
 
CheckPoint Firewall Presentation CCSA.pdf
CheckPoint Firewall Presentation CCSA.pdfCheckPoint Firewall Presentation CCSA.pdf
CheckPoint Firewall Presentation CCSA.pdf
ssuser137992
 
kk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdfkk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdf
KIRAN KV
 
NVIDIA at Breakthrough Discuss for Space Exploration
NVIDIA at Breakthrough Discuss for Space ExplorationNVIDIA at Breakthrough Discuss for Space Exploration
NVIDIA at Breakthrough Discuss for Space Exploration
Alison B. Lowndes
 
Finetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and DefendingFinetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and Defending
Priyanka Aash
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
ankush9927
 
Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024
siddu769252
 
Keynote : Presentation on SASE Technology
Keynote : Presentation on SASE TechnologyKeynote : Presentation on SASE Technology
Keynote : Presentation on SASE Technology
Priyanka Aash
 
Perth MuleSoft Meetup July 2024
Perth MuleSoft Meetup July 2024Perth MuleSoft Meetup July 2024
Perth MuleSoft Meetup July 2024
Michael Price
 
What's New in Teams Calling, Meetings, Devices June 2024
What's New in Teams Calling, Meetings, Devices June 2024What's New in Teams Calling, Meetings, Devices June 2024
What's New in Teams Calling, Meetings, Devices June 2024
Stephanie Beckett
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
DianaGray10
 
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
bellared2
 
Acumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptxAcumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptx
BrainSell Technologies
 

Recently uploaded (20)

Accelerating Migrations = Recommendations
Accelerating Migrations = RecommendationsAccelerating Migrations = Recommendations
Accelerating Migrations = Recommendations
 
Semantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software DevelopmentSemantic-Aware Code Model: Elevating the Future of Software Development
Semantic-Aware Code Model: Elevating the Future of Software Development
 
Integrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecaseIntegrating Kafka with MuleSoft 4 and usecase
Integrating Kafka with MuleSoft 4 and usecase
 
Retrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with RagasRetrieval Augmented Generation Evaluation with Ragas
Retrieval Augmented Generation Evaluation with Ragas
 
History and Introduction for Generative AI ( GenAI )
History and Introduction for Generative AI ( GenAI )History and Introduction for Generative AI ( GenAI )
History and Introduction for Generative AI ( GenAI )
 
Uncharted Together- Navigating AI's New Frontiers in Libraries
Uncharted Together- Navigating AI's New Frontiers in LibrariesUncharted Together- Navigating AI's New Frontiers in Libraries
Uncharted Together- Navigating AI's New Frontiers in Libraries
 
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision MakingConnector Corner: Leveraging Snowflake Integration for Smarter Decision Making
Connector Corner: Leveraging Snowflake Integration for Smarter Decision Making
 
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and DisadvantagesBLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
BLOCKCHAIN TECHNOLOGY - Advantages and Disadvantages
 
CheckPoint Firewall Presentation CCSA.pdf
CheckPoint Firewall Presentation CCSA.pdfCheckPoint Firewall Presentation CCSA.pdf
CheckPoint Firewall Presentation CCSA.pdf
 
kk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdfkk vathada _digital transformation frameworks_2024.pdf
kk vathada _digital transformation frameworks_2024.pdf
 
NVIDIA at Breakthrough Discuss for Space Exploration
NVIDIA at Breakthrough Discuss for Space ExplorationNVIDIA at Breakthrough Discuss for Space Exploration
NVIDIA at Breakthrough Discuss for Space Exploration
 
Finetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and DefendingFinetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and Defending
 
Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10Computer HARDWARE presenattion by CWD students class 10
Computer HARDWARE presenattion by CWD students class 10
 
Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024Generative AI Reasoning Tech Talk - July 2024
Generative AI Reasoning Tech Talk - July 2024
 
Keynote : Presentation on SASE Technology
Keynote : Presentation on SASE TechnologyKeynote : Presentation on SASE Technology
Keynote : Presentation on SASE Technology
 
Perth MuleSoft Meetup July 2024
Perth MuleSoft Meetup July 2024Perth MuleSoft Meetup July 2024
Perth MuleSoft Meetup July 2024
 
What's New in Teams Calling, Meetings, Devices June 2024
What's New in Teams Calling, Meetings, Devices June 2024What's New in Teams Calling, Meetings, Devices June 2024
What's New in Teams Calling, Meetings, Devices June 2024
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
 
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
Russian Girls Call Navi Mumbai 🎈🔥9920725232 🔥💋🎈 Provide Best And Top Girl Ser...
 
Acumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptxAcumatica vs. Sage Intacct _Construction_July (1).pptx
Acumatica vs. Sage Intacct _Construction_July (1).pptx
 

Api design and development

  • 1. API Design & Devp with AT
  • 2. What is an API Similarly, an API lists a bunch of operations that developers can use, along with a description of what they do.
  • 3. How an API works
  • 4. API protocols and Architecture
  • 5. SOAP XML used as data format, - Too verbose on client and server side - Still used by banks and Telcos
  • 9. Anatomy of an HTTP Request - The version of the HTTP protocol. - Optional headers that convey additional information for the servers. - Body, for some methods like POST, similar to those in responses, which contain the resource sent.
  • 10. Anatomy of an HTTP Response - HTTP version protocol they follow. - Status code indicating if the request has been successful, or not, and why. - Status message a non-authoritative short description of the status code. - HTTP headers like those for requests. - Optionally a body containing the fetched resource.
  • 11. Representing Data: REST Data formats curl -i -u application_name:application_password --data '{"password": "my_password"}' http://localhost/myapi/1/auth?username=my_usernam e --header 'Content-Type: application/json' --header 'Accept: application/json'
  • 12. API Authentication - There are three common API authentication schemes; - Basic Auth - API keys - OAuth
  • 13. Authentication: Basic Authentication - Basic Auth only requires a username and password. - Passed on via Authorization HTTP header - Server returns http code 401 to let client know authorization failed
  • 14. API Key Authentication - key is usually a long series of letters and numbers that is distinct from the account owner's login password - keys are used simply so the user does not have to give out their password - You can put the key in the Authorization header or add the key onto the URL (http://example.com?api_key=my_se cret_key)
  • 15. Open Authorization (OAuth) - Automates key exchange by providing a standard way for the client to get a key from server through walking user via simple steps. - OAuth 2 involves; - User: Person who wants to connect two websites they use - Client: Website that will be granted access to the user's data - Server: website that has the user's data
  • 16. API design basics - Resources are the nouns of APIs - Key pointers; - Decide what resource(s) need to be available. - Assign URLs to those resources. - Decide what actions the client should be allowed to perform on those resources. - Figure out what pieces of data are required for each action and what format they should be in.
  • 17. Example Rest API actions & url endpoints
  • 18. API Development & testing tools
  • 19. Try out Africa’s Talking APIs
  • 20. Thank You David Okwii, Developer relations, Africa’s talking dokwi@africastalking.com @oquidave on Twitter More cool Resources: ● Api security checklist https://github.com/shieldfy/API-Security-Checklist ● API best practices: https://www.vinaysahni.com/best-practices-for-a-prag matic-restful-api ● Mozilla: https://developer.mozilla.org/en-US/docs/Web/HTTP/ Overview ● Zapier: https://zapier.com/learn/apis/