API in PHP: from Basic to Advanced

Instructor: Dave Halingworth


Class 4: What is an API?

Web interfaces are designed for people to use, whereas APIs are for programs to use.

Useful link: Random User Generator API


Class 5: Make an API call: access an API from PHP

Learn how to make API calls using PHP: PHP.net - file_get_contents()


Class 6: Decode API results: reading JSON in PHP

Learn how to decode JSON responses in PHP:


Class 7: Use API data in a web application

https://agify.io/

class:8 Use cURL instead of file_get_contents to make API request

Important Links for study

https://www.php.net/manual/en/book.curl.php

https://curl.se/

https://www.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

https://www.php.net/manual/en/function.file-get-contents.php

class 9: Response codes: get the HTTP status code

Important Links for study

https://openweathermap.org/api

https://github.com/404

https://en.wikipedia.org/wiki/List_of_HTTP_status_codes

class 10 : Request headers: add meta data about the request

Important Links for study

https://unsplash.com/documentation#public-authentication

https://unsplash.com/

https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Request_fields

class 11 : Response headers: read meta data about the response

Important Links for study

https://www.php.net/manual/en/function.curl-getinfo.php

https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_fields

class 12 : Get all individual response headers in an array.

Important Links for study

https://www.php.net/manual/en/function.curl-setopt.php

class 13 : Use an API that requires a specific request header

Important Links for study

Learn how to use the GitHub REST API.

https://github.com/httpie/cli

https://github.com/settings/tokens

https://docs.github.com/en/rest/activity?apiVersion=2022-11-28#starring

Class 14 : Request method : different results with the same URL

Important Links for study

https://github.com/httpie/cli

Rest API endpoints for activity

Request Methods

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form

Class 15 : Request body: add a payload to the request

Important Links for study

Rest API endpoints for repositories

Class 16 : REST and RESTful APIs : what are they?

Important Links for study

Representational State Transfer(REST)

REST