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.2.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.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blesta_sdk-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 07b3fd3a5332b66af8307e4a1e1d3dc1d941ac923f8604f8e1e2d1062c49d6df
MD5 db5754bdc67c1053df70344abfe5f272
BLAKE2b-256 6b1386359b05000c96add2925a9d84e2d14bdb0187abf4d0eceafbc466e02227

See more details on using hashes here.

File details

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

File metadata

  • Download URL: blesta_sdk-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7fc9f5c5659dabea52a9847e88e2b34d6e8a24fbfcb2c64a3c5af3b25435dbce
MD5 5b008e6564f885621998eb9efc06a6ae
BLAKE2b-256 18006f568cba00bfd1a12f730b637b9b572b6af858def5263e3ec5f1643c7199

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