Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Handlers

A typical handler should be configured as is HTTPS or HTTP (called via POST requests). Local server scriptswith an URL of the script, which will get HTTP POST requests about each event occurrence.

Please avoid using Script type of the handlers, they are designed for internal usage within the system (called locally on the server) are extremely rare cases used mainly by the JeraSoft team.


Panel
borderColor#ccffcc
bgColor#ccffcc
borderWidth2px
borderStylesolid

Best practice example

There is an example based on https://hostname/handler-endpoint usage.

Open the Provisioning section and start creating a handler.

  1. Specify the name, type, and status.
  2. In the Event field, select Clients Create event from the drop-down list.
  3. In the Task field, indicate HTTPS type and define the URL for the handler, for example, my-domain.org/api.
  4. Click Apply.

Find an example of the http://handler below:

Code Block
languagepy
from flask import Flask, request
import json
app = Flask(__name__)
@app.route("/api", methods=['GET', 'POST'])
def api():
    data = json.loads(request.data)
    return json.dumps(data)
if __name__ == "__main__":
    app.run()



Supported Events

The Provisioning API supports the following list of events:

  • Clients
    • clients.create
    • clients.update
    • clients.
    delete
    • archive
    • clients.
    archive
    • delete
    • clients.
    custom
    • balance_
    fields.update
    • zero
    • clients.balance_notzero
    • clients.
    balance_zero
    • custom_fields.update
  • Accounts
    • clients.accounts.create
    • clients.accounts.update
    • clients.accounts.delete
  • Subscriptions
    • clients.subscriptions.assign
    • clients.subscriptions.activate
    • clients.subscriptions.deactivate
    • clients.subscriptions.renew
    • clients.subscriptions.close
  • Email Rates Manager
    • email_rates_manager.import
  • Import Manager
    • importd.process_success
    • importd.process_failed

Payload Structure


The "event" value contains the following data:

  • dt: the date-time of the event in the ISO8601 format;
  • events_id: the event, which happened per se;
  • object_id: the entity, to which the event happened.
Code Block
{
  "event": {
    "dt": "2000-01-01T00:00:00+00:00",
    "events_id": "clients.update",
    "object_id": 12
  },
  "data": {
    "id": 12,
    "field": "some-value" 
  }
}

The clients.accounts.delete, clients.archive, clients.balance_notzero, clients.balance_zero, and clients.delete events send empty data: {} (as we send the event info, there is no need to duplicate it in data).

Info
titleNote

The clients.custom_fields_update event has been renamed to clients.custom_fields.update starting from JeraSoft Billing v3.23 for consistency.

Payload Details

Clients

...