{"id":19335687,"url":"https://github.com/buttercms/buttercms-go","last_synced_at":"2026-02-23T04:31:36.815Z","repository":{"id":48650557,"uuid":"62729677","full_name":"ButterCMS/buttercms-go","owner":"ButterCMS","description":"ButterCMS Go API Wrapper","archived":false,"fork":false,"pushed_at":"2024-12-23T10:46:54.000Z","size":35,"stargazers_count":39,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-09-17T22:11:09.416Z","etag":null,"topics":["api-client","cms","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ButterCMS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-07-06T14:58:21.000Z","updated_at":"2025-02-11T21:32:42.000Z","dependencies_parsed_at":"2022-08-27T01:40:22.724Z","dependency_job_id":null,"html_url":"https://github.com/ButterCMS/buttercms-go","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/ButterCMS/buttercms-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButterCMS%2Fbuttercms-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButterCMS%2Fbuttercms-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButterCMS%2Fbuttercms-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButterCMS%2Fbuttercms-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ButterCMS","download_url":"https://codeload.github.com/ButterCMS/buttercms-go/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButterCMS%2Fbuttercms-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276987794,"owners_count":25740662,"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-25T02:00:09.612Z","response_time":80,"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-client","cms","go","golang"],"created_at":"2024-11-10T03:08:31.211Z","updated_at":"2025-09-25T22:11:05.712Z","avatar_url":"https://github.com/ButterCMS.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ButterCMS Go API Wrapper\n\nThis wrapper is meant to enable Go developers to quickly and easily get up and running with [ButterCMS](https://buttercms.com/). It is based of off the [API documentation](https://buttercms.com/docs/api/).\n\n## Versioning\n\nEach revision of the binding is tagged and the version is updated accordingly.\n\nIt is highly recommended you use `go modules` for vendoring/package management, in order to ensure a newer\nversion of the binding does not affect backwards compatibility.\n\n## Installation\n\n```sh\ngo get github.com/buttercms/buttercms-go\n```\n\n## Pages\n\nFull list of `params` availble in our official [API Documentation](https://buttercms.com/docs/api/?go#pages)\n\n```\nparams := map[string]string{\"foo\": \"bar\"}\nButterCMS.GetPages(\"news\", params)\nButterCMS.GetPage(\"news\", \"another-test-page\", params)\n```\n\n## Collections\n\nFull list of `params` availble in our official [API Documentation](https://buttercms.com/docs/api/?go#collections)\n\n```\nparams := map[string]string{\"locale\": \"en\"}\nButterCMS.GetContentFields([]string{\"collection_key\"}, params)\n```\n\n## Blog Engine\n```\n// Posts\nparams := map[string]string{\"page\": \"2\"}\nButterCMS.GetPosts(params)\nButterCMS.GetPost(\"slug\")\n\n// Authors\nparams = map[string]string{\"include\": \"recent_posts\"}\nButterCMS.GetAuthors(params)\nButterCMS.GetAuthor(\"slug\", params)\n\n// Categories\nButterCMS.GetCategories(params)\nButterCMS.GetCategory(\"slug\", params)\n\n// Feeds\nButterCMS.GetFeed(\"rss|atom|sitemap\")\n\n// Search\nButterCMS.SearchPosts(\"query\", params)\n```\n\n## Usage\n\nTo include this package in your Go code, simply use `import \"ButterCMS\"` at the top of your file\n\n### Preview mode\n\nPreview mode can be used to setup a staging website for previewing content fields or for testing content during localdevelopment. To fetch content from preview mode call `ButterCMS.SetPreviewMode` with `true` input:\n\n```go\npackage main\n...\nButterCMS.SetPreviewMode(true)\n```\n\n## Example Usage\n\n```go\npackage main\n\nimport (\n\t\"github.com/buttercms/buttercms-go\"\n\t\"fmt\"\n\t\"encoding/json\"\n)\n\nfunc main() {\n\tButterCMS.SetAuthToken(\"\u003cauth_token\u003e\")\n\n\tparams := map[string]string{\"include\": \"recent_posts\"}\n\tauthorResp, err := ButterCMS.GetAuthors(params)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfmt.Printf(\"%+v\\n\", authorResp)\n\n\tparams = map[string]string{\"author_slug\": \"author-slug\"}\n\tpostResp, err := ButterCMS.GetPosts(params)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfmt.Printf(\"%+v\\n\", postResp)\n\n\tpagesResp, err := ButterCMS.GetPages(\"news\", nil)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tfmt.Printf(\"%d Results\\n\", pagesResp.MetaData.Count)\n\tfor index, page := range pagesResp.PageList {\n\t\tfmt.Printf(\"Result %d: %s\\n\", index, page.Slug)\n\n\t\tif (len(page.Fields) \u003e 0) {\n\t\t\tfmt.Println(\"Custom fields:\")\n\t\t\tfor fieldName, fieldValue := range page.Fields {\n\t\t\t\tswitch value := fieldValue.(type) {\n\t\t\t\t\tcase string:\n\t\t\t\t\t\tfmt.Printf(\"Field '%1s' has value '%2s'\\n\", fieldName, value)\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tfmt.Println(\"Other type\\n\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tcontentParams := map[string]string{}\n\tcontentKeys := []string{\"somethings\"}\n\tcontentResp, err := ButterCMS.GetContentFields(contentKeys, contentParams)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tj, err := json.Marshal(contentResp)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tfmt.Println(string(j))\n}\n```\n\n### Other\n\nView these Go [Blog engine](https://buttercms.com/golang-blog-engine/) and [Full CMS](https://buttercms.com/golang-cms/) for other examples of using ButterCMS with Go.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuttercms%2Fbuttercms-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuttercms%2Fbuttercms-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuttercms%2Fbuttercms-go/lists"}