Supported resources
FortiVoice REST API provides access to a limited number of resources:
Object URL |
Summary |
---|---|
/VoiceadminLogin |
Administrator login authentication to get the token for accessing a resource. See Resource: VoiceadminLogin. |
/DeviceSip_phone |
Retrieve authorized devices. See Resource: DeviceSip_phone. |
/SysStatusLicinfo |
License installation (for functions such as softclient, property management system (PMS), and call center). See Resource: SysStatusLicinfo |
Resource: VoiceadminLogin
Login:
curl -k -v -H "Content-Type: application/json" -X POST -d
'{"name":"admin","password":"11"}' https://host_or_ip/api/v1/VoiceadminLogin -c cookie.txt
Output:
{"objectID": "VoiceadminLogin:{D:system}","reqAction": 2,"nodePermission": 3,"name":
"admin","password": "11","new_password": "******","token": "******","vpbx": true,"role":
2,"license": 0,"is_superadmin": true,"webmode": 0,"locale": "en","loginstatus": 1,"model":
"FO4000","serial": "FO4000YYZRD00006","theme": 3,"debug": true,"product_name":
"FortiVoice","product_version": "6.4.306","disclaimer_enable": false,"scramble":
true,"disclaimer": "","gateway_status": false,"departments": "","userportal_status":
true,"operator_console_status": true,"lsg_status": true,"localsurvival_mode":
0,"business_group_status": true,"minimum_length": 8,"survivability_centralstatus":
true,"magic_number": "ce"}
APSCOOKIE=Era%3D1%26Payload%3DLRVEJ5uKHM%2F%2FYrpWe7n65ny
%2FlCNxt4Nh4nMvq2cv8B6InbsIdvBMKWHwBmjq5uIx
%0AwcK647Hii7g6C7CP3xXn1K5bQABlHsU415ATliu2230%2FGp1xV8Zj4mk
3H2gucWu0%0AmS nfM3vPoUNoZdYxWIw2Ug%3D%3D%0A%26AuthHash
%3DmE6QACwAJj7jQAQiMipUsw%3D%3D%0A;
Resource: DeviceSip_phone
Get all devices with 50 entries at a time:
curl -k -v -b cookie.txt ' https:// host_or_ip /api/v1/DeviceSip_phone ?
reqAction=1&mdomain=system&startIndex=0&pageSize=50&extraParam='
Output:
{"objectID": "DeviceSip_phoneCollection:{D:system}","reqAction": 1,"totalRemoteCount":
7,"subCount": 7,"remoteSorting": true,"nextPage": false,"nodePermission": 3,"collection": [
{"mkey": "b4:0e:dc:bd:f4:bd","phone_type": "FortiFone-550i\/560i","name":
"","multicell_device": "","description": "","unassigned": 1,"phone_profile": "Default-FortiFone-
550i\/560i","associated_display_name": "","associated_number": "","associated_id":
"","device_ip": "","phone_info": "","associated_role": 0,"softclient_license":
0,"registration_status": 0,"last_register": "","expiration": "","unregister_cause":
0,"failure_code": 0},
{"mkey": "00:15:65:83:cb:12","phone_type": "FortiFone-470i","name":
"","multicell_device": "","description": "","unassigned": 1,"phone_profile": "Default-FortiFone-
470i","associated_display_name": "","associated_number": "","associated_id": "","device_ip":
"","phone_info": "","associated_role": 0,"softclient_license": 0,"registration_status":
0,"last_register": "","expiration": "","unregister_cause": 0,"failure_code": 0},
{"mkey": "00:1a:7e:a7:e7:9e","phone_type": "FortiFone-550i\/560i","name":
"","multicell_device": "","description": "","unassigned": 1,"phone_profile": "Default-FortiFone-
550i\/560i","associated_display_name": "","associated_number": "","associated_id":
"","device_ip": "","phone_info": "","associated_role": 0,"softclient_license":
0,"registration_status": 0,"last_register": "","expiration": "","unregister_cause":
0,"failure_code": 0},
{"mkey": "b4:0e:dc:bd:f4:ff","phone_type": "FortiFone-550i\/560i","name":
"","multicell_device": "","description": "FakePhone","unassigned": 2,"phone_profile":
"Default-FortiFone-550i\/560i","associated_display_name": "","associated_number":
"","associated_id": "","device_ip": "","phone_info": "","associated_role": 0,"softclient_license":
0,"registration_status": 0,"last_register": "","expiration": "","unregister_cause":
0,"failure_code": 0},
{"mkey": "70:4c:a5:ce:bb:fc","phone_type": "FortiFone-175","name":
"","multicell_device": "","description": "","unassigned": 1,"phone_profile": "Default-FortiFone-
175","associated_display_name": "Kanata","associated_number": "6006","associated_id":
"6006","device_ip": "192.168.2.35","phone_info": "Fortinet FortiFone FON-175 2.4.0.5672
704ca5cebbfc","associated_role": 1,"softclient_license": 0,"registration_status":
1,"last_register": "2020-06-12 13:54:27","expiration": "2020-06-12
14:54:27","unregister_cause": 0,"failure_code": 0},
{"mkey": "e8:1c:ba:0f:86:7d","phone_type": "FortiFone-375","name":
"","multicell_device": "","description": "","unassigned": 1,"phone_profile": "Default-FortiFone-
375","associated_display_name": "","associated_number": "","associated_id": "","device_ip":
"","phone_info": "","associated_role": 0,"softclient_license": 0,"registration_status":
0,"last_register": "","expiration": "","unregister_cause": 0,"failure_code": 0},
{"mkey": "e8:1c:ba:0f:86:7b","phone_type": "FortiFone-375","name":
"e81cba0f867b","multicell_device": "","description": "","unassigned": 2,"phone_profile":
"Default-FortiFone-375","associated_display_name": "","associated_number":
"","associated_id": "","device_ip": "","phone_info": "","associated_role": 0,"softclient_license":
0,"registration_status": 0,"last_register": "","expiration": "","unregister_cause":
0,"failure_code": 0}
]
}
Get a devices with the 'ff' pattern in their MAC addresses:
curl -k -v -b cookie.txt ' https://host_or_ip/api/v1/DeviceSip_phone?
reqAction=1&mdomain=system&startIndex=0&pageSize=50&extraParam=quickSearch:ff'
Output:
{"objectID": "DeviceSip_phoneCollection:{D:system}","reqAction": 1,"totalRemoteCount":
1,"subCount": 1,"remoteSorting": true,"nextPage": false,"nodePermission": 3,"collection": [
{"mkey": "b4:0e:dc:bd:f4:ff","phone_type": "FortiFone-550i\/560i","name":
"","multicell_device": "","description": "FakePhone","unassigned": 2,"phone_profile":
"Default-FortiFone-550i\/560i","associated_display_name": "","associated_number":
"","associated_id": "","device_ip": "","phone_info": "","associated_role": 0,"softclient_license":
0,"registration_status": 0,"last_register": "","expiration": "","unregister_cause":
0,"failure_code": 0}
]
}
Get non-assigned devices:
curl -g -k -v -b cookie.txt 'https://host_or_ip/api/v1/DeviceSip_phone?
reqAction=1&mdomain=system&startIndex=0&pageSize=50&extraParam=&jsonPayload={"compoun
dSearch":[{"searchValues":[{"filter_content":1}],"filter_type":1,"is_negated":false}]}'
Output:
{"objectID": "DeviceSip_phoneCollection:{D:system}","reqAction": 1,"totalRemoteCount":
2,"subCount": 2,"remoteSorting": true,"nextPage": false,"nodePermission": 3,"collection": [
{"mkey": "b4:0e:dc:bd:f4:ff","phone_type": "FortiFone-550i\/560i","name":
"","multicell_device": "","description": "FakePhone","unassigned": 2,"phone_profile":
"Default-FortiFone-550i\/560i","associated_display_name": "","associated_number":
"","associated_id": "","device_ip": "","phone_info": "","associated_role": 0,"softclient_license":
0,"registration_status": 0,"last_register": "","expiration": "","unregister_cause":
0,"failure_code": 0},
{"mkey": "e8:1c:ba:0f:86:7b","phone_type": "FortiFone-375","name":
"e81cba0f867b","multicell_device": "","description": "","unassigned": 2,"phone_profile":
"Default-FortiFone-375","associated_display_name": "","associated_number":
"","associated_id": "","device_ip": "","phone_info": "","associated_role": 0,"softclient_license":
0,"registration_status": 0,"last_register": "","expiration": "","unregister_cause":
0,"failure_code": 0}
]
}
Resource: SysStatusLicinfo
curl -k -b cookie.txt -H "Content-Type: application/json" -X POST -d '{"reqAction":22}'
https://host_or_ip/api/v1/SysStatusLicinfo
Output:
{"token":"d45885ac1c2532686bf3554b65a781a7M500"}