SlideShare a Scribd company logo
1 of 37
Microsoft.com/Learn
Join the chat at https://aka.ms/LearnLiveTV
Title
Speaker Name
Explore the art world by using
RESTful APIs
Speaker Name
Title
Prerequisites  An internet-connected browser, like Microsoft Edge
Learning
objectives
 Learn about RESTful APIs.
 Learn various strategies to connect to external APIs.
 Learn how to query two different museum APIs.
Introduction
Introduction
You're a web developer with a passion
for the art world. You'd love to create a
web page to showcase examples of art
through the ages. But you're not sure
about the best way to get images of
art for your web page. That's where
APIs come in!
In this module, you'll learn the basics
of APIs that help you get images of
artwork made public by museums
around the world.
What is an API?
What is an API?
What is an API? This term seems to get used for many different things.
Let's start with a definition of the acronym: "API" stands for
"application programming interface." It's easiest to think of an API as a
set of rules, or a codified handshake, between systems.
An API is like a kitchen sink
 A sink is an API between you,
the consumer of water, and the
pipes that deliver it to you. You
don't need to know much
about the pipe configuration.
You just need to know that
when you turn a handle, water
comes out and you can use it.
An API is a convenient way to
interface between a user and a
product.
Query the Metropolitan API
Explore an API
The first step when you're researching the use of a third-party API is to
check out its documentation.
Query the API
The Met's endpoints, or the URLs that you'll use to query for objects,
are Objects, Object (for a single object), Departments, and Search.
This costume helmet was
acquired by the Metropolitan
Museum in 1988 and currently
resides in the Arms and Armor
department.
Summary
The Metropolitan Museum's well-organized and easy-to-access API is
a great place to start imagining how you might use an API in your
website.
Authentication strategies
Authentication strategies
The Metropolitan Museum's API is open to the public and doesn't
require authentication.
Always use authentication over a secure HTTPS connection.
Using HTTP protocols to authenticate
The HTTP protocol provides developers with several authentication
strategies, including Basic and Bearer.
Using API keys to authenticate
API keys are common in API architecture.
Tip: It's a good idea to store your API keys in the cloud and access
them via a function that calls an environment variable. But that
method is out of scope for this tutorial!
OAuth
Using an API key can easily get complicated, but it's the most
common way to authenticate to use an API.
Query the Cooper Hewitt API
Query the Cooper Hewitt API
Now that you've discovered some interesting collections at the
Metropolitan Museum, let's look at a different museum API: the
Cooper Hewitt API.
Create a token and a key
Go to the API home page and create an account.
Note: Why create both an access token and a key? This API uses
OAuth 2, which requires tokens to monitor and limit access to the
API. The API key works with the access token to ensure that you
have the authority to access the API in the way that you have set
up via the token.
Query the API
Say you're interested in Art Nouveau,
and you want to see what objects exist
in the collection from that era.
Note: For the following queries, get
an access token as noted earlier and
paste it into the query where
specified.
This Photo of a poster by Mucha is licensed under CC BY-NC
Handle responses
Handle responses
In many situations, it's important to know the status codes that are
sent back by a RESTful API.
Try a query
Try, for example, this query in your browser:
https://api.collection.cooperhewitt.org/rest/?method=cooperhewitt.pe
riods.getList&access_token=xxxxx&page=1&per_page=100.
Understand status codes
Common access codes you might come across include:
• 200 ? OK. The request was successful.
• 204 ? No Content.
• 301 ? Moved Permanently.
• 400 ? Bad Request.
• 401 ? Unauthorized.
• 403 ? Forbidden.
• 404 ? Not Found.
• 500 ? Internal Server Error.
[!Tip] HTTP Cats by Tomomi Imura is a memorable way to match
status codes with errors.
This Photo by Unknown Author is licensed under CC BY-SA-NC
Knowledge check
Question 1
All APIs require keys for access.
A. True
B. False
Question 1
All APIs require keys for access.
A. True
B. False
Question 2
OAuth uses access tokens to perform the following task:
A. Obtain an authorization code
B. Ensure a user is logged in
C. Ensure security
Question 2
OAuth uses access tokens to perform the following task:
A. Obtain an authorization code
B. Ensure a user is logged in
C. Ensure security
Question 3
APIs can be used for the following:
A. E-commerce applications
B. Cultural organizations
C. Payment transactions
D. All of the above
Question 3
APIs can be used for the following:
A. E-commerce applications
B. Cultural organizations
C. Payment transactions
D. All of the above
Summary
Summary
In this module, you learned what APIs are and how to query one
securely.
Next Steps
Please tell us how you liked this
workshop by filling out this survey:
https://aka.ms/workshopomatic-
feedback
Explore more about ways to
build and use APIs by
completing the other
elements of this module.
© Copyright Microsoft Corporation. All rights reserved.

