ocolin/netbox 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ocolin/netbox

最新稳定版本:2.1

Composer 安装命令:

composer require ocolin/netbox

包简介

REST client for Netbox

README 文档

README

Description

This is a basic REST client for the Netbox API.

Usage

Environment variables

You can specify parameters in the constructor, but if any are left out, these environment variables will be used instead.

NETBOX_API_TOKEN - Authentication token for API

NETBOX_API_HOST - URL of server API

Instantiate

Create an instance of the Netbox object.

$netbox = new Ocolin\Netbox\Client();

Parameters

$host: Name of the Netbox host server. If null, will use Env parameter

$token: Authentication token for server. If null, will use Env parameter.

$timeout: HTTP Timeout. Defaults to 20 seconds.

$verify: Verify SSL certificate. Defaults to off.

Making a call

This method will return just the HTTP body from the server.

$output = $netbox->call( 
    path: '/dcim/devices/{id}',
    query: [
        'id' => 'f700f200-f27f-442b-b086-c6ea128953b7',
    ] 
);

Parameters

$path: REQUIRED - API endpoint path, including named parameters.

$query: Array/Object of parameters name/values to use for URI path or URI query.

$body: Array/Object for POST/PUT/PATCH HTTP body.

$method: HTTP method. Defaults to GET.

Making a full call.

Same parametes as the call() function, but different output. This will return an object 4 properties:

  • $status: HTTP status code
  • $statusMessage: HTTP status message
  • $headers: HTTP response headers
  • $body: HTTP response body
$output = $netbox->full( 
    path: '/dcim/devices/{id}',
    method: 'DELETE',
    query: [
        'id' => 'f700f200-f27f-442b-b086-c6ea128953b7',
    ] 
);

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-04-30