{"id":16615580,"url":"https://github.com/pschmitt/nbx","last_synced_at":"2025-03-11T01:53:06.482Z","repository":{"id":244937121,"uuid":"816676419","full_name":"pschmitt/nbx","owner":"pschmitt","description":"Netbox bash API client","archived":false,"fork":false,"pushed_at":"2025-03-04T16:46:19.000Z","size":352,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T17:38:31.641Z","etag":null,"topics":["netbox","netbox-api"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pschmitt.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},"funding":{"github":["pschmitt"],"custom":["https://www.paypal.com/paypalme/pppschmitt"]}},"created_at":"2024-06-18T07:41:25.000Z","updated_at":"2025-03-04T16:46:22.000Z","dependencies_parsed_at":"2025-03-04T17:29:51.615Z","dependency_job_id":"ee18d28d-3b76-4437-953f-784d99b187c2","html_url":"https://github.com/pschmitt/nbx","commit_stats":null,"previous_names":["pschmitt/nbx"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschmitt%2Fnbx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschmitt%2Fnbx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschmitt%2Fnbx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pschmitt%2Fnbx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pschmitt","download_url":"https://codeload.github.com/pschmitt/nbx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242956551,"owners_count":20212454,"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":["netbox","netbox-api"],"created_at":"2024-10-12T02:09:55.546Z","updated_at":"2025-03-11T01:53:06.453Z","avatar_url":"https://github.com/pschmitt.png","language":"Shell","funding_links":["https://github.com/sponsors/pschmitt","https://www.paypal.com/paypalme/pppschmitt"],"categories":[],"sub_categories":[],"readme":"# nbx\n\nThis script provides a command-line interface for interacting with a NetBox\ninstance. It supports a range of operations to list, filter, and manipulate\nNetBox data through both [REST](https://demo.netbox.dev/static/docs/rest-api/overview/)\nand [GraphQL](https://demo.netbox.dev/static/docs/graphql-api/overview/) APIs.\n\n## 📋 Table of Contents\n\n- [📦 Installation](#installation)\n- [⚙️ Configuration](#configuration)\n- [🚀 Usage](#usage)\n  - [Global Options](#global-options)\n  - [List Actions](#list-actions)\n  - [Meta Actions](#meta-actions)\n  - [Workflows](#workflows)\n  - [Raw Commands](#raw-commands)\n- [🔍 Examples](#examples)\n  - [List Devices](#list-devices)\n  - [Assign Devices to a Cluster](#assign-devices-to-a-cluster)\n  - [GraphQL Query](#graphql-query)\n  - [More Examples](#more-examples)\n- [📜 License](#license)\n\n## 📦 Installation\n\nRequirements:\n\n- awk (GNU, gawk)\n- bash\n- curl\n- jq\n\nClone the repository and make the script executable:\n\n```bash\ngit clone https://github.com/pschmitt/nbx.git\ncd nbx\nchmod +x nbx.sh\n```\n\n## ⚙️ Configuration\n\nThe script uses environment variables to configure its behavior:\n\n- `NETBOX_URL`: The base URL for your NetBox instance. Default is `https://demo.netbox.dev`.\n- `NETBOX_API_TOKEN`: Your [API token](https://demo.netbox.dev/static/docs/rest-api/authentication/) for authentication.\n- Additional environment variables can be set to customize the script's behavior (e.g., `COMPACT`, `CONFIRM`, `DRY_RUN`).\n\n## 🚀 Usage\n\nRun the script with the desired options and actions:\n\n```bash\nnbx [options] ACTION [ARGS]\n```\n\n### Global Options\n\n| Option              | Description                                                            |\n| ------------------- | ---------------------------------------------------------------------- |\n| `-a, --api TOKEN`   | NetBox API Token (default: `$NETBOX_API_TOKEN`).                       |\n| `-u, --url URL`     | NetBox URL (default: `$NETBOX_URL`).                                   |\n| `-g, --graphql`     | Use GraphQL API instead of REST API (list actions only).               |\n| `-D, --debug`       | Enable debug output.                                                   |\n| `-P, --pedantic`    | Enable pedantic mode (exit on any error).                              |\n| `-W, --no-warnings` | Disable warnings.                                                      |\n| `-k, --dry-run`     | Dry-run mode.                                                          |\n| `--confirm`         | Confirm before executing actions.                                      |\n| `--no-confirm`      | Do not confirm before executing actions.                               |\n| `-o, --output TYPE` | Output format: pretty (default), json.                                 |\n| `-j, --json`        | Output format: json.                                                   |\n| `-N, --no-header`   | Do not print header.                                                   |\n| `-c, --no-color`    | Disable color output.                                                  |\n| `--compact`         | Truncate long fields.                                                  |\n| `--header`          | Keep header when piping output (default: remove).                      |\n| `-I, --with-id`     | Include ID column.                                                     |\n| `-C, --comments`    | Include comments column (shorthand for `--columns +comments`).         |\n| `--columns COLUMNS` | List of columns to display (prefix with '+' to append, '-' to remove). |\n| `-s, --sort FIELD`  | Sort by field/column (prefix with '-' to sort in reverse order).       |\n\n### List Actions\n\n| Action                       | Description           |\n| ---------------------------- | --------------------- |\n| `aggregates [FILTERS]`       | List aggregates       |\n| `cables [FILTERS]`           | List cables           |\n| `circuits [FILTERS]`         | List circuits         |\n| `clusters [FILTERS]`         | List clusters         |\n| `config-contexts [FILTERS]`  | List config contexts  |\n| `contacts [FILTERS]`         | List contacts         |\n| `devices [FILTERS]`          | List devices          |\n| `interfaces [FILTERS]`       | List interfaces       |\n| `inventory-items [FILTERS]`  | List inventory items  |\n| `ip-addresses [FILTERS]`     | List IP addresses     |\n| `locations [FILTERS]`        | List locations        |\n| `manufacturers [FILTERS]`    | List manufacturers    |\n| `platforms [FILTERS]`        | List platforms        |\n| `prefixes [FILTERS]`         | List prefixes         |\n| `providers [FILTERS]`        | List providers        |\n| `racks [FILTERS]`            | List racks            |\n| `regions [FILTERS]`          | List regions          |\n| `services [FILTERS]`         | List services         |\n| `sites [FILTERS]`            | List sites            |\n| `tags [FILTERS]`             | List tags             |\n| `tenants [FILTERS]`          | List tenants          |\n| `virtual-chassis [FILTERS]`  | List virtual chassis  |\n| `virtual-machines [FILTERS]` | List virtual machines |\n| `vlans [FILTERS]`            | List VLANs            |\n| `vrfs [FILTERS]`             | List VRFs             |\n| `wireless-lans [FILTERS]`    | List wireless LANs    |\n\n### Meta Actions\n\n| Action                                                | Description                                |\n| ----------------------------------------------------- | ------------------------------------------ |\n| `cols OBJECT_TYPE`                                    | List available columns for an object type. |\n| `introspect (--types,--query,--fields) [OBJECT_TYPE]` | Introspect GraphQL API.                    |\n\n### Workflows\n\n| Action                                | Description                  |\n| ------------------------------------- | ---------------------------- |\n| `assign-to-cluster CLUSTER [FILTERS]` | Assign devices to a cluster. |\n\n### Raw Commands\n\n| Action                           | Description                             |\n| -------------------------------- | --------------------------------------- |\n| `graphql [--raw] QUERY [FIELDS]` | GraphQL query.                          |\n| `raw ENDPOINT`                   | Fetch raw data from an endpoint (REST). |\n\n## 🔍 Examples\n\n### List Devices\n\nTo list all devices, sorted by name, with a pretty output format:\n\n```bash\nnbx devices\n```\n\n### Assign Devices to a Cluster\n\nTo assign devices matching certain criteria to a specific cluster:\n\n```bash\nnbx assign-to-cluster CLUSTER_NAME \"role=server\" \"site=nyc\"\n```\n\n### GraphQL Query\n\nTo run a GraphQL query against the NetBox API:\n\n```bash\nnbx graphql --raw '{ list_devices { id name } }'\n```\n\n### More examples\n\nCheck out the [examples](./examples) directory for more examples.\n\n## 📜 License\n\nThis project is licensed under the GPL-3.0 License.\nSee the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpschmitt%2Fnbx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpschmitt%2Fnbx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpschmitt%2Fnbx/lists"}