More Related Content

Similar to api_slides.pptx

Nom Nom: Consuming REST APIs
Nom Nom: Consuming REST APIsNom Nom: Consuming REST APIs
Nom Nom: Consuming REST APIsTessa Mero
 
Trends in Web APIs Layer 7 API Management Workshop London
Trends in Web APIs Layer 7 API Management Workshop LondonTrends in Web APIs Layer 7 API Management Workshop London
Trends in Web APIs Layer 7 API Management Workshop LondonCA API Management
 
Fun! with the Twitter API
Fun! with the Twitter APIFun! with the Twitter API
Fun! with the Twitter APIErin Shellman
 
Getting to Grips with RESTful APIs
Getting to Grips with RESTful APIsGetting to Grips with RESTful APIs
Getting to Grips with RESTful APIsPetko Mikhailov
 
Rails 3 and OAuth for Barcamp Tampa
Rails 3 and OAuth for Barcamp TampaRails 3 and OAuth for Barcamp Tampa
Rails 3 and OAuth for Barcamp TampaBryce Kerley
 
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...CA API Management
 
Building a Great Web API - Evan Cooke - QCON 2011
Building a Great Web API - Evan Cooke - QCON 2011Building a Great Web API - Evan Cooke - QCON 2011
Building a Great Web API - Evan Cooke - QCON 2011Twilio Inc
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015Mike McNeil
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Tom Johnson
 
Understanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chkUnderstanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chknooreen nayyar syeda
 
API Product Opportunity Responsibility Nicolas Sierro 2015.pptx
API Product Opportunity Responsibility Nicolas Sierro 2015.pptxAPI Product Opportunity Responsibility Nicolas Sierro 2015.pptx
API Product Opportunity Responsibility Nicolas Sierro 2015.pptxBlockchainizator
 
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...apidays
 
API Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterAPI Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterTom Johnson
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterTom Johnson
 

Similar to api_slides.pptx (20)

Nom Nom: Consuming REST APIs
Nom Nom: Consuming REST APIsNom Nom: Consuming REST APIs
Nom Nom: Consuming REST APIs
 
API SECURITY
API SECURITYAPI SECURITY
API SECURITY
 
Trends in Web APIs Layer 7 API Management Workshop London
Trends in Web APIs Layer 7 API Management Workshop LondonTrends in Web APIs Layer 7 API Management Workshop London
Trends in Web APIs Layer 7 API Management Workshop London
 
Api Testing.pdf
Api Testing.pdfApi Testing.pdf
Api Testing.pdf
 
Crafting APIs
Crafting APIsCrafting APIs
Crafting APIs
 
Fun! with the Twitter API
Fun! with the Twitter APIFun! with the Twitter API
Fun! with the Twitter API
 
Getting to Grips with RESTful APIs
Getting to Grips with RESTful APIsGetting to Grips with RESTful APIs
Getting to Grips with RESTful APIs
 
Rails 3 and OAuth for Barcamp Tampa
Rails 3 and OAuth for Barcamp TampaRails 3 and OAuth for Barcamp Tampa
Rails 3 and OAuth for Barcamp Tampa
 
Your API is not a Website!
Your API is not a Website!Your API is not a Website!
Your API is not a Website!
 
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...Understanding Identity in the World of Web APIs – Ronnie Mitra,  API Architec...
Understanding Identity in the World of Web APIs – Ronnie Mitra, API Architec...
 
