### GET /websites/developer_fonestorm_reference Source: https://developer.fonestorm.com/reference/getportorders Retrieves a list of all port orders for the FracTEL account. ```APIDOC ## GET /websites/developer_fonestorm_reference ### Description Get a list of all portorders. This will return a listing of all the portorders belonging to the FracTEL account associated with the API token being used. ### Method GET ### Endpoint /websites/developer_fonestorm_reference ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **portorders** (array) - Array of [PortOrder](https://developer.fonestorm.com/reference/portorder-object) #### Response Example ```json { "portorders": [ { "id": "123e4567-e89b-12d3-a456-426614174000", "account_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef", "order_type": "new", "status": "active", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:30:00Z" } ] } ``` ``` -------------------------------- ### GET /websites/developer_fonestorm_reference Source: https://developer.fonestorm.com/reference/get-devices Retrieves a list of all devices belonging to the FracTEL account. ```APIDOC ## GET /websites/developer_fonestorm_reference ### Description Get a list of all devices. This will return a listing of all the devices belonging to the FracTEL account associated with the API token being used. ### Method GET ### Endpoint /websites/developer_fonestorm_reference ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **devices** (array) - Array of [Device](https://developer.fonestorm.com/reference/device-object) #### Response Example { "devices": [ { "id": "device_id_1", "name": "Device Name 1", "model": "Device Model 1" }, { "id": "device_id_2", "name": "Device Name 2", "model": "Device Model 2" } ] } ``` -------------------------------- ### GET /websites/developer_fonestorm_reference Source: https://developer.fonestorm.com/reference/getdigitqueries Retrieves a list of all digitqueries belonging to the FracTEL account. ```APIDOC ## GET /websites/developer_fonestorm_reference ### Description Get a list of all digitqueries. This will return a listing of all the digitqueries belonging to the FracTEL account associated with the API token being used. ### Method GET ### Endpoint /websites/developer_fonestorm_reference ### Parameters #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **DigitQueries** (array) - Array of [DigitQuery](https://developer.fonestorm.com/reference/digitquery-object) #### Response Example ```json { "DigitQueries": [ { "id": "dq_123", "name": "Example Query", "query": "(123) 456-7890", "createdAt": "2023-10-27T10:00:00Z", "updatedAt": "2023-10-27T10:00:00Z" } ] } ``` ``` -------------------------------- ### Get FoneNumber - Node.js Example Source: https://developer.fonestorm.com/reference/get-fonenumber Example of how to fetch FoneNumber details using Node.js. This snippet utilizes the 'node-fetch' library to make an HTTP GET request to the Fonestorm API. ```javascript const fetch = require('node-fetch'); const url = 'https://api.fonestorm.com/v2/fonenumbers/fonenumber'; fetch(url, { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### POST /websites/developer_fonestorm_reference Source: https://developer.fonestorm.com/reference/createuser Creates a new user with the provided details. The email address must be unique for each user. ```APIDOC ## POST /websites/developer_fonestorm_reference ### Description Adds a new User to an account. ### Method POST ### Endpoint /websites/developer_fonestorm_reference ### Parameters #### Request Body - **email** (string) - Required - Email address of a user. Email address should be unique. - **dashboard_role** (string) - Optional - User role in the account. Value can be None, Location, Organization, Agent or Master. - **dashboard_access** (string) - Optional - User access option. Value can be None, User, Manager, Administrator or Custom. - **first_name** (string) - Optional - User's first name. - **last_name** (string) - Optional - User's last name. - **title** (string) - Optional - Title or label given to a user. - **fractelfone** (string) - Optional - FracTELfone device assigned to a user. It accepts device id, "none" or "new" as the values. Use "none" to clear assigned fractelfone and use "new" to create a new FracTELfone. - **account_id** (string) - Required - Account code or Subaccount code a user belongs to. - **custom_access** (object) - Optional - Custom access options, required if the parameter "dashboard_access" is set to "Custom". - **subaccounts** (string) - Optional - Options: None, Read, Edit or Add. - **users** (string) - Optional - Options: None, Read, Edit, Add or Remove. - **business_objects** (string) - Optional - Options: None, Read, Edit, Add or Remove. - **fonenumbers** (string) - Optional - Options: None, Read, Edit, Add or Remove. - **billing** (string) - Optional - Options: None or Read. - **call_records** (string) - Optional - Options: None or Read. ### Request Example ```json { "email": "user@example.com", "dashboard_role": "Agent", "dashboard_access": "Custom", "first_name": "John", "last_name": "Doe", "title": "Support Agent", "fractelfone": "device_id_123", "account_id": "acc_abc123", "custom_access": { "subaccounts": "Read", "users": "Edit", "business_objects": "None", "fonenumbers": "Add", "billing": "Read", "call_records": "None" } } ``` ### Response #### Success Response (200) - **user** (object) - Contains details of the created user. See [User Object](https://developer.fonestorm.com/reference/user-object) for more information. #### Response Example ```json { "user": { "id": "usr_xyz789", "email": "user@example.com", "dashboard_role": "Agent", "dashboard_access": "Custom", "first_name": "John", "last_name": "Doe", "title": "Support Agent", "fractelfone": { "id": "device_id_123", "name": "Main Office Phone" }, "account_id": "acc_abc123", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### POST /websites/developer_fonestorm_reference Source: https://developer.fonestorm.com/reference/createsoundfile This endpoint allows for the creation of a new sound file resource. It accepts various parameters to define the sound file, including its label, source (file or URL), text-to-speech settings, and an optional expiration date. ```APIDOC ## POST /websites/developer_fonestorm_reference ### Description Creates a new sound file resource with specified properties. ### Method POST ### Endpoint /websites/developer_fonestorm_reference ### Parameters #### Request Body - **label** (string) - Required - Name/Label for SoundFile - **file** (string) - Optional - SoundFile or URL - **tts** (string) - Optional - Text to speech string - **tts_volume** (string) - Optional - Text to speech volume - **expires_at** (string) - Optional - Expiration date ### Request Example ```json { "label": "My Sound File", "file": "http://example.com/sound.mp3", "tts": "Hello, world!", "tts_volume": "loud", "expires_at": "2024-12-31T23:59:59Z" } ``` ### Response #### Success Response (200) - **message** (string) - A success message. - **status_code** (integer) - The HTTP status code. #### Response Example ```json { "message": "Sound file created successfully.", "status_code": 201 } ``` #### Error Response - **error** (string) - An error message. - **message** (string) - A detailed error description. - **status_code** (integer) - The HTTP status code. #### Error Response Example ```json { "error": "Bad Request", "message": "Invalid input parameters.", "status_code": 400 } ``` ``` -------------------------------- ### Get FoneNumber - Ruby Example Source: https://developer.fonestorm.com/reference/get-fonenumber A Ruby example demonstrating how to fetch FoneNumber details from the Fonestorm API using the 'net/http' library. It makes a GET request and handles the JSON response. ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse('https://api.fonestorm.com/v2/fonenumbers/fonenumber') request = Net::HTTP::Get.new(uri) request['accept'] = 'application/json' response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end if response.code == '200' puts JSON.parse(response.body) else puts "Error: #{response.code}" end ``` -------------------------------- ### POST /websites/developer_fonestorm_reference/ivrmenu Source: https://developer.fonestorm.com/reference/createivrmenu Creates a new IVR Menu with specified configurations for options, timeouts, and sound files. ```APIDOC ## POST /websites/developer_fonestorm_reference/ivrmenu ### Description Add a new IVRMenu to an account. ### Method POST ### Endpoint /websites/developer_fonestorm_reference/ivrmenu ### Parameters #### Request Body - **label** (string) - Required - Name/Label for the IVRMenu. - **options** (object) - Required - An object with options 0 to 9 and * settings. Settings for all options: - **destination_type** (string) - Destination type for the option. - **destination** (string) - Destination ID for the option. - **digit_timeout** (integer) - Optional - Digit timeout in seconds. IVRMenu will wait for an input for seconds mentioned in here. After that IVRMenu will execute failover option. - **menu_repeat** (integer) - Optional - IVRMenu will repeat the number of time mentioned in this option. - **menu_timeout** (integer) - Optional - IVRMenu timeout in seconds. IVRMenu will timeout after seconds mentioned here. After that IVRMenu will execute failover option. - **menu_timeout_options** (object) - Optional - An object with the following options: - **destination_type** (string) - Destination type for the option. - **destination** (string) - Destination ID for the option. - **enable_speed_dials** (boolean) - Optional - Enable speed dials or not. If this option is enabled, IVRMenu will accept speed dials as an input. - **soundfile** (string) - Optional - SoundFile ID or Text to speech. SoundFile or text to be played in the IVRMenu. ### Request Example ```json { "label": "Main Menu", "options": { "0": { "destination_type": "phone", "destination": "1234567890" }, "*": { "destination_type": "menu", "destination": "fallback_menu_id" } }, "digit_timeout": 5, "menu_repeat": 2, "menu_timeout": 10, "menu_timeout_options": { "destination_type": "phone", "destination": "0987654321" }, "enable_speed_dials": true, "soundfile": "ivr_welcome_message" } ``` ### Response #### Success Response (200) - **IVRMenu** (object) - [IVRMenu](https://developer.fonestorm.com/reference/ivrmenu-object) object representing the created IVR Menu. #### Response Example ```json { "IVRMenu": { "id": "ivrmenu_abc123", "label": "Main Menu", "options": { "0": { "destination_type": "phone", "destination": "1234567890" }, "*": { "destination_type": "menu", "destination": "fallback_menu_id" } }, "digit_timeout": 5, "menu_repeat": 2, "menu_timeout": 10, "menu_timeout_options": { "destination_type": "phone", "destination": "0987654321" }, "enable_speed_dials": true, "soundfile": "ivr_welcome_message" } } ``` ``` -------------------------------- ### Get FoneNumber - Python Example Source: https://developer.fonestorm.com/reference/get-fonenumber This Python script shows how to retrieve FoneNumber information using the 'requests' library. It sends a GET request to the Fonestorm API and prints the JSON response. ```python import requests url = "https://api.fonestorm.com/v2/fonenumbers/fonenumber" headers = { "accept": "application/json" } response = requests.get(url, headers=headers) if response.status_code == 200: print(response.json()) else: print(f"Error: {response.status_code}") ``` -------------------------------- ### Get IVRMenu Information (JavaScript) Source: https://developer.fonestorm.com/reference/getivrmenu Fetches IVRMenu data from the Fonestorm API using JavaScript's Fetch API. This example demonstrates making a GET request and handling the JSON response. ```javascript async function getIvrMenu(id) { try { const response = await fetch(`https://api.fonestorm.com/v2/ivrmenu/${id}`, { method: 'GET', headers: { 'accept': 'application/json' } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return await response.json(); } catch (error) { console.error('Error fetching IVRMenu:', error); throw error; } } // Example usage: // getIvrMenu('your_ivr_menu_id').then(data => console.log(data)).catch(err => console.error(err)); ``` -------------------------------- ### POST /websites/developer_fonestorm_reference/soundfile Source: https://developer.fonestorm.com/reference/createsoundfile Adds a new SoundFile to an account. You can provide either a file or text-to-speech content. ```APIDOC ## POST /websites/developer_fonestorm_reference/soundfile ### Description Adds a new SoundFile to an account. You can provide either a file or text-to-speech content. ### Method POST ### Endpoint /websites/developer_fonestorm_reference/soundfile ### Parameters #### Request Body - **label** (string) - Required - Name/Label for the SoundFile. - **file** (file or string) - Optional - Sound File or File URL. Required if `tts` is not provided. - **tts** (string) - Optional - Text to Speech string. Required if `file` is not provided. - **tts_volume** (number) - Optional - TTS volume. - **expires_at** (timestamp) - Optional - SoundFile expires at timestamp. SoundFile will be deleted after it. ### Request Example ```json { "label": "My Sound File", "file": "/path/to/your/sound.mp3" } ``` ### Response #### Success Response (200) - **SoundFile** (object) - An object representing the created SoundFile. #### Response Example ```json { "SoundFile": { "id": "sf_abc123", "label": "My Sound File", "url": "https://cdn.fonestorm.com/sounds/sf_abc123.mp3", "created_at": "2023-10-27T10:00:00Z", "expires_at": null } } ``` ``` -------------------------------- ### POST /websites/developer_fonestorm_reference/create_device Source: https://developer.fonestorm.com/reference/createdevice Adds a new device to an account. This endpoint allows for detailed configuration of the device's behavior, including call handling, recording, and directory settings. ```APIDOC ## POST /websites/developer_fonestorm_reference/create_device ### Description Adds a new device to an account. This endpoint allows for detailed configuration of the device's behavior, including call handling, recording, and directory settings. ### Method POST ### Endpoint /websites/developer_fonestorm_reference/create_device ### Parameters #### Request Body - **fonenumber** (string) - Required - Caller ID for the device, used when the device makes an outbound call. Must be a valid FoneNumber. - **name** (string) - Optional - Name/Label for the device. - **type** (string) - Required - Device type (e.g., FracTELfone, Trunk Device, Yealink phone, Grandstream phone). - **mac_address** (string) - Optional - MAC address required for physical phones. Not required for FracTELfone or Trunk Device. Ex: 1a:2b:3c:4d:5e or 1a2b3c4d5e. - **speed_dial** (string) - Optional - Set speed dial for the device. FoneStorm will assign a speed dial number if not provided. - **call_recording** (string) - Optional - Call recording setting for the device. Options: `default`, `yes`, `no`, `inbound`, `outbound`, `ondemand`. Defaults to account setting. - **e911location_id** (string) - Optional - The ID of the e911 location to set for the device. - **areacode** (string) - Optional - Default area code for outbound calls. - **timezone** (string) - Optional - Timezone to be used on physical phones. - **ring_simultaneously** (boolean) - Optional - Whether to ring simultaneously if a device is registered at multiple locations. - **host_type** (string) - Optional - Required for Trunk devices. Can be `static` or `dynamic`. - **host_ip** (string) - Optional - Required for Trunk devices. The IP address of the Trunk. - **host_port** (string) - Optional - Required for Trunk devices. The port of the Trunk. - **timeout_service** (object) - Optional - Service to execute if the device call times out. - **timeout_type** (string) - Optional - Type of timeout service (`None`, `Forward`, `Voicemail`, `Voice2Email`). - **timeout_id** (string) - Optional - Value of the timeout service. - **timeout_seconds** (integer) - Optional - Number of seconds after which the call will timeout. - **voice2email_greeting** (string) - Optional - Greeting message for `Voice2Email` timeout type. - **busy_service** (object) - Optional - Service to execute if the device is busy. - **busy_type** (string) - Optional - Type of busy service (`None`, `Forward`). - **busy_id** (string) - Optional - Value of the busy service. - **directory_settings** (object) - Optional - Directory settings for the device. - **first_name** (string) - Optional - First Name to be displayed in the Directory. - **last_name** (string) - Optional - Last Name to be displayed in the Directory. - **show** (boolean) - Optional - Flag to show or hide from the directory. - **speed_dial** (string) - Optional - Directory speed dial, if different from regular speed dial. - **forwardall_settings** (object) - Optional - Forward All calls settings for the device. - **phonenumber** (string) - Optional - Phone number to forward all calls to. - **start_time** (string) - Optional - Start time in HH:mm format. - **end_time** (string) - Optional - End time in HH:mm format. ### Request Example ```json { "fonenumber": "+15551234567", "name": "My Office Phone", "type": "Yealink T46S", "mac_address": "1A:2B:3C:4D:5E:6F", "call_recording": "yes", "e911location_id": "loc_12345", "timeout_service": { "timeout_type": "Forward", "timeout_id": "+15559876543", "timeout_seconds": 30 }, "directory_settings": { "first_name": "John", "last_name": "Doe", "show": true } } ``` ### Response #### Success Response (200) - **device** (object) - The created device object. #### Response Example ```json { "device": { "id": "dev_abcdef123456", "fonenumber": "+15551234567", "name": "My Office Phone", "type": "Yealink T46S", "mac_address": "1A:2B:3C:4D:5E:6F", "call_recording": "yes", "e911location_id": "loc_12345", "timeout_service": { "timeout_type": "Forward", "timeout_id": "+15559876543", "timeout_seconds": 30 }, "directory_settings": { "first_name": "John", "last_name": "Doe", "show": true }, "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### Get FoneNumber - JavaScript Example Source: https://developer.fonestorm.com/reference/get-fonenumber This JavaScript snippet illustrates how to use the Fetch API to get FoneNumber information from the Fonestorm API. It handles the asynchronous nature of the request and parses the JSON response. ```javascript fetch('https://api.fonestorm.com/v2/fonenumbers/fonenumber', { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.error('Error fetching FoneNumber:', error); }); ``` -------------------------------- ### Get Subaccount Information (Node.js) Source: https://developer.fonestorm.com/reference/getsubaccount Provides a Node.js example for fetching subaccount information from the Fonestorm API. This snippet utilizes the 'node-fetch' library to make the HTTP GET request and handle the JSON response. ```javascript const fetch = require('node-fetch'); const url = "https://api.fonestorm.com/v2/subaccounts/{id}"; fetch(url, { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### POST /websites/developer_fonestorm_reference/scheduler Source: https://developer.fonestorm.com/reference/createscheduler Creates a new scheduler with specified configurations for business hours, holiday hours, and override modes. ```APIDOC ## POST /websites/developer_fonestorm_reference/scheduler ### Description Adds a new Scheduler to an account. ### Method POST ### Endpoint /websites/developer_fonestorm_reference/scheduler ### Parameters #### Request Body - **label** (string) - Required - Name/Label for the scheduler. - **timezone** (string) - Optional - A valid timezone string. Default timezone is EST5EDT. - **business_hours** (object) - Optional - An object with business hours options. - **business_hours_service_type** (string) - Required - Routes call to a particular service type during business hours. Valid service types are Phonenumber, SpeedDial, Scheduler, Conference, Device, Scheduler, IVRMenu, TimeOfDayRoute, VoiceMail, Hangup, Busy, Reject, WebHook or WebRequest. - **business_hours_service_id** (string) - Required - Service type id for the business hours service type. - **after_hours_service_type** (string) - Optional - Routes call to a particular service type during after hours. Valid service types are Phonenumber, SpeedDial, Scheduler, Conference, Device, Scheduler, IVRMenu, TimeOfDayRoute, VoiceMail, Hangup, Busy, Reject, WebHook or WebRequest. - **after_hours_service_id** (string) - Optional - Service type id for the after hours service type. - **lunch_hours_service_type** (string) - Optional - Routes call to a particular service type during lunch hours. Valid service types are Phonenumber, SpeedDial, Scheduler, Conference, Device, Scheduler, IVRMenu, TimeOfDayRoute, VoiceMail, Hangup, Busy, Reject, WebHook or WebRequest. - **lunch_hours_service_id** (string) - Optional - Service type id for the lunch hours service type. - **monday** (object) - Optional - Business open and close time for Monday. Lunch start and end times are optional. - **tuesday** (object) - Optional - Business open and close time for Tuesday. Lunch start and end times are optional. - **wednesday** (object) - Optional - Business open and close time for Wednesday. Lunch start and end times are optional. - **thursday** (object) - Optional - Business open and close time for Thursday. Lunch start and end times are optional. - **friday** (object) - Optional - Business open and close time for Friday. Lunch start and end times are optional. - **saturday** (object) - Optional - Business open and close time for Saturday. Lunch start and end times are optional. - **sunday** (object) - Optional - Business open and close time for Sunday. Lunch start and end times are optional. - **holiday_hours** (object) - Optional - Holiday hours configuration. - **holiday_hours_service_type** (string) - Required - Routes call to a particular service type during holiday hours. Valid service types are Phonenumber, SpeedDial, Scheduler, Conference, Device, Scheduler, IVRMenu, TimeOfDayRoute, VoiceMail, Hangup, Busy, Reject, WebHook or WebRequest. - **holiday_hours_service_id** (string) - Required - Service type id for the holiday hours service type. - **holidays** (array) - Required - Array of holiday objects. - **holiday_name** (string) - Required - Name/Label for the holiday. - **holiday_type** (string) - Required - A public holiday or a custom holiday. Custom holiday will require start and end time. - **custom_holiday_start** (string) - Optional - Custom holiday start time in MM-DD HH:mm format. - **custom_holiday_end** (string) - Optional - Custom holiday end time in MM-DD HH:mm format. - **override_mode** (string) - Optional - Override mode option. Available modes are Scheduler, OfficeHours, AfterHours, Lunch and Holiday. - **override_extension** (string) - Optional - 1 to 6 digit extension to change override mode. ### Request Example ```json { "label": "My Scheduler", "timezone": "America/New_York", "business_hours": { "business_hours_service_type": "Phonenumber", "business_hours_service_id": "12345", "after_hours_service_type": "Voicemail", "after_hours_service_id": "67890", "monday": { "open_time": "09:00", "close_time": "17:00" } }, "holiday_hours": { "holiday_hours_service_type": "IVRMenu", "holiday_hours_service_id": "11223", "holidays": [ { "holiday_name": "New Year's Day", "holiday_type": "public" }, { "holiday_name": "Company Picnic", "holiday_type": "custom", "custom_holiday_start": "07-15 10:00", "custom_holiday_end": "07-15 14:00" } ] }, "override_mode": "OfficeHours", "override_extension": "123" } ``` ### Response #### Success Response (200) - **scheduler** (object) - The created scheduler object. See [Scheduler Object](https://developer.fonestorm.com/reference/scheduler-object) for details. #### Response Example ```json { "scheduler": { "id": "sch_abc123", "label": "My Scheduler", "timezone": "America/New_York", "business_hours": { "business_hours_service_type": "Phonenumber", "business_hours_service_id": "12345", "after_hours_service_type": "Voicemail", "after_hours_service_id": "67890", "monday": { "open_time": "09:00", "close_time": "17:00" } }, "holiday_hours": { "holiday_hours_service_type": "IVRMenu", "holiday_hours_service_id": "11223", "holidays": [ { "holiday_name": "New Year's Day", "holiday_type": "public" }, { "holiday_name": "Company Picnic", "holiday_type": "custom", "custom_holiday_start": "07-15 10:00", "custom_holiday_end": "07-15 14:00" } ] }, "override_mode": "OfficeHours", "override_extension": "123" } } ``` ``` -------------------------------- ### Get Subaccount Information (Ruby) Source: https://developer.fonestorm.com/reference/getsubaccount Shows a Ruby implementation for fetching subaccount data via the Fonestorm API. This example uses the built-in 'net/http' library to perform the GET request and parse the JSON response. ```ruby require 'net/http' require 'uri' require 'json' uri = URI.parse("https://api.fonestorm.com/v2/subaccounts/{id}") request = Net::HTTP::Get.new(uri) request["accept"] = "application/json" response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http| http.request(request) end if response.code == '200' puts JSON.parse(response.body) else puts "Error: #{response.code}" end ``` -------------------------------- ### POST /websites/developer_fonestorm_reference Source: https://developer.fonestorm.com/reference/createsubaccount This endpoint is used to create a new subaccount. It requires a label and can optionally include an IP address and detailed service address information. ```APIDOC ## POST /websites/developer_fonestorm_reference ### Description Creates a new subaccount with the provided details. Requires a label and can optionally include IP address and service address information. ### Method POST ### Endpoint /websites/developer_fonestorm_reference ### Parameters #### Request Body - **label** (string) - Required - Name/Label for subaccount - **ip_address** (string) - Optional - IP address if the subaccount is not a PBX account - **service_address** (object) - Optional - Service Address - **company_name** (string) - Optional - Company Name - **first_name** (string) - Optional - First Name - **last_name** (string) - Optional - Last Name - **email** (string) - Optional - Email Address - **phone** (string) - Optional - Phone number - **address_line1** (string) - Optional - Address Line 1 - **address_line2** (string) - Optional - Address Line 2 - **city** (string) - Optional - City - **state** (string) - Optional - State - **zipcode** (string) - Optional - Zipcode ### Request Example ```json { "label": "New Subaccount", "ip_address": "192.168.1.100", "service_address": { "company_name": "Example Corp", "first_name": "John", "last_name": "Doe", "email": "john.doe@example.com", "phone": "123-456-7890", "address_line1": "123 Main St", "address_line2": "Apt 4B", "city": "Anytown", "state": "CA", "zipcode": "90210" } } ``` ### Response #### Success Response (200) - **status_code** (integer) - Response status code. - **error** (string) - Response error label. - **message** (string) - Response error message. #### Response Example ```json { "status_code": 200, "error": "OK", "message": "Subaccount created successfully." } ``` #### Error Responses - **400 Bad Request**: Missing required parameters or invalid input. - **status_code** (integer) - Response status code. - **error** (string) - Response error label. - **message** (string) - Response error message. Example: `{"status_code": 400, "error": "Bad Request", "message": "Parameter missing"}` - **401 Unauthorized**: Invalid or expired token. - **status_code** (integer) - Response status code. - **error** (string) - Response error label. - **message** (string) - Response error message. Example: `{"status_code": 401, "error": "Unauthorized", "message": "Invalid or expired token."}` - **default Error**: Generic error response. - **error** (string) - Error type. - **message** (string) - Error details. - **status_code** (integer) - HTTP status code. ``` -------------------------------- ### Get Subaccount Information (cURL) Source: https://developer.fonestorm.com/reference/getsubaccount Demonstrates how to make a GET request to the Fonestorm API to retrieve subaccount details using cURL. This example shows the basic structure of the request, including the URL and the 'accept' header. ```shell curl --request GET \ --url https://api.fonestorm.com/v2/subaccounts/id \ --header 'accept: application/json' ``` -------------------------------- ### Get IVRMenu Information (Ruby) Source: https://developer.fonestorm.com/reference/getivrmenu Retrieves IVRMenu details using the Fonestorm API in Ruby. This example utilizes the 'httparty' gem for making HTTP requests and handles potential errors. ```ruby require 'httparty' def get_ivr_menu(id) response = HTTParty.get("https://api.fonestorm.com/v2/ivrmenu/#{id}", headers: { 'accept' => 'application/json' }) if response.success? return response.parsed_response else puts "Error fetching IVRMenu: #{response.code} - #{response.message}" return nil end end # Example usage: # ivr_menu_data = get_ivr_menu('your_ivr_menu_id') # puts ivr_menu_data ``` -------------------------------- ### POST /websites/developer_fonestorm_reference Source: https://developer.fonestorm.com/reference/createpagegroup This endpoint is used to create a new page group. It requires a label and a list of device IDs. Optional parameters include soundfile, max_page_time, and tone_length. ```APIDOC ## POST /websites/developer_fonestorm_reference ### Description Creates a new page group with the specified label and devices. You can also optionally provide a soundfile, maximum page time, and tone length. ### Method POST ### Endpoint /websites/developer_fonestorm_reference ### Parameters #### Request Body - **label** (string) - Required - Name/Label for PageGroup - **devices** (array) - Required - Array of Device IDs - **items** (string) - Device IDs - **soundfile** (string) - Optional - SoundFile ID - **max_page_time** (integer) - Optional - Max page time in seconds - **tone_length** (integer) - Optional - Tone length in seconds ### Request Example ```json { "label": "My Page Group", "devices": [ "device123", "device456" ], "soundfile": "soundfile789", "max_page_time": 60, "tone_length": 5 } ``` ### Response #### Success Response (200) - **message** (string) - Description of the success message #### Response Example ```json { "message": "Page group created successfully." } ``` #### Error Response - **error** (string) - Type of error - **message** (string) - Description of the error - **status_code** (integer) - HTTP status code ``` -------------------------------- ### Get Subaccount Information (JavaScript) Source: https://developer.fonestorm.com/reference/getsubaccount A JavaScript example demonstrating how to fetch subaccount information using the browser's built-in 'fetch' API. This snippet is suitable for frontend applications and handles the asynchronous nature of the request. ```javascript const url = "https://api.fonestorm.com/v2/subaccounts/{id}"; fetch(url, { method: 'GET', headers: { 'accept': 'application/json' } }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.error('Error fetching subaccount:', error); }); ``` -------------------------------- ### Get Reserved FoneNumbers (JSON Response Example) Source: https://developer.fonestorm.com/reference/getreservedfonenumbers This snippet illustrates the expected JSON output when requesting reserved FoneNumbers. It includes details like the phone number, state, rate center, order string, and expiration time for each reserved number. ```json { "fonenumbers": [ { "fonenumber": "3214991000", "state": "FL", "rate_center": "ORLANDO", "order_string": "FL,ORLANDO,3214991000,B,0,yes,yes,yes", "expires_at": "2020-04-15 13:32:53" }, { "fonenumber": "8553028409", "state": "US", "rate_center": "TOLLFREE", "order_string": "US,TOLLFREE,8553028409,T,0,yes,yes,yes", "expires_at": "2020-04-15 13:32:53" }, ... ] } ``` -------------------------------- ### Device Configuration Source: https://developer.fonestorm.com/reference/updatedevice This section details the structure for configuring various device settings. It includes callback configurations, email settings, trunk device specifics, timeout services, busy services, and directory settings. ```APIDOC ## Device Configuration Object ### Description This object defines the configuration parameters for a device, including callback and email settings, trunk device details, and various service configurations. ### Method (Not applicable, this describes a data structure) ### Endpoint (Not applicable, this describes a data structure) ### Parameters #### Request Body Fields - **callback_settings** (object) - Optional - Settings for callback notifications. - **type** (string) - Optional - Type of callback notification. Enum: [`Callback`, `Email`]. - **email** (string) - Required if type is `Email` - Email address for notifications. - **method** (string) - Required if type is `Callback` - HTTP method for callback. Enum: [`GET`, `POST`, `JSON`]. - **url** (string) - Required if type is `Callback` - URL for callback notifications. - **url_username** (string) - Optional - Username for HTTP Basic authentication. - **url_password** (string) - Optional - Password for HTTP Basic authentication. - **host_type** (string) - Required if Device type is Trunk Device - Host type for Trunk Device. Enum: [`static`, `dynamic`]. - **host_ip** (string) - Required if Host type is static - Host IP for Trunk Device. - **host_port** (number) - Required if Host type is static - Host Port for Trunk Device. - **timeout_service** (object) - Optional - Timeout service configuration for a Device. - **timeout_type** (string) - Optional - Timeout service type. Enum: [`None`, `Forward`, `Voicemail`, `Voice2Email`]. - **timeout_id** (string) - Optional - Timeout service ID. - **timeout_seconds** (string) - Optional - Timeout duration in seconds. - **voice2email_greeting** (string) - Optional - Greeting message for Voice2Email service. - **busy_service** (object) - Optional - Busy service configuration for a Device. - **busy_type** (string) - Optional - Busy service type. Enum: [`None`, `Forward`]. - **busy_id** (string) - Optional - Busy service ID. - **directory_settings** (object) - Optional - Directory settings for a Device. - **first_name** (string) - Optional - Directory First Name. - **last_name** (string) - Optional - Directory Last Name. - **show** (boolean) - Optional - Whether to show the device in the directory. - **speed_dial** (string) - Optional - Speed dial number for the directory entry. - **forwardall_settings** (object) - Optional - ForwardAll settings for a Device. - **phonenumber** (string) - Optional - The phone number to forward all calls to. ### Request Example ```json { "callback_settings": { "type": "Callback", "method": "POST", "url": "https://example.com/callback" }, "host_type": "static", "host_ip": "192.168.1.100", "host_port": 5060, "timeout_service": { "timeout_type": "Forward", "timeout_id": "sip:101@example.com" }, "busy_service": { "busy_type": "Forward", "busy_id": "sip:102@example.com" }, "directory_settings": { "first_name": "John", "last_name": "Doe", "show": true, "speed_dial": "123" }, "forwardall_settings": { "phonenumber": "+15551234567" } } ``` ### Response #### Success Response (200) (Response structure would typically mirror the request structure or confirm successful update) #### Response Example ```json { "status": "success", "message": "Device configuration updated successfully." } ``` ``` -------------------------------- ### POST /devices Source: https://developer.fonestorm.com/reference/createdevice Adds a new Device to an account. Requires authentication. ```APIDOC ## POST /devices ### Description Add a new Device to an account. ### Method POST ### Endpoint /devices ### Parameters #### Query Parameters - **type** (string) - Required - The type of device to create. #### Request Body - **fonenumber** (string) - Optional - The phone number associated with the device. - **name** (string) - Optional - A human-readable label for the device. ### Request Example ```json { "type": "mobile", "fonenumber": "+15551234567", "name": "My Mobile Device" } ``` ### Response #### Success Response (201) - **device** (object) - Contains details of the created device. - **username** (string) - Unique identifier of the device (12 digit number). - **name** (string) - Human-readable label used for the device. #### Response Example ```json { "device": { "username": "123456123456", "name": "My Mobile Device" } } ``` #### Error Response (400) - **status_code** (integer) - Response status code. - **error** (string) - Response error label. - **message** (string) - Response error message. #### Error Response (401) - **status_code** (integer) - Response status code. - **error** (string) - Response error label. - **message** (string) - Response error message. #### Error Response (default) - **error** (string) - Error description. - **message** (string) - Error message. - **status_code** (integer) - HTTP status code. ```