Skip to main content

API

Typical API request is SERVER_URL/api?cat=device&action=get_onu_info&param=ZTEGC01234567

API support GET and POST requests

Of cource API support access key (key) what is optional (SERVER_URL/api?cat=device&action=get_onu_info&param=ZTEGC01234567&key=AAAA)

key is optional parametr. Set it in options


Category (cat) - billing

update_region - Create or update region data (If no id or no data in database - new region will created)

  • id = REGION_ID (required)
  • title = REGION_NAME(required)

update_district - Create or update district data (If no id or no data in database - new district will created)

  • id = DISTRICT_ID (required)
  • region_id = REGION_ID (required)
  • title = DISTRICT_NAME(required)

update_city - Create or update city data (If no id or no data in database - new city will created)

  • id = CITY_ID (required)
  • district_id = DISTRICT_ID (required)
  • title = CITY_NAME (required)

update_street - Create or update street data (If no id or no data in database - new street will created)

  • id = STREET_ID (required)
  • city_id = CITY_ID (required)
  • title = STREET_NAME (required)

update_building - Create or update building data (If no id or no data in database - new building will created )

  • id = BUILDING_ID (required)
  • title = BUILDING_NAME (required)
  • street_id = STREET_ID (required)
  • description
  • entrances_count
  • floors_count
  • lat
  • lon

update_user - Create or update user data (If no id or no data in database - new user will created)

  • id = USER_ID (required)
  • building_id
  • login
  • user_name
  • mac (if no param - NULL by default)
  • onu_name (if no param - NULL by default)
  • ip (if no param - NULL by default) 
  • is_business
  • apartment
  • entrance
  • floor
  • money
  • status
  • lat
  • lon
  • address (If no address - it will autogenerated by building_id)
  • deleted_at - (if date in format 2025-01-01 00:00:00 - user will deleted.  If empty - user will recovered. If no argument - no changes)

set_user_phone - Update user phone. 

  • id = USER_ID (required)
  • phones = PHONES ARRAY (required)
    • Required param for phones is phone, type (mobile, stationary, fax), description
    • SAMPLE
      http://IP/api?cat=billing&action=set_user_phone&id=1&phones=
      [{"phone":"+38012345678","type":"mobile","description":"descr1"},
      {"phone":"+38012345679","type":"stationary","description":"descr2"},
      {"phone":"+38012345670","type":"fax","description":""}]