Building a Great Web API - Evan Cooke - QCON 2011
Building a Great Web API - Evan Cooke - QCON 2011Building a Great Web API - Evan Cooke - QCON 2011
Building a Great Web API - Evan Cooke - QCON 2011
 
I Love APIs - Oct 2015
I Love APIs - Oct 2015I Love APIs - Oct 2015
I Love APIs - Oct 2015
 
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
Survival Strategies for API Documentation: Presentation to Southwestern Ontar...
 
Design Web Api
Design Web ApiDesign Web Api
Design Web Api
 
Understanding APIs.pptx
Understanding APIs.pptxUnderstanding APIs.pptx
Understanding APIs.pptx
 
Understanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chkUnderstanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chk
 
API Product Opportunity Responsibility Nicolas Sierro 2015.pptx
API Product Opportunity Responsibility Nicolas Sierro 2015.pptxAPI Product Opportunity Responsibility Nicolas Sierro 2015.pptx
API Product Opportunity Responsibility Nicolas Sierro 2015.pptx
 
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
INTERFACE by apidays 2023 - APIs with bounded contexts, Jose Haro Peralta, mi...
 
API Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC ChapterAPI Documentation presentation to East Bay STC Chapter
API Documentation presentation to East Bay STC Chapter
 
API Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC ChapterAPI Documentation -- Presentation to East Bay STC Chapter
API Documentation -- Presentation to East Bay STC Chapter
 

Recently uploaded

Call Girl in Low Price Delhi Punjabi Bagh 9711199012
Call Girl in Low Price Delhi Punjabi Bagh  9711199012Call Girl in Low Price Delhi Punjabi Bagh  9711199012
Call Girl in Low Price Delhi Punjabi Bagh 9711199012sapnasaifi408
 
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls DubaiDark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls Dubaikojalkojal131
 
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsSonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsNiya Khan
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Datingkojalkojal131
 
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...Suhani Kapoor
 
Résumé (2 pager - 12 ft standard syntax)
Résumé (2 pager -  12 ft standard syntax)Résumé (2 pager -  12 ft standard syntax)
Résumé (2 pager - 12 ft standard syntax)Soham Mondal
 
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...Suhani Kapoor
 
Employee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchEmployee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchSoham Mondal
 
Delhi Call Girls South Ex 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Ex 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls South Ex 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Ex 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineBruce Bennett
 
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boodykojalkojal131
 
PM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterPM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterHector Del Castillo, CPM, CPMM
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girlsshivangimorya083
 
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...Suhani Kapoor
 
The Impact of Socioeconomic Status on Education.pdf
The Impact of Socioeconomic Status on Education.pdfThe Impact of Socioeconomic Status on Education.pdf
The Impact of Socioeconomic Status on Education.pdftheknowledgereview1
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...Suhani Kapoor
 
Internshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateInternshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateSoham Mondal
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceanilsa9823
 
Final Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipFinal Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipSoham Mondal
 

Recently uploaded (20)

Call Girl in Low Price Delhi Punjabi Bagh 9711199012
Call Girl in Low Price Delhi Punjabi Bagh  9711199012Call Girl in Low Price Delhi Punjabi Bagh  9711199012
Call Girl in Low Price Delhi Punjabi Bagh 9711199012
 
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls DubaiDark Dubai Call Girls O525547819 Skin Call Girls Dubai
Dark Dubai Call Girls O525547819 Skin Call Girls Dubai
 
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call GirlsSonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
Sonam +91-9537192988-Mind-blowing skills and techniques of Ahmedabad Call Girls
 
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen DatingDubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
Dubai Call Girls Starlet O525547819 Call Girls Dubai Showen Dating
 
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
VIP Russian Call Girls in Bhilai Deepika 8250192130 Independent Escort Servic...
 
Résumé (2 pager - 12 ft standard syntax)
Résumé (2 pager -  12 ft standard syntax)Résumé (2 pager -  12 ft standard syntax)
Résumé (2 pager - 12 ft standard syntax)
 
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
VIP Russian Call Girls in Amravati Deepika 8250192130 Independent Escort Serv...
 
