With Megacall's API, you can integrate and manage virtual numbers directly from your administrative interface, eliminating the need to access the Megacall personal account.
User identification and document submission are often prerequisites for connecting numbers, and these processes can be facilitated through the API.
API Features:
Selection and connection of virtual numbers
Configuration of connected numbers
Handling documents required for number connection (providing information on connection requirements, uploading, and verifying previously submitted documents for a specific number connection)
Steps to connect a number via API:
Obtain an up-to-date list of countries and destinations available for connection and display them to the user.
Retrieve and display a list of numbers that are available for connection.
Create a user group for documents (if not already done) and upload the necessary documents (if required).
Connect the chosen number using the designated group of documents.
Route numbers to SIP login or SIP URI (set_sip_id).
New number connection
Connecting a new number through Megacall’s API involves several steps:
1. Obtain a List of Available Countries:
Use the following method to get a list of countries available for number connection:
Method: GET /v1/direct_numbers/countries/
Parameters: None (or optional language parameter for response language)
Response: List of available countries.
2. Get Destinations within a Country:
To receive a list of destinations within a country, use the following method:
Method: GET /v1/direct_numbers/country/
Parameters:
country: ISO country code (ISO 3166-1 alpha-2)
Optional: language, direction_id
Response: Array of data describing available numbers for connection within the specified country.
3. Receive a List of Available Numbers:
Use the following method to get a list of available numbers for connection:
Method: GET /v1/direct_numbers/available/<DIRECTION_ID>/
Parameters:
DIRECTION_ID: Destination ID or ru495
Optional: mask for searching number matches
Response: List of available numbers.
4. Connect a Number:
Connect the chosen number using the following method:
Method: POST /v1/direct_numbers/order/
Parameters: Required parameters include number.
Response: Confirmation of the number connection.
5. Extend a Previously Connected Number:
If needed, extend a previously connected number in advance:
Method: POST /v1/direct_numbers/prolong/
Parameters: Required parameters include number and months.
Response: Confirmation of the number extension.
These steps will guide you through the process of connecting and managing virtual numbers via Megacall’s API.
Interactions with connected numbers
When working with connected numbers in Megacall’s API, you can perform various actions related to managing and retrieving information about these numbers. Here are the relevant methods:
1. Get Information About Connected Numbers:
Method: GET /v1/direct_numbers/
Parameters: None
Response: Array of information about already connected numbers.
2. Get Information About a Certain Connected Number:
Method: GET /v1/direct_numbers/number/
Parameters: type, number (Type can be 'virtual' or 'sim', and number is the connected number)
Response: Information about the specified connected number.
3. Get Number Automatic Extending Status:
Method: GET /v1/direct_numbers/autoprolongation/
Parameters: type, number
Response: Automatic extending status of the specified number.
4. Change Automatic Extending Status:
Method: PUT /v1/direct_numbers/autoprolongation/
Parameters: type, number, value (Value can be 'on' or 'off')
Response: Confirmation of the change in automatic extending status.
5. Set or Enable Number Name (Caller ID):
Method: PUT /v1/direct_numbers/set_caller_name/
Parameters: type, number, caller_name
Response: Confirmation of setting or enabling the number name.
6. Route Calls from a Virtual Number:
Method: PUT /v1/direct_numbers/set_sip_id/
Parameters: type, number, sip_id, test_mode (optional, 'on' or 'off')
Response: Confirmation of routing calls or enabling test mode for the specified virtual number.
These methods enable you to retrieve information about connected numbers, manage automatic extending status, set caller names, and route calls from virtual numbers in Megacall’s system.
Interacting with documents
When working with documents in Megacall’s API for number connection, you can perform various actions related to document groups. Here are the relevant methods:
1. Create a New Group of Documents:
Method: POST /v1/documents/groups/create/
Parameters: None (Parameters for the new group, such as the group name, might be required in the request body)
Response: Confirmation of the new document group creation.
2. Update Information in an Existing Group of Documents:
Method: PUT /v1/documents/groups/update/<GROUPID>/
Parameters: GROUPID - ID of the document group to update (e.g., 1 for the main group)
Response: Confirmation of the document group update.
3. Upload Document File to a Group:
Method: POST /v1/documents/upload/
Parameters: Upload the document file via the request body, and specify the group_id if needed.
Response: Confirmation of the document file upload.
4. Receive a List of Document Groups:
Method: GET /v1/documents/groups/list/
Parameters: None
Response: List of document groups.
5. Receive Information About a Certain Group of Documents:
Method: GET /v1/documents/groups/get/<ID>/
Parameters: ID - Group identification (0 for the main group)
Response: Information about the specified group of documents.
6. Receive a List of Uploaded Files/Documents:
Method: GET /v1/documents/files
Parameters: group_id (optional) - ID of the group of documents (0 or not specified for the main group)
Response: List of previously uploaded files/documents.
7. Check if the Group of Documents is Suitable for Number Connection:
Method: GET /v1/documents/groups/valid/<ID>/
Parameters: ID - Group identification
Response: Confirmation of the group's suitability for number connection.
These methods enable you to manage document groups, upload files, and check the validity of document groups for the number requested in Megacall’s system.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article