{"id":18840189,"url":"https://github.com/fortran-lang/http-client","last_synced_at":"2025-06-17T07:34:20.617Z","repository":{"id":167443264,"uuid":"642854154","full_name":"fortran-lang/http-client","owner":"fortran-lang","description":"http-client offers a user-friendly, high-level API to make HTTP requests in Fortran.","archived":false,"fork":false,"pushed_at":"2023-09-24T17:35:06.000Z","size":734,"stargazers_count":63,"open_issues_count":2,"forks_count":8,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-05-29T20:46:03.012Z","etag":null,"topics":["fortran","fortran-library","http","request"],"latest_commit_sha":null,"homepage":"https://http-client.fortran-lang.org/","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fortran-lang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-05-19T13:48:38.000Z","updated_at":"2025-04-29T22:53:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"e05b6dbd-9f01-45eb-b78f-fd41971df878","html_url":"https://github.com/fortran-lang/http-client","commit_stats":{"total_commits":40,"total_committers":5,"mean_commits":8.0,"dds":0.55,"last_synced_commit":"192574c101ce3cd48bb2d4e987781c4cdde186b5"},"previous_names":["fortran-lang/http-client"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/fortran-lang/http-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fhttp-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fhttp-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fhttp-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fhttp-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fortran-lang","download_url":"https://codeload.github.com/fortran-lang/http-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fortran-lang%2Fhttp-client/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260314692,"owners_count":22990628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fortran","fortran-library","http","request"],"created_at":"2024-11-08T02:45:20.154Z","updated_at":"2025-06-17T07:34:20.592Z","avatar_url":"https://github.com/fortran-lang.png","language":"Fortran","readme":"# http-client\n\nhttp-client is Fortran library to make HTTP requests.\nIt simplifies interacting with web services by providing a high-level and\nuser-friendly interface.\n\n## Features\n\n* HTTP request methods:\n  - `GET`: Retrieve data from the server.\n  - `POST`: Create new data the server.\n  - `PUT`: Replace an existing resource on the server.\n  - `DELETE`: Delete a resource from the server.\n  - `PATCH`: Partially update a resource on the server.\n  - `HEAD`: Get response headers without the response content.\n* Supported data types:\n  - URL encoded fields\n  - HTTP form data\n  - File uploads\n* Response handling:\n  - Retrieve response body (content).\n  - Get the HTTP status code returned by the server.\n  - Access response headers.\n* Setting custom request headers\n* Error handling with informative error messages\n* Setting request timeouts\n* Basic HTTP authentication\n\n## Installation\n\nBefore building the http-client library, ensure that you have the necessary\ndependencies installed. On Ubuntu, you need to install the curl development\nheaders. Use the following command:\n\n```\nsudo apt install -y libcurl4-openssl-dev\n```\n\nTo use http-client as a dependency in your fpm project, add the following to\nyour the fpm.toml file of your package:\n\n```toml\n[dependencies]\nhttp = { git = \"https://github.com/fortran-lang/http-client.git\" }\nstdlib = \"*\"\n```\n\n## Example use\n\nThe following example demonstrates how to use http-client to make a simple `GET`\nrequest and process the response:\n\n```fortran\nprogram simple_get\n    use http, only : response_type, request\n    implicit none\n    type(response_type) :: response\n\n    ! Send a GET request to retrieve JSON data\n    response = request(url='https://jsonplaceholder.typicode.com/todos/1')\n\n    ! Check if the request was successful\n    if (.not. response%ok) then\n        print *, 'Error message:', response%err_msg\n    else\n        ! Print the response details\n        print *, 'Response Code    :', response%status_code\n        print *, 'Response Length  :', response%content_length\n        print *, 'Response Method  :', response%method\n        print *, 'Response Content :', response%content\n    end if\n\nend program simple_get\n\n```\n\nOuptut: \n\n```\n Response Code    :          200\n Response Length  :                    83\n Response Method  : GET\n Response Content : {\n  \"userId\": 1,\n  \"id\": 1,\n  \"title\": \"delectus aut autem\",\n  \"completed\": false\n}\n```\n\nIn this example, we make a `GET` request to the URL\nhttps://jsonplaceholder.typicode.com/todos/1 to retrieve JSON data.\nIf the request is successful, we print the response code, content length,\nmethod, and content. If the request fails, we print the error message.\n\n## Getting Started Guides\n\nTo begin your journey with our package, dive into the comprehensive tutorial\navailable here: [tutorial.md](./tutorial/tutorial.md).\n\n## Projects using http-client\n\n* [github-org-analyzer](https://github.com/rajkumardongre/github-org-analyzer):\nAn example mini-project to demonstrate the use of http-client by downloading\nand parsing data from the GitHub API.\n* [fortran-xkcd](https://github.com/rajkumardongre/fortran-xkcd/tree/http_client_version):\nAn fpm example project that displays the latest xkcd comic inside an X window.\nAs a limitation, only images in PNG format are supported.\nThe alt text will be printed to console.\n* [foropenai](https://github.com/gha3mi/foropenai): A Fortran library to access the OpenAI API.\n* [fortelegram-bot](https://github.com/vypivshiy/fortelegram-bot): An Example of simple telegram bot\n* [forcompile](https://github.com/gha3mi/forcompile): A Fortran library to access the Compiler Explorer API.\n  \nIf you're using http-client in your Fortran project and would like to be\nincluded on this list, we welcome you to contribute by creating a pull request\n(PR) and adding your project details. \n\n## Contributing to project\n\nThank you for your interest in http-client! Contributions from the community\nare esential for improving the package. This section provides a guide on how to\nget the code, build the library, and run examples and tests.\n\n### Get the code\n\nTo get started, follow these steps:\n\nClone the repository using Git:\n\n```\ngit clone https://github.com/fortran-lang/http-client\ncd http-client\n```\n\n### Prerequisites\n\nBefore building the library, ensure that you have the necessary dependencies\ninstalled. On Ubuntu, you need to install the curl development headers.\nUse the following command:\n\n```\nsudo apt install -y libcurl4-openssl-dev\n```\n\n### Build the library\n\nhttp-client uses **fpm** as the build system. Make sure you have fpm-0.8.x or\nlater installed. To build the library, run the following command within the\nproject directory:\n\n\n```\nfpm build\n```\n\n### Run examples\n\nhttp-client provides example programs that demonstrate its use. To run the\nexamples, use the following command:\n\n```\nfpm run --example \u003cexample name\u003e\n```\n\nExecuting this command will execute the example programs, allowing you to see\nthe package in action and understand how to utilize its features.\n\n### Run tests\n\nhttp-client includes a test suite to ensure its functionality is working as\nexpected. To run the tests, type:\n\n```\nfpm test\n```\n\nRunning the tests will validate the behavior of the package and help identify\nany issues or regressions.\n\n### Generating API Documentation\n\nBefore generating API documentation, ensure that you have FORD\n[installed on your system](https://github.com/Fortran-FOSS-Programmers/ford#installation).\n\nOnce FORD is set up, execute the following command to build the API documentation:\n\n```bash\nford ford.md\n```\n\n### Supported compilers\n\nhttp-client is known to work with the following compilers:\n\n* GFortran 11 \u0026 12 (tested in CI)\n* Intel OneAPI ifx v2023.1.0 and ifort classic v2021.9.0\n\n### Contributing guidelines\n\nWhen contributing to the http Fortran package, please keep the following guidelines in mind:\n\n* Before making any substantial changes, it is recommended to open an issue to discuss the proposed changes and ensure they align with the project's goals.\n* Fork the repository and create a new branch for your contribution.\n* Ensure that your code adheres to the existing coding style and follows good software engineering practices.\n* Write clear and concise commit messages.\n* Make sure to test your changes and ensure they do not introduce regressions or break existing functionality.\n* Submit a pull request with your changes, providing a clear explanation of the problem you are solving and the approach you have taken.\n\nWe appreciate your contributions and look forward to your valuable input in improving http-client.\n\nHappy coding!👋","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortran-lang%2Fhttp-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffortran-lang%2Fhttp-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffortran-lang%2Fhttp-client/lists"}