Employee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India ResearchEmployee of the Month - Samsung Semiconductor India Research
Employee of the Month - Samsung Semiconductor India Research
 
Delhi Call Girls South Ex 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Ex 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls South Ex 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls South Ex 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Resumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying OnlineResumes, Cover Letters, and Applying Online
Resumes, Cover Letters, and Applying Online
 
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Greater Noida 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big BoodyDubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
Dubai Call Girls Demons O525547819 Call Girls IN DUbai Natural Big Boody
 
PM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring ChapterPM Job Search Council Info Session - PMI Silver Spring Chapter
PM Job Search Council Info Session - PMI Silver Spring Chapter
 
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call GirlsDelhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
Delhi Call Girls In Atta Market 9711199012 Book Your One night Stand Call Girls
 
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
VIP Call Girls Service Cuttack Aishwarya 8250192130 Independent Escort Servic...
 
The Impact of Socioeconomic Status on Education.pdf
The Impact of Socioeconomic Status on Education.pdfThe Impact of Socioeconomic Status on Education.pdf
The Impact of Socioeconomic Status on Education.pdf
 
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
VIP Call Girls Service Saharanpur Aishwarya 8250192130 Independent Escort Ser...
 
Internshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University CertificateInternshala Student Partner 6.0 Jadavpur University Certificate
Internshala Student Partner 6.0 Jadavpur University Certificate
 
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Nishatganj Lucknow best sexual service
 
Final Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management InternshipFinal Completion Certificate of Marketing Management Internship
Final Completion Certificate of Marketing Management Internship
 

api_slides.pptx

  • 2. Join the chat at https://aka.ms/LearnLiveTV Title Speaker Name Explore the art world by using RESTful APIs Speaker Name Title
  • 3. Prerequisites  An internet-connected browser, like Microsoft Edge
  • 4. Learning objectives  Learn about RESTful APIs.  Learn various strategies to connect to external APIs.  Learn how to query two different museum APIs.
  • 6. Introduction You're a web developer with a passion for the art world. You'd love to create a web page to showcase examples of art through the ages. But you're not sure about the best way to get images of art for your web page. That's where APIs come in! In this module, you'll learn the basics of APIs that help you get images of artwork made public by museums around the world.
  • 7. What is an API?
  • 8. What is an API? What is an API? This term seems to get used for many different things. Let's start with a definition of the acronym: "API" stands for "application programming interface." It's easiest to think of an API as a set of rules, or a codified handshake, between systems.
  • 9. An API is like a kitchen sink  A sink is an API between you, the consumer of water, and the pipes that deliver it to you. You don't need to know much about the pipe configuration. You just need to know that when you turn a handle, water comes out and you can use it. An API is a convenient way to interface between a user and a product.
  • 11. Explore an API The first step when you're researching the use of a third-party API is to check out its documentation.
  • 12. Query the API The Met's endpoints, or the URLs that you'll use to query for objects, are Objects, Object (for a single object), Departments, and Search. This costume helmet was acquired by the Metropolitan Museum in 1988 and currently resides in the Arms and Armor department.
  • 13. Summary The Metropolitan Museum's well-organized and easy-to-access API is a great place to start imagining how you might use an API in your website.
  • 15. Authentication strategies The Metropolitan Museum's API is open to the public and doesn't require authentication. Always use authentication over a secure HTTPS connection.
  • 16. Using HTTP protocols to authenticate The HTTP protocol provides developers with several authentication strategies, including Basic and Bearer.
  • 17. Using API keys to authenticate API keys are common in API architecture. Tip: It's a good idea to store your API keys in the cloud and access them via a function that calls an environment variable. But that method is out of scope for this tutorial!
  • 18. OAuth Using an API key can easily get complicated, but it's the most common way to authenticate to use an API.
  • 19. Query the Cooper Hewitt API
  • 20. Query the Cooper Hewitt API Now that you've discovered some interesting collections at the Metropolitan Museum, let's look at a different museum API: the Cooper Hewitt API.
  • 21. Create a token and a key Go to the API home page and create an account. Note: Why create both an access token and a key? This API uses OAuth 2, which requires tokens to monitor and limit access to the API. The API key works with the access token to ensure that you have the authority to access the API in the way that you have set up via the token.
  • 22. Query the API Say you're interested in Art Nouveau, and you want to see what objects exist in the collection from that era. Note: For the following queries, get an access token as noted earlier and paste it into the query where specified. This Photo of a poster by Mucha is licensed under CC BY-NC
  • 24. Handle responses In many situations, it's important to know the status codes that are sent back by a RESTful API.
  • 25. Try a query Try, for example, this query in your browser: https://api.collection.cooperhewitt.org/rest/?method=cooperhewitt.pe riods.getList&access_token=xxxxx&page=1&per_page=100.
  • 26. Understand status codes Common access codes you might come across include: • 200 ? OK. The request was successful. • 204 ? No Content. • 301 ? Moved Permanently. • 400 ? Bad Request. • 401 ? Unauthorized. • 403 ? Forbidden. • 404 ? Not Found. • 500 ? Internal Server Error. [!Tip] HTTP Cats by Tomomi Imura is a memorable way to match status codes with errors. This Photo by Unknown Author is licensed under CC BY-SA-NC
  • 28. Question 1 All APIs require keys for access. A. True B. False
  • 29. Question 1 All APIs require keys for access. A. True B. False
  • 30. Question 2 OAuth uses access tokens to perform the following task: A. Obtain an authorization code B. Ensure a user is logged in C. Ensure security
  • 31. Question 2 OAuth uses access tokens to perform the following task: A. Obtain an authorization code B. Ensure a user is logged in C. Ensure security
  • 32. Question 3 APIs can be used for the following: A. E-commerce applications B. Cultural organizations C. Payment transactions D. All of the above
  • 33. Question 3 APIs can be used for the following: A. E-commerce applications B. Cultural organizations C. Payment transactions D. All of the above
  • 35. Summary In this module, you learned what APIs are and how to query one securely.
  • 36. Next Steps Please tell us how you liked this workshop by filling out this survey: https://aka.ms/workshopomatic- feedback Explore more about ways to build and use APIs by completing the other elements of this module.
  • 37. © Copyright Microsoft Corporation. All rights reserved.

