{"id":13710838,"url":"https://github.com/netbox-community/go-netbox","last_synced_at":"2025-05-15T14:03:26.122Z","repository":{"id":40685791,"uuid":"62183066","full_name":"netbox-community/go-netbox","owner":"netbox-community","description":"The official Go API client for Netbox IPAM and DCIM service.","archived":false,"fork":false,"pushed_at":"2025-02-28T00:46:02.000Z","size":16019,"stargazers_count":208,"open_issues_count":1,"forks_count":166,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-04-15T03:52:37.953Z","etag":null,"topics":["go","netbox","netbox-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netbox-community.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.md","funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-29T00:32:14.000Z","updated_at":"2025-03-10T15:43:16.000Z","dependencies_parsed_at":"2024-05-06T09:27:31.520Z","dependency_job_id":"75e751f3-f605-4b45-a6c8-ce72e9ec5d98","html_url":"https://github.com/netbox-community/go-netbox","commit_stats":{"total_commits":120,"total_committers":24,"mean_commits":5.0,"dds":0.7333333333333334,"last_synced_commit":"3237c9d5509bfd63491ad2635b6bd6f0ed5313bb"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbox-community%2Fgo-netbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbox-community%2Fgo-netbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbox-community%2Fgo-netbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netbox-community%2Fgo-netbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netbox-community","download_url":"https://codeload.github.com/netbox-community/go-netbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249003955,"owners_count":21196794,"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":["go","netbox","netbox-api"],"created_at":"2024-08-02T23:01:01.302Z","updated_at":"2025-04-15T03:52:45.750Z","avatar_url":"https://github.com/netbox-community.png","language":"Go","funding_links":[],"categories":["SDKs"],"sub_categories":[],"readme":"# go-netbox\n\n[![GoDoc](https://pkg.go.dev/badge/github.com/netbox-community/go-netbox/v4)](https://pkg.go.dev/github.com/netbox-community/go-netbox/v4) [![Build Status](https://github.com/netbox-community/go-netbox/workflows/main/badge.svg?branch=master)](https://github.com/netbox-community/go-netbox/actions) [![Report Card](https://goreportcard.com/badge/github.com/netbox-community/go-netbox)](https://goreportcard.com/report/github.com/netbox-community/go-netbox)\n\n_go-netbox_ is —to nobody's surprise— the official [Go](https://go.dev) API client for the [Netbox](https://github.com/netbox-community/netbox) IPAM and DCIM service.\n\nThis project follows [Semantic Versioning](https://semver.org). The version of the library built for a Netbox version has the same tag, followed by a hyphen and the build number (an incremental integer), as several versions of the library may exist for the same version of Netbox.\n\n## Installation\n\nUse `go get` to add the library as a dependency to your project. Do not forget to run `go mod init` first if necessary.\n\n```shell\ngo get github.com/netbox-community/go-netbox/v4\n\n# Or install a specific version\ngo get github.com/netbox-community/go-netbox/v4@v4.2.2-0\n```\n\n**Note:** dependencies should be managed with [Go modules](https://go.dev/doc/modules/managing-dependencies).\n\n## Usage\n\n### Instantiate the client\n\nThe package has a constructor for creating a client by providing a URL and an authentication token.\n\n```golang\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/netbox-community/go-netbox/v4\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tc := netbox.NewAPIClientFor(\"https://demo.netbox.dev\", \"v3ry$3cr3t\")\n\n\tlog.Printf(\"%+v\", c)\n}\n\n```\n\n### Use the client\n\nWith the client already instantiated, it is possible to consume any API feature.\n\nFor example, to list the first 10 active virtual machines:\n\n```golang\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\n\t\"github.com/netbox-community/go-netbox/v4\"\n)\n\nfunc main() {\n\tctx := context.Background()\n\n\tc := netbox.NewAPIClientFor(\"https://demo.netbox.dev\", \"v3ry$3cr3t\")\n\n\tres, _, err := c.VirtualizationAPI.\n\t\tVirtualizationVirtualMachinesList(ctx).\n\t\tStatus([]string{\"active\"}).\n\t\tLimit(10).\n\t\tExecute()\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Printf(\"%v\", res.Results)\n}\n```\n\nSee [docs](docs) or [reference](https://pkg.go.dev/github.com/netbox-community/go-netbox) for more information on all possible usages.\n\n## Development\n\nThe project comes with a containerized development environment that may be used on any platform. It is only required to have [Git](https://git-scm.com) and [Docker Desktop](https://www.docker.com/products/docker-desktop/) (or, separately, [Docker](https://docs.docker.com/engine/install) and [Docker Compose](https://docs.docker.com/compose/install/)) installed on the machine.\n\nTo start the development environment, run the following command.\n\n```bash\nmake\n```\n\nThen, to attach a shell in the container, run the command below.\n\n```bash\nmake shell\n```\n\nFinally, to stop the development environment, run the following command.\n\n```bash\nmake down\n```\n\n### Considerations\n\nThe library is entirely generated from the Netbox [OpenAPI](https://www.openapis.org/) specification using _[openapi-generator](https://github.com/OpenAPITools/openapi-generator)_. Therefore, files listed [here](.openapi-generator/files) should not be directly modified, as they will be overwritten in the next regeneration (see next section).\n\nIn order to fix a bug in the generated code, the corresponding error in the OpenAPI spec must be fixed. To do so, the following steps may be followed:\n\n1. Optional. Patch the OpenAPI spec in this repo by editing [this script](scripts/fix-spec.py), so that a corrected version can be published as soon as possible.\n2. Fix the OpenAPI spec in the [Netbox repository](https://github.com/netbox-community/netbox), either by reporting an issue or by creating a pull request.\n\n### Regenerate the library\n\nTo update the OpenAPI specification to the latest Netbox version and regenerate the library, run the following command.\n\n```bash\nmake build\n```\n\nIf regeneration of the library is needed for a specific Netbox version other than the latest one, pass the corresponding argument.\n\n```bash\nmake build NETBOX_VERSION=3.0.0\n```\n\nIn order to obtain the OpenAPI specification, the version of _[netbox-docker](https://github.com/netbox-community/netbox-docker)_ corresponding to the given Netbox version is used. However, it is also possible to provide a specific version of _netbox-docker_.\n\n```bash\nmake build NETBOX_VERSION=3.0.0 NETBOX_DOCKER_VERSION=1.3.1\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetbox-community%2Fgo-netbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetbox-community%2Fgo-netbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetbox-community%2Fgo-netbox/lists"}