MultiPortal includes a robust API that enables you to programmatically interact with your MultiPortal instance. This API mirrors most of the actions available through the browser interface, allowing for integration with other systems or automation of various tasks.
To use the API, you'll first need to generate an OAuth token. This token will be used to authenticate your API requests.
-
Navigate to the Settings Menu:
- Log in to your MultiPortal instance.
- Go to the settings menu from your dashboard.
-
Click on "OAuth Clients":
- Within the settings menu, find and click on "OAuth Clients."
-
Generate a New OAuth Client:
- Select "Generate OAuth Client" to create a new OAuth client for API access.
- The redirect URL is automatically set to
'/'
, which you do not need to modify.
-
Copy the Client ID and Secret:
- Once the client is generated, make sure to copy the Client ID and Client Secret, as you will need them to authenticate API requests.
MultiPortal provides API documentation in an interactive format, making it easy to explore available endpoints and test API requests.
-
Click on the Profile Menu:
- In the top right corner of the MultiPortal dashboard, click on your profile icon to open the dropdown menu.
-
Select "API Documentation":
- From the dropdown menu, click on "API Documentation."
-
Access the Swagger View:
- You will be redirected to the Swagger interface, which provides a detailed view of the API.
- The Swagger view allows you to explore all available API endpoints, their methods, parameters, and responses.
For easier interaction with the API, you can automatically import the Swagger documentation into Postman or any other API tool you prefer.
- From the Swagger documentation page, download or copy the Swagger/OpenAPI specification.
- In Postman, select the option to Import and choose the Swagger file or paste the URL to the specification.
- Once imported, you can interact with the API directly from Postman, using your generated OAuth token for authentication.
The MultiPortal API allows you to perform a wide variety of actions, including but not limited to:
- Managing Virtual Data Centers (VDCs)
- Creating and managing users and roles
- Performing networking tasks
- Monitoring and reporting on resources
Some common endpoints you will find in the API documentation include:
- Authentication: Authenticate using OAuth tokens.
- VDC Management: Create, update, and delete Virtual Data Centers.
- User Management: Manage users, roles, and permissions.
- Networking: Set up and manage external and internal networks.
Each endpoint is documented with:
- HTTP Methods: (GET, POST, PUT, DELETE)
- Parameters: Path and body parameters required for the request.
- Responses: Success and error response codes with example outputs.
MultiPortal’s API, introduced in version 0.5.0, opens the door to programmatic interaction with your instance, enabling automation and integration with external systems. The simple OAuth-based authentication, along with the well-documented Swagger interface, makes it easy to explore and use the API. Whether managing resources, handling VDCs, or interacting with users, MultiPortal’s API provides flexibility and power for advanced use cases.