get_user - get user info by user ID (from build_345)

    id = user ID (required)

    get_user_id - get user ID by MAC, ONU, login (from build_335)

    • param = MAC, ONU, login (required)
    • type = search by type (available login, mac, onu_name). If no type, using search in all section

    get_regions - get all region list (from build_337)

    get_districts - get all districts list (from build_337)

    • with_parents = 1 - to load relation (region)

    get_cities - get all cities list (from build_337)

    • with_parents = 1 - to load relation (region, district)

    get_streets - get all streets list (from build_337)

    • with_parents = 1 - to load relation (region, district, city)

    get_buildings - get all buildings list (from build_337)

    • with_parents = 1 - to load relation (region, district, city, street)

    get_region - get region list (from build_337)

    • id = REGION_ID (required). For multiple use comma as separator

    get_district - get districts list (from build_337)

    • id = DISTRICT_ID (required). For multiple use comma as separator
    • with_parents = 1 - to load relation (region)

    get_city - get cities list (from build_337)

    • id = CITY_ID (required). For multiple use comma as separator
    • with_parents = 1 - to load relation (region, district)

    get_street - get streets list (from build_337)

    • id = STREET_ID (required). For multiple use comma as separator
    • with_parents = 1 - to load relation (region, district, city)

    get_building - get buildings list (from build_337)

    • id = BUILDING_ID (required). For multiple use comma as separator
    • with_parents = 1 - to load relation (region, district, city, street)

    delete_region - deleting region (from build_337)

    • id = REGION_ID (required)

    delete_district - deleting district (from build_337)

    • id = DISTRICT_ID (required

    delete_city - deleting city (from build_337)

    • id = CITY_ID (required)

    delete_street - deleting street (from build_337)

    • id = STREET_ID (required)

    delete_building - deleting building (from build_337)

    • id = BUILDING_ID (required).

    get_work_sheduler_day_types - show day types for scheduler

    get_work_sheduler - get users work scheduler

    • day_type - can see in get_work_sheduler_day_types
    • year - like 2025
    • month - like 2 (from 1 to 12)
    • day - like 2z (from 1 to 31)
    • user_groups_id - user group ID. For multiple use comma as separator
    • users_id - user ID. For multiple use comma as separator

    set_gps - set GPS traker position

    • tracker_id - TRACKER_ID or IMEI (required)
    • lat - latitude (required)
    • lon - longitude (required)
    • last_alive - time of last activity (Y-m-d H:i:s) 
    • protocol_name (see here https://github.com/gviabcua/grusher_gps_modules/)
    • speed - car speed


    Category (cat) - db

    This category get information from database without requests to devices or other services

    Devices

    availability - show list of device and ports with online status (/api?cat=db&action=availability)

    • orderby = 'ip', 'hostname', 'monitoring_is_device_available' 
    • order = 'asc', 'desc'

    device_id_by_hostname - Device ID based on hostname

    • hostname = HOSTNAME(required)
    • type = first_like, first_strict, all_like, all_strict (optional). Default is first_strict

    get_device_coordinates - get information about lat & lon for all devices

    get_device_by_ip - get information about device by IP

    • ip = IP (required)

    get_db_info_by_enterprise - get information about device by IP

    • enterprise = ENTERPRISE (required)

    get_device_list - get device list

    • param = DEVICE_TYPE (use get_device_types_list)

    get_device_list_short - get device list (IP only)

    • param = DEVICE_TYPE (use get_device_types_list)

    get_device_types_list - get devices types

    get_fdb - get FDB table from DB

    • ip = IP (required)

    get_arp_table - get ARP table

    • ip = IP (required)

    get_route_table - get Routing table

    • ip = IP (required)

    get_lldp - get LLDP

    • ip = IP (required)

    get_ip_address_table - get IP Address table

    • ip = IP (required)

    get_onus_counts_on_ifaces - get ONUs count on each PON port

    • ip = IP (required)

    get_system_users - list of users

    • id = user id
    • group_id = group id

    get_system_user_groups - list of user groups

    • id = group id

    update_device_active_at_date - update device active date

    • ip = IP (required)

    set_onu_field - update any field in ONU (/api?cat=db&action=set_onu_field&onu_name=ZTEGC1123456&field=description&data=DESCRIPTION)

    • onu_name (required)
    • field (required)
    • data (required)

    set_device_field - update any field in device 

    • ip (required)
    • field (required)
    • data (required)

    send_metrics - allow to send metrics from external source like script or so on (default supported types are: ALARM, ALARM MAIN, ALARM PORT, ALARM POWER, ALARM SENSOR,  AMPERAGE, Card CPU, Card CPU, Card Power, Card Power, Card RAM, Card RAM, Card Temp, Card Temp, CPU, CPU, DC_voltage, DC_voltage, Energy,  FAN, HDD Free, HDD Load, Humidity, Power Supply, Power Type, PRINTER PRINTED, RAM Free, RAM Load, RX RADIO, SSID RADIO, Temp, TX RADIO, VOLTAGE.
    For power monitoring: BATTERY_AMPERAGE, BATTERY_ENERGY, BATTERY_VOLTAGE, BATTERY_SOC, GRID_AMPERAGE, GRID_Energy, GRID_FREQUENCY, GRID_VOLTAGE_INPUT, GRID_VOLTAGE_OUTPUT, VOLTAGE_INPUT, VOLTAGE_OUTPUT). From build 316

    • device_id OR ip (required) 
    • metric (required)
    • value (required)

    This section should contain the following keywords: ALARM, AMPERAGE, CPU, DC, ENERGY, FAN, GRID, HDD, HUMIDITY, POWER, PRINTER, RAM , SOC, TEMP, VOLTAGE. This is necessary for correct parsing by the system.
    It is possible to add various prefixes to specify the parameters like FAN_FRONT, FAN_BACK.
    Of course, you can use your own names, but they will be presented exclusively in the digital graph.

    cli - running CLI command

    • ip (required)
    • param (required) - you can see in device requests data 

      зображення.png

    • sub_param1 - like ONU SN/MAC, 
    • sub_param2 - like ONU ETHERNET PORT NUMBER
    • param_to_send - other params
    • port - port number
    • ifname - port ifName
    Events

    get_gevent_alarm - get events types (/api?cat=db&action=get_gevent_alarm)

    get_gevents - All active events (/api?cat=db&action=get_gevents)

    • event_type_id = EVENT_TYPE_ID

    get_gevents - Events by type, id and other (/api?cat=db&action=get_gevents&id=109055   /api?cat=db&action=get_gevents&param=onu_name_id&id=126001&history=2)

    • id = EVENT ID or (required)
    • ip = DEVICE IP or (required)
    • param = BY FIELD ("device_id", "port_id", "onu_name_id", "sfp_id", "closed_by_id", "confirmed_by_id", "event_id") - ID (required)
    • history = (2 - active + history, 1 - history, 0 - active)

    • event_type_id

    • show_additional = 1 (show info about device, ONU, SFP, port)
    ONUs

    get_last_registered_onu - get list of last registeref ONUs

    get_unregistered_onu - get info from database about unregistered ONUs

    get_unregistered_onu_scan - get info from database about unregistered ONUs after searching 

    get_unregistered_onu_param - get param for ONU register

    get_unregistered_onu_reg_template - get templates for ONU register

    get_onu_history - get ONUs signal history

    • param = ONU_NAME (required)
    • sub_param1 = DATE_FROM

    get_onu_list_all  - get all ONUs list

    get_onu_list_only - Get ONUs list by param (category)

    • param = 'critical', 'monitoring_enable', 'without_fob', 'without_fob_na', DEVICE_ID

    onu_geo_list - show ONUs with geo coordinates, addresses and user

    • param = 'critical', 'bad-signals'

    get_onu_list_by_ip - get ONUs list on OLT by IP

    • ip = IP (required)

    get_pon_iface_onu_load_by_olt_id - Show PON ports load by ONU on OLT

    • param = DEVICE_ID (required)

    get_pon_iface_onu_load - Show PON ports load by ONU

    • param = 'epon', 'gpon'

    search_onu - Search ONU by name, description, ONU MAC/SN 

    • param - name, description, ONU MAC/SN (required)
    • strict - '1' - strick search. Default 0

    update_onu_fob - update FON/PONBOX in ONU card

    • param = ONU_NAME (required)
    • sub_param1 = FOB (required)

    update_onu_main_info - update additional info about ONU, set monitoting data

    • onu_name = ONU SN/MAC (required)
    • critical_onu - set ONU as critical (available data 0 or 1)
    • monitoring_enable - set ONU to monitoring avaliability (available data 0 or 1)
    • active - set ONU as active (available data 0 or 1)
    • send_notify - set ONU as critical (available data 0 or 1)
    • monitoring_iface_metrics - set ONU as getting traffic (available data 0 or 1)
    • node_id - set node ID as FOB-box and so on (integer, more when 0)
    • building_id - set building ID where ONU is located (integer, more when 0)
    • lon  - geo coordinates
    • lat  - geo coordinates
    • fob_n - FOB-BOX number (as text)
    • description - ONU description (as text)
    SFP

    get_sfp_power_history - get signal historu about SFP

    • param = DEVICE_ID (required)
    • port = PORT_NAME(required)
    • sub_param1 = DATE_FROM
    Users

    get_user_by_onu - get information about user what associated this this ONU (/api?cat=db&action=get_user_by_onu¶m=ZTEGC01234567)

    • param=ONU_NAME (required)

    get_user_by_mac - get information about user what associated this this MAC address (/api?cat=db&action=get_user_by_mac¶m=012345678911)

    • param=MAC (required)

    get_user_by_login - get information about user what associated this this MAC login (/api?cat=db&action=get_user_by_login¶m=user)

    • param=LOGIN (required)

    set_user_geo_by_login - set user geo by login (/api?cat=db&action=set_user_geo_by_login¶m=LOGIN&lat=LAT&lon=LON )

    • param=LOGIN
    • lat=LAT
    • lon=LON
    Other

    backups_device_list - List of devices what support creating backups

    cli_list - Show CLI command alailable on this device

    • ip = IP (required)

    get_custom_fields - list of all custom fields

    get_custom_fields_ref - relation list of all custom fields

    find_mac - where MAC was found

    • param = MAC (required)
    • deleted =0, 1

    find_onu_by_user_mac - on which ONU MAC was found

    • param = MAC (required)

    fdb_device_list - List of devices what support getting FDB

    get_mac_vendor - Get information about vendor by MAC

    • param=MAC (required)

    sfp_device_list - List of devices what support SFP


    Category (cat) - device

    Device backup

    do_backup - get device backup

    • ip = IP (required)

    get_device_list_for_do_backup - get device list for backup

    • ip = IP (required)

    get_remote_backup_file_list - get list of remote backup

    • ip = IP (required)
    Main device

    get_snmp_uptime - Get device uptime

    • ip = IP (required)

    get_snmp_hostname - Get device hostname

    • ip = IP (required)

    get_snmp_description - Get device description

    • ip = IP (required)

    check_available  - Get device availability

    • ip = IP (required)

    check_ip - check device info

    • ip = IP (required)

    device_versions - get device version

    • ip = IP (required)

    get_device_sys_info - get device setem info

    • ip = IP (required)

    get_device_port_status_only  - get device ports statuses

    • ip = IP (required)

    get_device_load - get device CPU, RAM and other

    • ip = IP (required)

    get_sfp_power - get SFP power

    • ip = IP (required)

    get_fdb - get FDB table 

    • ip = IP (required)
    • save = 1, 0

    get_arp_table - get ARP table

    • ip = IP (required)

    get_route_table - get Routing table

    • ip = IP (required)

    get_lldp - get LLDP

    • ip = IP (required)

    get_ip_address_table - get IP Address table

    • ip = IP (required)

     get_vlans - get VLAN list

    • ip = IP (required)

    get_vlans_list_to_db - get VLAN list & save to DB

    • ip = IP (required)

    get_iferror - get errors on port

    • ip = IP (required)
    • save = 1, 0

    check_device_in_db - check if device exist in db

    • ip = IP (required)
    • hostname = HOSTNAME (required)
    • enterprise = ENTERPRISE (required)

    get_olt_cards_list - getting OLT cards from datebase

    • ip = IP (required)
    Ports

    get_port_list - get device ports list

    • ip = IP (required)

    get_all_device_ports_states - get device all info port status

    • ip = IP (required)

    get_port_status - Get port info

    • ip= IP (required)
    • port = PORT_NAME (required)

    get_ports - get ports info

    • ip = IP (required)
    • param = PORT_INDEX 
    • sub_param1 = 1, 0 (full or short info)

    get_pon_ports - get PON ports info

    • ip = IP (required)
    • param = PORT_INDEX 
    • sub_param1 = 1, 0 (full or short info)

    get_ports_short  - get ports info short

    • ip = IP (required)
    • param = PORT_INDEX (required)

    get_pon_ports_short - get PON ports info short

    • ip = IP (required)
    • param = PORT_INDEX (required)
    PON/ONU

    get_zte_olt_cards - get information about OLTs card on ZTE, HUAWEI, NOKIA OLTs

    olt_list - get list of OLTs

    • ip = IP (required)
    • param = PORT_NAME

    onu_list_on_olt - List of ONUs on OLT (+ save to DB)

    get_onus_state_on_interface - get states of ONUs on interface(s)

    • ip = IP (required)
    • param = PORT_NAME

    get_onu_monitoring - Check ONU online

    • param = ONU_NAME (required)

    get_onu_info - Get ONU info from OLT

    • param = ONU_NAME (required)

    get_onu_info_by_id - Get ONU info from DB

    • param = ONU_ID (required)

    remove_onu_by_id- Romove ONU in DB

    • param = ONU_ID (required)

    get_onu_info_offline - Get latest ONU info from database

    • param = ONU_NAME (required)

    get_onu_info_history- Get latest ONU info from database

    • param = ONU_NAME (required)

    get_onu_speed - get ONU current counters data

    • param = ONU_NAME
    • sub_param1 = 1, 0 (show traffic)
    • id = ONU_ID

    reg_onu - ONU registration

    • template_id = template for ONU registration (required)
    • onu_id =  ONU ID from unregistered (required)
    • onu_number
    • onu_type, c_vlan, s_vlan, vlan, ip, onu_description, onu_profile_line, onu_profile_service, onu_profile_line_id, onu_profile_service_id, onu_profile_speed_down, onu_profile_speed_up, switchport, customselect1, customselect2, custominput1, custominput2, service_port, PPPoeE_password, PPPoE_username, search_field_data
    • view_only = 1 - only preview config (0 or empty - regisering ONU)
    • update_onus_list_after_update = 1 - update ONU list in Grusher DB after ONU registration
    • run_script - allow to run script after ONU reg (script must be in /custom/run_after_onu_reg/my_script.php)

    Category (cat) - inventory

    (available from build_337)

    categories_get - get categories list

    category_create - creating category

    • title = new title (required)

    category_update  - update category title

    • id = category ID (required)
    • title = new title (required)

    category_delete - deleting category

    • id = category ID (required)

    catalogs_get - get all catalogs

    catalog_get - get catalog

    • id = catalog ID (required)

    catalog_create - creating catalog

    • title = new title (required)
    • cat_list_id = category ID (required)
    • parent_id = parent catalog ID
    • unit = like metr, un an so on
    • device_power = if this is active device
    • required_sn - if need Serial Number (0 or 1)
    • required_mac- if need MAC (0 or 1)

    catalog_update - update catalog detail

    • id = catalog ID (required)
    • title = new title
    • cat_list_id = category ID
    • parent_id = parent catalog ID
    • unit = like metr, un an so on
    • device_power = if this is active device
    • required_sn - if need Serial Number (0 or 1)
    • required_mac- if need MAC (0 or 1)

    catalog_delete - delete catalog

    • id = catalog ID (required)

    storages_get - get storages list

    storage_get -  get storage

    • id = storage ID (required)

    storage_create - creating new storage

    • title
    • description
    • is_main

    storage_update - update existed storage

    • id = storage ID (required)
    • title
    • description
    • is_main

    storage_delete - delete existed storage

    • id = storage ID (required)

    suppliers_get - get all suppliers 

    supplier_get - get supplier

    • id = supplier ID (required)

    supplier_create - creating new supplier

    • title
    • description
    • address
    • email
    • web
    • phone
    • iban
    • code_company
    • code_individual
    • chief

    supplier_update - updating supplier

    • id = supplier ID (required)
    • other param as in supplier_create

    supplier_delete - deletind supplier

    • id = supplier ID (required)

    history_get_short - get history of item moving

    • item_id = Item ID (required)

    history_get_full - get history of item moving + catalog & item info

    • item_id = Item ID (required)

    items_get - get all items (no recomended)

    item_get - get item info

    • id = item ID (required)

    item_create - creating new item

    • getted_at = when item was getted (required), date format is 2025-12-20
    • document_at = when document was getted (required), date format is 2025-12-20
    • price = item price (required)
    • count = item count (required)
    • catalog_id = catalog ID (required)
    • supplier_id = supplier ID (required)
    • location_id = location ID (required) (storage, supplier, user, task ID)
    • inv = inventory number
    • sn = serial number
    • mac = MAC Address
    • ip = IP Address
    • hostname = device hostname
    • barcode
    • document - document number, data or title or other
    • description

    item_update - updating item

    • id = item ID (required)
    • getted_at = when item was getted, date format is 2025-12-20
    • document_at = when document was getted, date format is 2025-12-20
    • inv = inventory number
    • sn = serial number
    • mac = MAC Address
    • ip = IP Address
    • hostname = device hostname
    • barcode
    • document - document number, data or title or other
    • description

    item_move - move item to 

    • id = item ID (required)
    • to_location_id (required)
    • to_location_type (required). Available moving to supplier, storage, user, customer, node, cable, device, building, task, onu, removed, saving
    • move = to move only one item just set "one_tmc" 



    Category (cat) - reports

    main_report - generate daily report

    sfp_report - generate SFP problem report


    Category (cat) - run

    This is command for run work with devices

    run_device_monitoring - Start devices monitoring pollers

    run_port_monitoring - Start ports monitoring pollers

    run_onu_monitoring - Start ONU monitoring pollers

    run_device_discovery - Start device discovering pollers

    run_sfp_power_discovery - Start SFP discovering pollers

    run_onu_discovery - Start ONU discovering pollers

    run_fdb_discovery - Start FDB pollers

    run_device_backups - Start devices backup pollers

    run_onu_signals_discovery - Start device monitoring pollers

    • param = 'critical'

    Category (cat) - system

    ping - PING

    • ip = IP (required)

    nmap - NMAP

    • ip = IP (required)

    traceroute - Traceroute

    • ip = IP (required)

    get_log_type - Get types of logs

    delete_expiration_days - Clean database from old data

    get_notify_list_last  - Get list of notify on last 3 hour

    get_notify_to_do - Get list of unsended messages

    send_notify - Send message from list

    • id = NOTIFY_ID (required)

    Category (tasks) - tasks information

    (available from build_338)

    comments_get - Get task comments by id

    • id = TASK_ID (required)

    groups_get - Get task groups list

    group_get - Get task group by id

    • id = GROUP_ID (required)

    history_get - Get task history by id

    • id = TASK_ID (required)

    statuses_get - Get statuses list

    task_custom_field - add or edit task custom field

    • task_id  (required)
    • custom_field_id  (required)
    • value  (required)

    task_comment_add - add comment to task (better use POST method)

    • id = TASK_ID (required)
    • comment= comment text (required)
    • user_id= USER_ID (required)

    task_get - Get task by id

    • id = TASK_ID (required)

    tasks_get - search tasks by param (returned TASK_ID)

    • id = TASK_ID. For multiple use comma as separator
    • created_by_id = User id what create task. For multiple use comma as separator
    • task_state_changed_by_id =User id what change task state. For multiple use comma as separator
    • closed_by_id = User id what close task. For multiple use comma as separator
    • building_id = For multiple use comma as separator
    • customer_id = For multiple use comma as separator
    • node_id = For multiple use comma as separator
    • type = TASK_TYPE_ID. For multiple use comma as separator
    • group = TASK_GROUP_ID. For multiple use comma as separator
    • status = TASK_STATUS_ID. For multiple use comma as separator
    • user = PERFORMERS_USER_ID. For multiple use comma as separator
    • user_group = PERFORMERS_USER_GROUP_ID. For multiple use comma as separator
    • planned_at_from = date planned from (like 2025-01-01)
    • planned_at_to = date planned to (like 2025-01-01)
    • do_before_at_from = date of task work from (like 2025-01-01)
    • do_before_at_to = date of task work to (like 2025-01-01)

    task_status_change - changing task status

    • id = TASK_ID (required)
    • state_id= TASK_STATE_ID (required)
    • user_id= USER_ID (required)

    types_get - Get task types list

    type_get - Get task type by id

    • id = TYPE_ID (required)

    task_add - Adding new task

    • type_id= TASK_TYPE_ID (required)
    • description= TASK TEXT (required)
    • priority = 0-3
    • planned_at = date of task work (like 2025-01-01)
    • do_before_at = date of task work must complete (like 2025-01-01)
    • time_to_work = set time to work (in hour >= 0)
    • task_price = set task price (>= 0)
    • user_id = USER_ID (required)
    • lat = GEO
    • lon = GEO
    • region_id, district_id, city_id, street_id = if need
    • building_id = set task to building address
    • customer_id = set task to customer
    • node_id= set task to node
    • apartment = set task to apartment
    • parent_task_id = set parent task 

    task_add_workers - assign worker to task

    • task_id (required)
    • user_id (required)

    task_del_workers - deassign worker to task

    • task_id (required)
    • user_id (required)

    task_add_workers_group - assign worker group to task

    • task_id (required)
    • group_id (required)

    task_del_workers_group - deassign worker group to task

    • task_id (required)
    • group_id (required)


    Category (cat) - 3rdparty

    get_user_list_in_db - Get all users

    get_user_by_id - Get user by id

    • param = USER_ID (required)

    get_user_by_username  - Get user by login

    • param = USER_LOGIN (required)

    get_us_vols_nodes_list_from_us - Get and save commutation from Userside

    ips - Get list of generator and UPS

    notes - Get notes

    • id = NOTE_ID (optional)

    us_commutation - Get info from Grusher (UserSide inported)

    • param = US_NODE_TYPE 

    us_get_vehicle - Get GPS from Userside

    us_vols_list - Get fiber info from Grusher (UserSide imported)

    zabbix_find_freeport - Find free port from Zabbix

    • ip = IP (required)