{"id":25096564,"url":"https://github.com/jceb/sapi","last_synced_at":"2025-07-13T09:35:31.142Z","repository":{"id":62422459,"uuid":"445597440","full_name":"jceb/sapi","owner":"jceb","description":"Swiss Army Knife for intracting with APIs","archived":false,"fork":false,"pushed_at":"2023-11-14T15:17:38.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T02:14:07.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/jceb.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":"2022-01-07T17:15:42.000Z","updated_at":"2023-10-21T16:42:10.000Z","dependencies_parsed_at":"2023-01-22T06:02:58.000Z","dependency_job_id":"93df7fea-90e3-4ac6-9848-310451f9e33a","html_url":"https://github.com/jceb/sapi","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/jceb/sapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jceb","download_url":"https://codeload.github.com/jceb/sapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jceb%2Fsapi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265121267,"owners_count":23714500,"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":[],"created_at":"2025-02-07T16:48:53.692Z","updated_at":"2025-07-13T09:35:31.098Z","avatar_url":"https://github.com/jceb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sapi\n\n`sapi` is a Swiss Army Knife for interacting with APIs. The goal is to make it\neasy to get JSON data from APIs for further processing on the CLI.\n\nCurrently, `sapi` supports\n[GitLab's API](https://docs.gitlab.com/ee/api/api_resources.html).\n\n## Install\n\n```bash\ndeno install -n sapi --allow-env=P,TOKEN,URL,NODE_ENV --allow-net https://deno.land/x/sapi@v0.0.7/sapi.js\n```\n\n## Usage\n\n```bash\nexport URL=https://gitlab.com/api/v4\nexport TOKEN=YOUR_TOKEN # Obtain from https://gitlab.com/-/profile/personal_access_tokens\nexport P=1 # If you want to limit results to one page\n# sapi HTTP_METHOD RESOURCE [QUERY_PARAMETER] [QUERY_PARAMETER...]\n# HTTP_METHOD: get post put ...\n# RESOURCE: projects, projects/123/repository/branches, etc. See https://docs.gitlab.com/ee/api/api_resources.html\n# QUERY_PARAMETER: per_page=1, etc. See https://docs.gitlab.com/ee/api/api_resources.html\n```\n\n## Examples\n\nList all projects:\n\n```bash\nsapi get projects | jq .\n```\n\nList one project:\n\n```bash\nP=1 sapi get projects per_page=1 | jq .\n```\n\nClone all git repositories:\n\n```bash\nsapi get projects | jq -r '.[] | (.ssh_url_to_repo, (.path_with_namespace | gsub(\"/\"; \"_\")))' -c | parallel -N 2 -j 8 git clone\n# or with xargs\nsapi get projects | jq -r '.[] | (.ssh_url_to_repo, (.path_with_namespace | gsub(\"/\"; \"_\")))' -c | xargs -n 2 -p 8 git clone\n```\n\nClone new git repositories:\n\n```bash\nsapi get projects | jq -r '.[] | (.ssh_url_to_repo, (.path_with_namespace | gsub(\"/\"; \"_\")))' -c | parallel -N 2 -j 8 'bash -c \"[ ! -e {2} ] \u0026\u0026 git clone {1} {2}\"'\n```\n\nCreate a new `stage` branch in all repositories and protect it:\n\n```bash\nsapi get projects | jq -r '.[].id' -c | parallel -N 1 -- 'sapi post projects/{1}/repository/branches branch=stage ref=main; sapi post projects/{1}/protected_branches name=stage;' | jq .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjceb%2Fsapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjceb%2Fsapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjceb%2Fsapi/lists"}