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_sdk
    
  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.4.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.4-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: blesta_sdk-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 973112bb6029de5e7beaa54a328acde3a3bcc71998c978a70d3a782d928071ba
MD5 bab4fe476b3308cc41a8b44fdbdbcc64
BLAKE2b-256 a871b46ab8c03ba742b3c6cf9eeef9d6cf339e89ee51fa2539a5cc174d35536f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for blesta_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1db7c6d6571004e6e8ed3ac087f9fa970e74954c7180d6d9b7ec5e51fa4708db
MD5 38c618e5572af58e456afbc2063644eb
BLAKE2b-256 b8fc7fed46c93ffcc916ab50bcf9a671e4a35b82ce867b746e3e3b60987a10a7

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