First API steps


Python, I choose you!

I choose you

  • APIs are developed using a back-end language
  • Code runs on a server
  • Back-end language used for this course: Python
  • Why?
    • Previous knowledge (1 ITF)
    • Small learning curve (easy to learn)
    • More and more often used in IT applications
    • Dictionaries (built-in in Python) can be used to create JSON code

First API steps

Postman

Download Postman: https://www.postman.com/downloads/open in new window, create an account and log in

Postman

  • Postman: software to test APIs
  • Initially released in 2012 by Abhinav Asthana
  • Free core functionality

Using Postman

Request 1

From the workspace: open a new tab to create your first API request

New tab

Enter the following link in the 'search bar' and press 'Send':

http://numbersapi.com/random/math

Watch the result in the bottom screen section

First request

Result: a random fact about math The result of your query is a piece of plain text

Request 2

Enter the following link in the 'search bar' and press 'Send':

https://api.nationalize.io?name=michael

Use your own name in the link

Second request

Result: JSON code containing probable countries (by country code)

Last update: 9/15/2022, 6:10:48 PM