Skip to main content

SDK for Blesta

Project description

Blesta Python SDK

The Blesta Python SDK provides an easy-to-use API and CLI interface for interacting with Blesta's REST API.

🚀 Quick and Easy Setup

  1. Create a Project Folder:

    mkdir my_project && cd my_project
    
  2. Set Up a Python Virtual Environment:

    python3 -m venv venv
    source venv/bin/activate  # On Windows, use venv\Scripts\activate
    
  3. Install Blesta SDK:

    pip install blesta_cli
    
  4. Configure API Credentials:

    Admins can generate API credentials in Blesta's staff area. Save these values in a .env file located in your project's root folder. The .env file should look like this:

    BLESTA_API_URL=https://your-blesta-domain.com/api
    BLESTA_API_USER=your_api_user
    BLESTA_API_KEY=your_api_key
    

That's it. Let's roll!

📖 Usage Examples

General Command Structure

blesta-cli --model <model_name> --method <method_name> [--action GET] [--params key=value key2=value2] [--last-request]
  • --model: The API model to interact with (e.g., clients, services).
  • --method: The method to call on the specified model (e.g., getList, get, getCustomFields).
  • --action: The HTTP action to perform (default is GET).
  • --params: Optional parameters to pass to the method (e.g., key=value pairs).
  • --last-request: Repeats the last request made.

Clients Model (API Documentation)

  • List all active clients:

    blesta-cli --model clients --method getList --params status=active --last-request
    
  • Get details of a specific client:

    blesta-cli --model clients --method get --params client_id=1 --last-request
    

Services Model (API Documentation)

  • List all active services:

    blesta-cli --model services --method getList --params status=active --last-request
    
  • Count the active services for a client:

    blesta-cli --model services --method getListCount --params client_id=1 status=active
    
  • List all services for a client:

    blesta-cli --model services --method getAllByClient --params client_id=1 status=active --last-request
    

🤝 Contribution

We welcome contributions! Whether it's a feature request, bug report, or pull request, we appreciate your input.

How to Contribute

  1. Fork the repository.
  2. Create a feature branch:
    git checkout -b feature/your-feature-name
    
  3. Commit your changes:
    git commit -m "Add your feature description here"
    
  4. Push to your branch:
    git push origin feature/your-feature-name
    
  5. Open a pull request.

This project is licensed under the MIT License

Happy coding! 🎉

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blesta_sdk-0.1.3.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

blesta_sdk-0.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file blesta_sdk-0.1.3.tar.gz.

File metadata

  • Download URL: blesta_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.21

File hashes

Hashes for blesta_sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c0e88777b590656e253e1177c02eb65e4eda6b3127a47f4280807d250e3369cd
MD5 4b7c1e3a7c6f014b3cc0c1a04ea898b9
BLAKE2b-256 802014c240089d3759b0c599081b36de2e28dfc0553ec8fe1d2a27e4d3190e35

See more details on using hashes here.

File details

Details for the file blesta_sdk-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: blesta_sdk-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.21

File hashes

Hashes for blesta_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 402cc26bf7e9f9c09dfad4227a818f8f1d43bb967404e83e894d772ec18b363d
MD5 6ed1e6cb873e0e4f85322f35c7b7a6bf
BLAKE2b-256 a3599d59681ab7ce732bad0031d389bcc6a0cb09b1a4719a3af17850cbbe82e9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page