{"id":16485226,"url":"https://github.com/sogko/go-wordpress","last_synced_at":"2026-03-08T16:36:50.388Z","repository":{"id":57483538,"uuid":"41300364","full_name":"sogko/go-wordpress","owner":"sogko","description":"Golang client library for WP-API (Wordpress REST API)","archived":false,"fork":false,"pushed_at":"2024-03-05T22:35:57.000Z","size":171,"stargazers_count":134,"open_issues_count":7,"forks_count":44,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-31T11:21:08.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/sogko.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}},"created_at":"2015-08-24T11:55:59.000Z","updated_at":"2025-02-23T06:01:18.000Z","dependencies_parsed_at":"2024-06-11T20:38:11.557Z","dependency_job_id":"b704e11f-9e06-4dfb-ab2d-77fe422c5a84","html_url":"https://github.com/sogko/go-wordpress","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sogko%2Fgo-wordpress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sogko%2Fgo-wordpress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sogko%2Fgo-wordpress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sogko%2Fgo-wordpress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sogko","download_url":"https://codeload.github.com/sogko/go-wordpress/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252902615,"owners_count":21822262,"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":"2024-10-11T13:24:53.802Z","updated_at":"2026-03-08T16:36:50.294Z","avatar_url":"https://github.com/sogko.png","language":"Go","readme":"# go-wp-api\nGolang client library for WP-API (Wordpress REST API)\n\n\n## Installation\n\n```bash\ngo get github.com/sogko/go-wordpress\n\n```\n\n## Usage\n\n### Quick example\n```go\npackage main\n\nimport (\n\t\"github.com/sogko/go-wordpress\"\n\t\"net/http\"\n)\n\nfunc main() {\n\n  // create wp-api client\n  client := wordpress.NewClient(\u0026wordpress.Options{\n    BaseAPIURL: API_BASE_URL, // example: `http://192.168.99.100:32777/wp-json/wp/v2`\n    Username:   USER,\n    Password:   PASSWORD,\n  })\n  \t\n  // for eg, to get current user (GET /users/me)\n  currentUser, resp, body, _ := client.Users().Me()\n  if resp.StatusCode != http.StatusOK {\n    // handle error\n  }\n  \n  // `body` will contain raw JSON body in []bytes\n  \n  // Or you can use your own structs (for custom endpoints, for example)\n  // Below is the equivalent of `client.Posts().Get(100, nil)`\n  var obj MyCustomPostStruct\n  resp, body, err := client.Get(\"/posts/100\", nil, \u0026obj)\n  // ...\n  \n  log.Println(\"Current user\", currentUser)\n}\n\n```\nFor more examples, see package tests.\n\nFor list of supported/implemented endpoints, see [Endpoints.md](./endpoints.md)\n\n\n## Test\n__Note:__\nBefore running the tests, ensure that you have set up your test environment\n\n\n### Prerequisites\n- Wordpress 4.x\n- WP-API plugin\n- WP-API's BasicAuth plugin (for authentication)\n- [WP REST API Meta Endpoints plugin](https://github.com/WP-API/wp-api-meta-endpoints) (for Meta endpoints)\n\n### Setting up test environment\n- Install prequisits (see above)\n- Import [./test-data/go-wordpress.wordpress.2015-08-23.xml](./test-data/go-wordpress.wordpress.2015-08-23.xml) to your local test Wordpress installation\n- Upload at least one media to your Wordpress installation (Admin \u003e Media \u003e Upload)\n- Edit one (1) most recent Post to create a revision\n- Edit one (1) most recent Page to create a revision\n\n## Running test\n\n\n```bash\n\n# Set test enviroment\nexport WP_API_URL=http://192.168.99.100:32777/wp-json/wp/v2\nexport WP_USER=\u003cuser\u003e\nexport WP_PASSWD=\u003cpassword\u003e\n\ncd \u003cpath_to_package\u003e/github.com/sogko/go-wordpress\ngo test\n\n```\n\n## TODO\n- [ ] `godoc` documentation, so its easier for library users to map the REST APIs to library calls \n- [ ] Test `comments` API endpoint. (Currently, already implemented but not tested due to WP-API issues with creating comments reliably)\n- [ ] Support OAuth authentication\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsogko%2Fgo-wordpress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsogko%2Fgo-wordpress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsogko%2Fgo-wordpress/lists"}