{"id":24792768,"url":"https://github.com/dkress59/wordpress-api-client","last_synced_at":"2025-09-12T23:36:30.310Z","repository":{"id":43030598,"uuid":"413120530","full_name":"dkress59/wordpress-api-client","owner":"dkress59","description":"WordPress-API Client for JS/TS","archived":false,"fork":false,"pushed_at":"2023-10-18T18:25:56.000Z","size":105288,"stargazers_count":19,"open_issues_count":9,"forks_count":6,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T19:30:12.805Z","etag":null,"topics":["api","api-client","client","headless","javascript","json","nodejs","rest","typescript","wordpress","wp"],"latest_commit_sha":null,"homepage":"https://dkress59.github.io/wordpress-api-client/","language":"TypeScript","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/dkress59.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2021-10-03T15:41:34.000Z","updated_at":"2025-07-08T15:01:08.000Z","dependencies_parsed_at":"2024-12-22T10:32:20.045Z","dependency_job_id":"2c057c34-06c4-401b-918f-5d2f25c361ee","html_url":"https://github.com/dkress59/wordpress-api-client","commit_stats":{"total_commits":219,"total_committers":3,"mean_commits":73.0,"dds":"0.022831050228310557","last_synced_commit":"55887526a7c0965b134608e37ce00406065a755a"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/dkress59/wordpress-api-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkress59%2Fwordpress-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkress59%2Fwordpress-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkress59%2Fwordpress-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkress59%2Fwordpress-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkress59","download_url":"https://codeload.github.com/dkress59/wordpress-api-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkress59%2Fwordpress-api-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274893356,"owners_count":25369301,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"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":["api","api-client","client","headless","javascript","json","nodejs","rest","typescript","wordpress","wp"],"created_at":"2025-01-29T20:55:02.179Z","updated_at":"2025-09-12T23:36:30.278Z","avatar_url":"https://github.com/dkress59.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WordPress-API Client\n\n[![npm version](https://badge.fury.io/js/wordpress-api-client.svg)](https://badge.fury.io/js/wordpress-api-client)\n ![WordPress](https://img.shields.io/badge/WordPress-%23117AC9.svg?style=flat\u0026logo=WordPress\u0026logoColor=white)\n ![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=flat\u0026logo=typescript\u0026logoColor=white)\n ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=flat\u0026logo=javascript\u0026logoColor=%23F7DF1E)\n ![Jest](https://img.shields.io/badge/-jest-%23C21325?style=flat\u0026logo=jest\u0026color=f07)\n[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=dkress59_wordpress-api-client\u0026metric=coverage)](https://sonarcloud.io/summary/new_code?id=dkress59_wordpress-api-client)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=dkress59_wordpress-api-client\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=dkress59_wordpress-api-client)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=dkress59_wordpress-api-client\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=dkress59_wordpress-api-client)\n\u003c!-- [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=dkress59_wordpress-api-client\u0026metric=duplicated_lines_density)](https://sonarcloud.io/summary/new_code?id=dkress59_wordpress-api-client)\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=dkress59_wordpress-api-client\u0026metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=dkress59_wordpress-api-client)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=dkress59_wordpress-api-client\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=dkress59_wordpress-api-client)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=dkress59_wordpress-api-client\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=dkress59_wordpress-api-client) --\u003e\n\nA typed JavaScript client for your WordPress REST API. Super simple yet highly extensible.\n\nThis library covers all built-in WP REST API routes and can easily be extended\nwith custom routes. Fully integrated with [Advanced Custom Fields](https://advancedcustomfields.com).\n\n---\n\n## Installation\n\nDepending on the package manager of your choice:\n\n```bash\nyarn add wordpress-api-client\n```\n\n```bash\nnpm install wordpress-api-client\n```\n\n---\n\n## Quick Start\n\nIf you only need to access public REST routes from a vanilla WordPress installation,\nall you need is:\n\n```typescript\nimport WpApiClient from 'wordpress-api-client'\nexport const client = new WpApiClient('https://my-wordpress-website.com')\n```\n\nThe next example shows how this bare setup, from above, will already cover most\nof your needs:\n\n```typescript\nimport WpApiClient, { WPCategory, WPPage, WPPost } from 'wordpress-api-client'\n\nasync function getContent(): Promise\u003c{\n    aboutPage: WPPage\n    contactPage: WPPage\n    frontPage: WPPage\n    categories: WPCategory[]\n    recent25posts: WPPost[]\n}\u003e {\n    const client = new WpApiClient('https://my-wordpress-website.com')\n\n    const [aboutPage, contactPage, frontPage] = await client.page().find(12, 23, 34)\n    const categories = await client.postCategory().find()\n    const recent25posts = await client.posts().find(new URLSearchParams({\n        order: 'desc',\n        per_page: '25',\n    }))\n\n    return { frontPage, aboutPage, contactPage, categories, recent25Posts }\n}\n```\n\nIf you would like to extend the client, adding post types and REST end points is\nas easy as you would expect (example from the [demo project](https://github.com/dkress59/wordpress-api-client/tree/demo)):\n\n```typescript\nimport { CustomPost, WPMenu, WPProduct } from './types'\nimport WpApiClient, { DefaultEndpointWithRevision } from 'wordpress-api-client'\n\nconst EP_PRODUCTS = 'wp/v2/products'\nconst EP_MENU = 'demo-plugin/v1/menu'\n\nexport class WpClient extends WpApiClient {\n    constructor() {\n        super('http://localhost:8080', {\n            auth: {\n                type: 'basic',\n                password: 'password',\n                username: 'admin',\n            },\n        })\n    }\n\n    post\u003cP = CustomPost\u003e(): DefaultEndpointWithRevision\u003cP\u003e {\n        return super.post\u003cP\u003e()\n    }\n\n    public product(): DefaultEndpointWithRevision\u003cWPProduct\u003e {\n        return this.addPostType\u003cWPProduct\u003e(EP_PRODUCTS, true)\n    }\n\n    menu = this.createEndpointCustomGet\u003cWPMenu\u003e(EP_MENU)\n}\n```\n\nWith this `WpClient` class, extended from this package's `WpApiClient` class,\nyou have full access to your WordPress's REST API, including your custom post\ntypes, custom end points and Advanced Custom Fields:\n\n```ts\nimport { WpClient } from './wp-client'\nconst client = new WpClient()\n\n// custom end points\nawait client.menu()\n\nawait client.product().find()\nawait client.product().create()\nawait client.product().update()\nawait client.product().delete()\nawait client.product().revision().find()\nawait client.product().revision().create()\nawait client.product().revision().update()\nawait client.product().revision().delete()\n\n// default end points\nawait client.siteSettings.find()\nawait client.taxonomy().find()\nawait client.page().find()\nawait client...\n\n```\n\n## Documentation\n\nFeel free to report an [issue](https://github.com/dkress59/wordpress-api-client/issues)\nif you are having trouble and the [documentation](https://dkress59.github.io/wordpress-api-client/)\nis not helping.\n\n## Contributors ✨\n\n\u003c!-- Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://www.damiankress.de\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/28515387?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDamian\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/dkress59/wordpress-api-client/commits?author=dkress59\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/dkress59/wordpress-api-client/commits?author=dkress59\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#example-dkress59\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"#maintenance-dkress59\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e \u003ca href=\"https://github.com/dkress59/wordpress-api-client/commits?author=dkress59\" title=\"Tests\"\u003e⚠️\u003c/a\u003e\u003c/td\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://jonathanwolfe.github.io\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1449779?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJon Wolfe\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/dkress59/wordpress-api-client/commits?author=JonathanWolfe\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"#ideas-JonathanWolfe\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n### Contributing Guidelines\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors)\nspecification. Contributions of any kind welcome!\n\nPlease fork the upstream repository into your own account and apply your changes\nto a new branch. Make sure to add tests, if necessary, before opening a PR against\nthe upstream main-branch.\n\nComment on an issue or on a PR and the\n[all-contributors bot](https://allcontributors.org/docs/en/bot/usage) will add\nyou to the list above :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkress59%2Fwordpress-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkress59%2Fwordpress-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkress59%2Fwordpress-api-client/lists"}