Getting Started
To get started with the Netorca SDK, follow these steps:
Import Necessary Modules
Authentication and Setup
Before using the API or SDK, you need two things:
- Base URL (fqdn) – This is the address of your organization’s NetOrca instance (e.g., https://netorca.mycompany.com). It’s where your API calls are sent.
- API Key (api_key) – This is your personal or team-specific access token used to authenticate with the NetOrca system.
Where to get them:
- Base URL: Ask your team lead or copy the domain from the NetOrca portal your team uses.
- API Key: Log into NetOrca, go to teams menu, API Keys tab, and generate a new API key.
Create Netorca Instance
Create an instance of the Netorca class by providing either a username and password or an API key and your netorca base_url.
# Using Username and Password
netorca = Netorca(username="your_username", password="your_password", fqdn="https://your_project_base_url")
# Using API Key
netorca = Netorca(api_key="your_api_key")
Now that you have set up the authentication and created a Netorca instance, you can start using the SDK to interact with Netorca's features and data.
Sample Code
# Import necessary modules
import os
from netorca_sdk.netorca import Netorca
# Create an instance of the Netorca class with your API key and API URL
netorca = Netorca(api_key=os.environ["api_key"], fqdn=os.environ["url"])
# Define filters to narrow down the search
filters = {"service_name": "name_of_the_service"}
# Retrieve information about services using the defined filters
services_info = netorca.get_services(filters=filters)
# Print the result
print(services_info)
List of Available Methods
You can find the list of available methods in Netorca SDK PyPi documentation