Editor's Notes

  1. Link to published module on Learn: https://docs.microsoft.com/en-us/learn/modules/learn-pr/student-evangelism/use-apis-discover-museum-art/
  2. You're a web developer with a passion for the art world. You'd love to create a web page to showcase examples of art through the ages. But you're not sure about the best way to get images of art for your web page. That's where APIs come in! In this module, you'll learn the basics of APIs that help you get images of artwork made public by museums around the world.
  3. What is an API? This term seems to get used for many different things. Let's start with a definition of the acronym: "API" stands for "application programming interface." It's easiest to think of an API as a set of rules, or a codified handshake, between systems. You can also think of an API as a "kitchen sink," as Burke Holland says. A sink is an API between you, the consumer of water, and the pipes that deliver it to you. You don't need to know much about the pipe configuration. You just need to know that when you turn a handle, water comes out and you can use it. An API is a convenient way to interface between a user and a product. One example of an API is the jQuery API. This API is a program that uses jQuery's library to simplify the programmer's interaction between a browser and the DOM, the tree of objects that make up a web page. Another example is software that allows you to access other people's programs in a clear, secure, and documented way. For example, an API might let you access flight times from an airline database so you can use that data in your own applications. Fundamentally, this handshake between systems allows you to build your own applications with the help of a technology that allows you to easily use other systems to enhance your own. APIs have traditionally been built with a variety of protocols, including the XML-based Simple Object Access Protocol (SOAP) and Representational State Transfer (REST). SOAP is a powerful tool for sending and receiving messages between systems. But REST, with its ability to return both XML and the popular JSON format, has emerged as a more common way to use internet-connected web services and HTTP calls to send and receive data from third-party connections. When an API or other interface follows the principles of REST, that interface is referred to as RESTful. We'll use both terms loosely in the rest of this module as you learn about building and using RESTful APIs.
  4. The first step when you're researching the use of a third-party API is to check out its documentation. Take a look at the API documentation provided by the museum. Another thing to consider is permissions. Read through the terms of use of all third-party APIs that you want to use to make sure that what you want to do is acceptable. The Met Museum's Terms and Conditions page is a good place to start. Because the museum has adopted the Creative Commons Zero license, there's no copyright on the dataset. That license makes working with the API easier for the casual user. And you don't need an API key to use this API, so you can access many elements of its collections by using GET requests via well-formed URL queries. By visiting a given URL, you're using the Met Museum's API from within your browser. This method is the simplest way to use an API. In a later unit, you'll learn how to use code to call APIs.
  5. The Met's endpoints, or the URLs that you'll use to query for objects, are Objects, Object (for a single object), Departments, and Search. The design of this API indicates that users are expected to search the collection and then drill down into object groups and individual objects for more detail and information. The API is being built progressively. The choice of including a Department endpoint might be an indication of the way the data is structured and how users search for it. Suppose you're interested in arms and armor. You could query the Departments endpoint to get the ID of that department: https://collectionapi.metmuseum.org/public/collection/v1/departments If you paste that link into a browser, you discover that the Arms and Armor department has department ID 4. You now have some information that you can use to find interesting items in the collection. To do that, you can use the Search endpoint. Because this API is attempting to return controlled amounts of data, given its scope of 5,000 years of art history in an immense collection, a search by just departmentId won't succeed. Instead, you need to narrow your search by a keyword within that department. This narrowing activity requires you to use a query parameter in your URL to access the endpoint. If you look at the documentation, you'll see that the expected format is to append ?q=keyword(s) to the endpoint. So to find only arms and armor items in embossed silver, paste this string into your browser: https://collectionapi.metmuseum.org/public/collection/v1/search?departmentId=4&q=embossed%20silver. Twenty-seven items are returned. This query gives you the information to retrieve the objects that are returned. If you want to look at the first object in the group, you'd go to this endpoint: https://collectionapi.metmuseum.org/public/collection/v1/objects/626019. The data returned reveals a spectacular costume suit of armor from 1800, complete with a papier-m?ch? helmet. One can only imagine the party where it was worn! This costume helmet was acquired by the Metropolitan Museum in 1988 and currently resides in the Arms and Armor department.
  6. The Metropolitan Museum's well-organized and easy-to-access API is a great place to start imagining how you might use an API in your website. You can build a search by using the search endpoint and query parameters. You can query the department for a group of objectIds and loop over them to create a list of interesting objects. You can explore the collection in depth and in detail without ever touching or even understanding the database underlying it. That's the power of a great API!
  7. The Metropolitan Museum's API is open to the public and doesn't require authentication. The only request is that users "limit request rate to 80 requests per second." This level of openness is a little unusual for an API. Usually, the organization that manages a publicly facing API requires some kind of access authentication to protect itself from unwanted overuse of the endpoints. If an API requires authentication, you won't be able to make calls to get data directly via URL calls. Instead, you'll need to use a request header, which is an object that's sent with your request and that uses an HTTP call. [!Note] Always use authentication over a secure HTTPS connection.
  8. The HTTP protocol provides developers with several authentication strategies, including Basic and Bearer. Basic authentication isn't inherently secure because it requires you to pass a user name and password through a request header directly. Here's an example: Authorization: Basic abcdef12345== You're more likely to see Bearer authentication. Bearer authentication requires a token, retrieved before the authentication call, that must be passed in the request header: Authorization: Bearer <my-token>
  9. API keys are common in API architecture. They can show up in various places: passed via body data as JSON, sent through a query string, or sent via a custom header or an authorization header. Keys are an easy way to form a handshake between your code and an API, but they're not inherently secure. In theory, anyone could use a key if they can intercept it via a network call. [!TIP] It's a good idea to store your API keys in the cloud and access them via a function that calls an environment variable. But that method is out of scope for this tutorial!
  10. Using an API key can easily get complicated, but it's the most common way to authenticate to use an API. Yet another way to authenticate and use an API is via OAuth. OAuth, particularly version 2, provides a more fine-grained authentication strategy. The user is directed to the API's site and then completes one of many flows allowed by OAuth to enable access. Many scenarios are possible. But OAuth basically enables the creation of an API key and uses the key to authenticate a token that allows limited access to an API for limited operations. In this way, a user can use an access token in web calls to ensure access to various parts of the API, for specific uses and specific time periods. API keys are different from access tokens in that keys provide authorization but not authentication. Access tokens provide a more secure way to access sensitive endpoints. In the next unit, you'll query an API that uses OAuth 2: the Smithsonian's Cooper Hewitt National Design Museum.
  11. Now that you've discovered some interesting collections at the Metropolitan Museum, let's look at a different museum API: the Cooper Hewitt API. Cooper Hewitt is part of the Smithsonian. It's the US's National Design Museum. Its collection is devoted to interesting and notable design, from Dyson fans to antique shoes. To access the API, you need either an access token or both an access token and an API key that acts as its authenticator. The API allows a user to visit an endpoint for individual visits by using a one-off access token. But to query the API with code, you need both elements.
  12. Go to the API home page and create an account. After you create your account, you can create a key and an access token for yourself. Save the token that's generated in a text file somewhere safe on your local computer. [!NOTE] Why create both an access token and a key? This API uses OAuth 2, which requires tokens to monitor and limit access to the API. The API key works with the access token to ensure that you have the authority to access the API in the way that you have set up via the token. After you create a token and authenticate it by using an API key, you can start sending the token in the URL of a test API call. Let's see what we can find in the Cooper Hewitt Design Museum!
  13. Say you're interested in Art Nouveau, and you want to see what objects exist in the collection from that era. The API allows you to get an ID for the era and query it to get a URL with a collection specified for the era. [!NOTE] For the following queries, get an access token as noted earlier and paste it into the query where specified. To find the Art Nouveau objects, query the API like so: https://api.collection.cooperhewitt.org/rest/?method=cooperhewitt.periods.getList&access_token=<your-token>&page=1&per_page=100. This query specifies that you need to append the page you'll retrieve and the number of elements returned per page. When you query the API, a URL is returned in the response with a list of Art Nouveau objects available for perusal (including some famous Mucha posters): https://collection.cooperhewitt.org/periods/35417231/. Take a look. What other eras can you discover by querying this API?
  14. In many situations, it's important to know the status codes that are sent back by a RESTful API. What if there's a server error? What if there's no data to be sent back? What if there's an authentication error? In any of these cases, it's useful to watch for codes so that you can tell the front-end user that there's a problem.
  15. Try, for example, this query in your browser: https://api.collection.cooperhewitt.org/rest/?method=cooperhewitt.periods.getList&access_token=xxxxx&page=1&per_page=100. The API will return a code of 400: this is a "bad request" error. It's caused by an invalid access token in the URL.
  16. Common access codes you might come across include: 200 ? OK. The request was successful. 204 ? No Content. 301 ? Moved Permanently. 400 ? Bad Request. 401 ? Unauthorized. 403 ? Forbidden. 404 ? Not Found. 500 ? Internal Server Error. It's useful to learn about status codes so that you can handle them well in your client-side code. Normally, a 200 code means "all is well" and that you can continue to display the query results. It's also useful to be able to triage errors and display appropriate messages to handle them. [!Tip] HTTP Cats by Tomomi Imura is a memorable way to match status codes with errors. You'll never forget that 200 means OK!
  17. Explanation: Most APIs do require keys for access, but some are open.
  18. Explanation: Most APIs do require keys for access, but some are open.
  19. Explanation: OAuth 2.0 protocol for Authorization Code Grant exchanges the token for an access code.
  20. Explanation: OAuth 2.0 protocol for Authorization Code Grant exchanges the token for an access code.
  21. Explanation: APIs have many uses, including many more than the ones listed here.
  22. Explanation: APIs have many uses, including many more than the ones listed here.
  23. In this module, you learned what APIs are and how to build your own API and retrieve data from it. You also learned how to discover museum collections via museum APIs. You learned about APIs that are completely open and APIs that require access tokens. Finally, you learned about various libraries that help you access and work with APIs. A great next step would be to discover the many APIs available to you. You could start with this list of public APIs.