fortran-lang / http-client

http-client offers a user-friendly, high-level API to make HTTP requests in Fortran.
https://http-client.fortran-lang.org/
MIT License
59 stars 8 forks source link

Write a http-client tutorial #42

Closed milancurcic closed 1 year ago

milancurcic commented 1 year ago

Start from zero, and go through the steps in order:

  1. Start a Fortran application from scratch with fpm;
  2. Add http-client to dependencies;
  3. Make a few GET requests to get some data
  4. Parse and do something with the data
  5. Parse the headers
  6. Send some information with headers, perhaps an API token
  7. Use POST to send data? Maybe we can use a mock server to CRUD a resource with POST, GET, PUT/PATCH, and DELETE. (this could be the 2nd part of the tutorial, 1st being just getting and parsing the data).

Project ideas:

  1. For the first part of the tutorial (getting and parsing data), perhaps we can use api.github.com to query Fortran-lang repos and do some simple analysis of projects, e.g. list 10 most starred or most active Fortran-lang repositories and list them in descending order.
  2. For the second part of the tutorial (CRUD), maybe we can use a mock server that preserves resources to simulate a CRUD operation from Fortran.

Let's start discussing ideas for a tutorial but we don't have to rush to work on it immediately while the API is still in early flux.

rajkumardongre commented 1 year ago

I have created a new project GitHub-org-analyzer which is using http-client to fetch data from the GitHub API to generate insightful reports, I have also used json-fortran as a dependency to parse json content.

Should I explain this project as 1st part of the tutorial, I also think, since I have used json-fortran as a dependency it, can make the tutorial a little bit harder for beginners to understand.

So Should I use this project or use something else?

milancurcic commented 1 year ago

Great! You can focus on explaining the http-client parts, and only a sentence or two mentioning json-fortran, what it is and what you're using it for, without going into detail about it.

rajkumardongre commented 1 year ago

Ok, I will add a tutorial section to the README.md file and provide the explanation for this project.

rajkumardongre commented 1 year ago

Hi, I've included the Phase 1 Tutorial in my recent Pull Request (PR). This tutorial demonstrates the step-by-step process of creating a new fpm project, adding dependencies, installing prerequisites, building, and running the project.

rajkumardongre commented 1 year ago

I have come up with this table content for the tutorial section :

Content Table

  1. Getting Started

    • Installing Dependencies (Ubuntu)
    • Setting up the Package in your Project
  2. Making HTTP Requests

    • Sending GET Requests
      • Accessing Response Content
      • Retrieving Status Codes
      • Getting Response Headers
      • Extracting Content Length
    • Sending POST Requests
      • Sending Data with Requests
      • Sending Form Data
      • Uploading File
    • Sending PUT Requests
    • Sending PATCH Requests
    • Sending DELETE Requests
    • Sending HEAD Requests
  3. Customizing Requests

    • Sending Custom Headers
    • Setting Request Timeout
    • Authentication Options
  4. Error Handling

    • Handling Unsuccessful Requests
    • Displaying Error Messages
  5. Real Projects

    • GitHub organization analyzer : Retrieve valuable information about the organization repositories
  6. Conclusion

    • Recap of Package Features
    • Summary of Tutorial

Does it appear satisfactory? Are there any additions or removals that could improve it?

milancurcic commented 1 year ago

Done by #53.