Core
Core
Core class for Netbox API, responsible for requests to the API.
__init__(netbox: object, endpoint: str)
Responsible for creating, getting, updating, and deleting resources in Netbox, obs. this class is not meant to be used directly, but to be inherited by other classes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
netbox |
object
|
(object) The Netbox object generated by the Client class. |
required |
endpoint |
str
|
(str) The endpoint to interact with in Netbox. |
required |
create(data) -> dict
Create a new resource in Netbox using the provided data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data |
(list or dict): The data to be used to create the resource. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Returns a dictionary with the status code and the request data in JSON format: {status: 200, data: {respondse}} |
delete(id: int) -> dict
Delete a resource in Netbox based on its ID. Args: id: (int): The ID of the resource to delete.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Returns a dictionary with the status code and the request data in JSON format: {status: 200, data: {respondse}} |
get(id: int = None, name: str = None, tags: list = None, search: str = None, filter: str = None, limit: int = 1000) -> dict
Get a resource from the endpoint on ID, name, tags, or search query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id |
int
|
(int): The ID of the resource to retrieve. |
None
|
name |
str
|
(str): The name of the resource to retrieve. |
None
|
tags |
list
|
(list): List of tags to filter resources. |
None
|
search |
str
|
(str): Search query to filter resources. |
None
|
filter |
str
|
(str): Filter query especified by the user in to filter resources. |
None
|
limit |
int
|
(int): Maximum number of results to return. Defaults to 1000. |
1000
|
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Returns a dictionary with the status code and the request data in JSON format: {status: 200, data: {respondse}}. |
update(data: list) -> dict
Update a resource in Netbox using the provided data. Args: data: (list): The data to be used to update the resource.
Returns:
| Name | Type | Description |
|---|---|---|
dict |
dict
|
Returns a dictionary with the status code and the request data in JSON format: {status: 200, data: {respondse}} |