{"id":20172263,"url":"https://github.com/apostoldevel/module-pgfetch","last_synced_at":"2026-04-30T03:36:51.509Z","repository":{"id":110915707,"uuid":"477315783","full_name":"apostoldevel/module-PGFetch","owner":"apostoldevel","description":"Module: Postgres Fetch","archived":false,"fork":false,"pushed_at":"2026-02-28T21:49:26.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-01T00:44:41.249Z","etag":null,"topics":["fetch","postgres","postgresql"],"latest_commit_sha":null,"homepage":"","language":"C++","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/apostoldevel.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-04-03T11:06:39.000Z","updated_at":"2026-02-21T14:00:37.000Z","dependencies_parsed_at":"2024-01-24T00:31:23.527Z","dependency_job_id":"bf7e0d00-fd77-41f9-b616-cbb54582f7c4","html_url":"https://github.com/apostoldevel/module-PGFetch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/apostoldevel/module-PGFetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostoldevel%2Fmodule-PGFetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostoldevel%2Fmodule-PGFetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostoldevel%2Fmodule-PGFetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostoldevel%2Fmodule-PGFetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apostoldevel","download_url":"https://codeload.github.com/apostoldevel/module-PGFetch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apostoldevel%2Fmodule-PGFetch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32454144,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fetch","postgres","postgresql"],"created_at":"2024-11-14T01:29:26.799Z","updated_at":"2026-04-30T03:36:46.501Z","avatar_url":"https://github.com/apostoldevel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![ru](https://img.shields.io/badge/lang-ru-green.svg)](https://github.com/apostoldevel/module-PGFetch/blob/master/README.ru-RU.md)\n\nPostgres Fetch\n-\n\n**PGFetch** - a module for [Apostol](https://github.com/apostoldevel/apostol).\n\nDescription\n-\n**PGFetch** provides the ability to send HTTP requests in the PL/pgSQL programming language.\n\nOutgoing requests\n-\nThe module sends HTTP requests as signaled from the database.\n\nExample:\n\n~~~sql\n-- Execute a request to yourself\nSELECT http.fetch('http://localhost:8080/api/v1/time');\n~~~\n\nOutgoing requests are recorded in the `http.request` table, and the result of the request execution is stored in the `http.response` table.\n\nTo conveniently view outgoing requests and the responses received for them, use the `http.fetch` view:\n\n~~~sql\nSELECT * FROM http.fetch ORDER BY datestart DESC;\n~~~\n\nThe `http.fetch()` function is asynchronous, and it returns a unique identifier for the outgoing request as a response.\n\nCallback functions\n-\nIn the `http.fetch()` function, you can pass the name of a callback function for processing a successful response or in the case of a failure.\n\n~~~sql\nSELECT * FROM http.fetch('http://localhost:8080/api/v1/time', done =\u003e 'http.done', fail =\u003e 'http.fail');\n~~~\n\nThe callback functions must be created in advance, and they must accept the unique identifier of the outgoing request (of type uuid) as a parameter.\n\n~~~sql\nCREATE OR REPLACE FUNCTION http.done (\n  pRequest  uuid\n) RETURNS   void\nAS $$\nDECLARE\n  r         record;\nBEGIN\n  SELECT method, resource, status, status_text, response INTO r FROM http.fetch WHERE id = pRequest;\n\n  RAISE NOTICE '% % % %', r.method, r.resource, r.status, r.status_text;\nEND;\n$$ LANGUAGE plpgsql\n  SECURITY DEFINER\n  SET search_path = http, pg_temp;\n~~~\n\n~~~sql\nCREATE OR REPLACE FUNCTION http.fail (\n  pRequest  uuid\n) RETURNS   void\nAS $$\nDECLARE\n  r         record;\nBEGIN\n  SELECT method, resource, error INTO r FROM http.request WHERE id = pRequest;\n\n  RAISE NOTICE 'ERROR: % % %', r.method, r.resource, r.error;\nEND;\n$$ LANGUAGE plpgsql\n  SECURITY DEFINER\n  SET search_path = http, pg_temp;\n~~~\n\nDatabase installation\n-\nFollow the instructions for installing PostgreSQL in the description of [Apostol](https://github.com/apostoldevel/apostol#postgresql).\n\nModule installation\n-\n\nFollow the instructions for building and installing [Apostol](https://github.com/apostoldevel/apostol#%D1%81%D0%B1%D0%BE%D1%80%D0%BA%D0%B0-%D0%B8-%D1%83%D1%81%D1%82%D0%B0%D0%BD%D0%BE%D0%B2%D0%BA%D0%B0).\n\nFunction Parameters\n-\n\nTo performs HTTP request:\n~~~sql\n/**\n * Performs an HTTP request.\n * @param {text} resource - Resource\n * @param {text} method - Method\n * @param {jsonb} headers - HTTP headers\n * @param {bytea} content - Request content\n * @param {text} done - Name of callback function in case of successful response\n * @param {text} fail - Name of callback function in case of failure\n * @param {text} agent - Agent\n * @param {text} profile - Profile\n * @param {text} command - Command\n * @param {text} message - Message\n * @param {text} type - Sending method: native - native; curl - via cURL library\n * @param {text} data - Arbitrary data in JSON format\n * @return {uuid}**/\nCREATE OR REPLACE FUNCTION http.fetch (\n  resource      text,\n  method        text DEFAULT 'GET',\n  headers       jsonb DEFAULT null,\n  content       bytea DEFAULT null,\n  done          text DEFAULT null,\n  fail          text DEFAULT null,\n  agent         text DEFAULT null,\n  profile       text DEFAULT null,\n  command       text DEFAULT null,\n  message       text DEFAULT null,\n  type          text DEFAULT null,\n  data          jsonb DEFAULT null\n) RETURNS       uuid\n~~~","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostoldevel%2Fmodule-pgfetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapostoldevel%2Fmodule-pgfetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapostoldevel%2Fmodule-pgfetch/lists"}