Tasks studies - laboratory
• Install Postman: link, • Skip creating an account: Skip and go to the app/lightweight API client.

Explain the following issues:
• API (Application Programming Interfaces),
• WebAPI (web APIs/internet APIs/web interfaces),
• public vs. private APIs,
• rate limit,
• API documentation,
• data formats used for data exchange with APIs,
• (reminder) HTTP protocol, requests/responses: headers, bodies,
• (reminder) passing parameters in the URL path (Path parameters),
• (reminder) passing parameters in the query string (Query parameters),
• HTTP status groups (codes), their role, discuss each of them,
• (reminder) HTTP methods: GET and POST,
• other HTTP methods: PUT, DELETE, PATCH, HEAD, OPTIONS,
• other HTTP methods: CONNECT, TRACE, *
• Accept request header and its values: application/…
• Content-Type request/response header and its values: application/…
Familiarize yourself with the API of the National Bank of Poland.
Run the Postman program.
Perform HTTP requests to obtain information about the exchange rate table (by default in JSON format). Note when the request was “successful” (2XX statuses) and when it failed (4XX statuses):
• type A,
• type A specifying in the query string to return an XML response,
• type A specifying in the header to return an XML response,
• type B,
• type D,
• type A from the last three available days,
• type A from today,
• type A from May 2, 2024,
• type A from May 3, 2024,
• type A from available days between Apr 29, 2024 and May 5, 2024,
• type A from available days between Jan 1, 2024 and May 5, 2024,
• type A from available days between Jan 1, 2001 and Feb 2. 2001.

Perform the following HTTP requests to obtain information about the exchange rate of a single currency (in JSON format by default):
• euro from table A,
• euro from table B,
• pound from table A,
• pound from table B,
• 7 last euro rates from table A,
• 256 last euro rates from table A,
• euro from table A from today,
• euro from table A from May 2, 2024,
• euro from table A from May 3, 2024,
• US dollar from available days between April 29, 2024 and May 5, 2024,
• US dollar from available days between 1 Jan. 2023 and 5 May 2024,
• US dollar from available days between 1 Jan. 2001 and 2 Feb. 2001.

Make the following HTTP requests to obtain information about the gold price (by default in JSON format):
• current gold price,
• last 7 gold price quotes,
• last -7 gold price quotes,
• last 256 gold price quotes,
• gold price from 2 May 2024,
• gold price from 3 May 2024,
• gold price from available days between 29 Apr. 2024 a May 5, 2024.

Familiarize yourself with the GitHub API.
Make a GET request checking the request limit (check if it is less than 60):
• link.
If the request limit is reached, go to task 10.10 to generate a PAToken, which significantly increases the limit. Use the token as in task 10.11.


In a web browser, go to the profile of the user spetz (Software Engineer from Krakow, author of several tutorials): link

Return to Postman and make GET requests to the following addresses:
•link
•link
•link
•link
• link
• link
• link
Perform GET requests to obtain information/download:
• about the .gitignore file template (the “raw” file content) for Laravel projects,
• about the (nonexistent) TokenmanagerSample repository of user spetz,
• data about the Readme.md file and its content encoded from the tokenmanagersample repository of user spetz,
• the “raw” content of the README.md file from the tokenmanager-sample repository of user spetz,
• co-creators of the Passenger repository of user passenger-stack,
• whether user phuzarski is a co-creator of the Passenger repository of user passenger-stack,
• whether user phuzarski follows spetz,
• whether user spetz follows phuzarski,
• the Passenger repository of user passenger-stack as a .zip archive,
• the number of clones of the Passenger repository of user passenger-stack,
• commit information from passenger-stack’s Passenger repository,
• commit information about hash: b1c3a8011e585eba20d85ba3cdbc9f5dbe29f345 from passenger-stack’s Passenger repository,
• branch information from passenger-stack’s Passenger repository,
• master branch information from passenger-stack’s Passenger repository,
• main branch information from passenger-stack’s Passenger repository.
Perform a POST request that allows:
• rendering a Markdown fragment (attached as JSON in the request body) as
HTML (Preview tab in the response).
{"text":"# h1 Heading \n ## h2 Heading\n### h3 Heading\n#### h4 Heading\n##### h5 Heading"}

Note: POST, PUT, PATCH, DELETE requests may result in modification/loss of user data!
Log into your GitHub account and generate a classic personal token: any name, valid for 1 day. Grant permissions to: repo, user, delete_repo, project. Copy it temporarily to a text file in Notepad++. After finishing the classes, for security reasons, delete the token.

Perform a GET request checking the request limit (check if it is 5000):
• link.
using PAToken for authentication.
Authorization -> Bearer Token -> paste PAToken

Use PAToken to authenticate yourself in requests (be careful):
• get information about yourself,
• update some information about yourself, e.g. location on PL,
• get information about all your repositories,
• get information about your private repositories,
• get information about your public repositories,
• create a new private repository:
– name → ai1-test,
– description → This is AI1 Test repository!,
– private → yes.
• switch (partially update) the repository you just created to public,
• completely delete this repository,
• try to delete this repository again.
After each request, check/compare the result also through the user interface on github.com.
Before the next class, familiarize yourself with the following topics:
• REST (Representational state transfer),
• REST API (RESTful API),
• 6 REST API principles (including a thorough explanation of the statelessness principle),
• endpoints,
• resources,
• CRUD operations on resources,
• Richardson’s API maturity model, discuss levels,
• HTTP methods used at maturity level 2,
• HTTP codes (English name, translation, most common use):
200, 201, 204, 400, 401, 403, 404, 405, 422, 500,
• assess the GitHub API maturity level,
• versioning API,
• Is GitHub’s API versioned?
– tasks/sub-items to complete/perform on your own,
– tasks/sub-items for those interested.
File version: v1.0