Method list
Before starting
1. Get countries
2. Get cities
3. Order DID
4. Build mapping for new DID
5. Change mapping for DID
6. Get region details
7. Get DID details
8. Order autorenew status
9. Renew DID
10. Cancel DID
11. Cancel Order
Error codes:
* 100 Access denied
* 105 Order already exists
* 106 DID ID: DID_ID NOT found
* 107 Invalid Protocol
* 108 DID: DIDNUMBER NOT found
* 109 DID: DIDNUMBER in Pending/Remove status
* 110 DID: DIDNUMBER NOT renewed
* 111 Invalid status code. Valid codes: 0 - Disable, 1 - Enable
* 113 Order NOT found for DIDNUMBER
* 114 Order already canceled for DIDNUMBER
* 115 ORDER: Cannot cancel not pending order for DIDNUMBER. Please, use did_cancel
* 120 UNIQ: UNIQUEKEY NOT found
* 121 No cities for this country
* 150 Sandbox error. DIDs max limit reached
* 200 Internal Server Error
|
Before starting
a. ASP.NET 2.0
These examples using ASP.NET 2.0.
For ASP.NET, the SDK will soon be available in both languages: VB.NET and C#.
This is a beta document. If you have comments, find errors, or just have questions, please contact support@didww.com
b. Authentication Key
You will receive from DID World Wide the authentication key.
Below there are sample codes, how to build authentication string, to pass to methods:
1. This sample is used on reseller's production server for public.
Web Site WSDL URL: http://api.didww.com/api/?wsdl
| VB |
C# |
|
Dim auth_string As String = "username@domain.com" & "12345678909"
int auth_string = "username@domain.com" + "12345678909"
|
2. This sample is used on DID World Wide Sandbox for testing.
Please, note: We are adding word "sandbox" to authentication string
Web Site WSDL URL: http://sandbox.didww.com/api/?wsdl
| VB |
C# |
|
Dim auth_string = "username@domain.com" & "12345678909" & "sandbox"
int auth_string = "username@domain.com" + "12345678909" + "sandbox"
|
1. Get countries list
This method will return the list of countries from active coverage list.
|
Method Signature |
| VB |
C# |
|
Dim Countries as didww.api.Country() = dataAPI.getcountries(auth_string)
didww.api.Country() Countries = dataAPI.getcountries(auth_string)
|
string auth_string
|
Return array: Countries |
Country ID: 10
Prefix: 54
Name: Argentina
...
|
Code example |
| VB |
C# |
Dim dataAPI As didww.api.didwwapi = New didww.api.didwwapi()
dataAPI.Url = "http://sandbox.didww.com/api/"
Try
Dim Countries as didww.api.Country() = dataAPI.getcountries(auth_string)
Dim I As Integer
For I = 0 To Countries.Length - 1
If I > 0 Then Message1.InnerHtml &= "<BR>"
Message1.InnerHtml &= "Country ID: " & Countries(I).country_id
Message1.InnerHtml &= "<BR>Prefix: " & Countries(I).country_prefix
Message1.InnerHtml &= "<BR>Name: " & Countries(I).country_name & "<br>"
Next
Catch exception As Exception
Message1.InnerHtml = "ERROR: " + exception.Message
End Try
didww.api.didwwapi dataAPI = new didww.api.didwwapi();
dataAPI.Url = "http://sandbox.didww.com/api/";
try
{
didww.api.Country[] Countries = dataAPI.getcountries(auth_string);
for (int i = 0; i <= Countries.Length - 1; i++)
{
if (i > 0)
{
Message1.InnerHtml = "<BR>";
}
Message1.InnerHtml += "Country ID: " + Countries[i].country_id;
Message1.InnerHtml += "<BR>Prefix: " + Countries[i].country_prefix;
Message1.InnerHtml += "<BR>Name: " + Countries[i].country_name + "<br>";
}
}
catch (Exception exception)
{
Message1.InnerHtml = "ERROR: " + exception.Message;
}
|
|
Up
2. Get cities list
This method will return the list of available cities by country ID along with reseller's monthly price.
The country ID value is passed from method getcountries
You will need to assign requested 'Country ID' from array list Country to 'country_id' variable.
|
Method Signature |
| VB |
C# |
|
Dim Cities as didww.api.City() = dataAPI.getcities(auth_string, country_id)
didww.api.City[] Cities = dataAPI.getcities(auth_string, country_id);
|
string auth_string
integer country_id
|
Return array: Cities |
Unique key: 10541111
City Prefix: 11
City Name: Buenos Aires
Monthly Price: 4.5
...
|
Code example |
| VB |
C# |
Dim dataAPI As didww.api.didwwapi = New didww.api.didwwapi()
dataAPI.Url = "http://sandbox.didww.com/api/"
Dim country_id as Integer = 10
Try
Dim Cities as didww.api.City() = dataAPI.getcities(auth_string, country_id)
Dim I As Integer
For I = 0 To Cities.Length - 1
If I > 0 Then Message1.InnerHtml &= "<BR>"
Message1.InnerHtml &= "Unique key: " & Cities(I).uniq
Message1.InnerHtml &= "<BR>City Prefix: " & Cities(I).city_prefix
Message1.InnerHtml &= "<BR>City Name: " & Cities(I).city_name
Message1.InnerHtml &= "<BR>Monthly Price: " & Cities(I).monthly & "<br>"
Next
Catch exception As Exception
Message1.InnerHtml = "ERROR: " + exception.Message
End Try
didww.api.didwwapi dataAPI = new didww.api.didwwapi();
dataAPI.Url = "http://sandbox.didww.com/api/";
int country_id = 10;
try
{
didww.api.City[] Cities = dataAPI.getcities(auth_string, country_id);
for (int i = 0; i <= Cities.Length - 1; i++)
{
if (i > 0)
{
Message1.InnerHtml += "<BR>";
}
Message1.InnerHtml += "Unique key: " + Cities[i].uniq;
Message1.InnerHtml += "<BR>City Prefix: " + Cities[i].city_prefix;
Message1.InnerHtml += "<BR>City Name: " + Cities[i].city_name ;
Message1.InnerHtml += "<BR>Monthly Price: " + Cities[i].monthly + "<br>";
}
}
catch (Exception exception)
{
Message1.InnerHtml = "ERROR: " + exception.Message;
}
|
|
Up
3. Order DID
This method will make a new order.
The 'hashkey' value must be different for every new order. If you pass the same hashkey again, the Web Service will throw exception.
The 'Unique key' variable from method getcities should be assigned to uniq variable, in order to find DID.
This method will return two values, DID ID and DID Number. |
Method Signature |
| VB |
C# |
|
Dim DID as didww.api.DID = dataAPI.neworder(auth_string, hashkey, uniq, autorenew, period)
didww.api.DID DID = dataAPI.neworder(auth_string, hashkey, uniq, autorenew, period);
|
string auth_string
string hashkey
string uniq
integer autorenew
integer period
|
Return: DID |
DID ID: 13
DID Number: 5411123432455
|
Code example |
| VB |
C# |
Dim dataAPI As didww.api.didwwapi = New didww.api.didwwapi()
dataAPI.Url = "http://sandbox.didww.com/api/"
Dim hashkey As String = "JHK87D89SKJDLHS889SDS98JH934"
Dim uniq as Integer = 3453411
Dim autorenew as Integer = 1
Dim period as Integer = 3
Try
Dim DID as didww.api.DID = dataAPI.neworder(auth_string, _
hashkey, _
uniq, _
autorenew, _
period)
Message1.InnerHtml &= "DID ID: " & DID.did_id
Message1.InnerHtml &= "<BR>DID Number: " & DID.did_number
Catch exception As Exception
Message1.InnerHtml = "ERROR: " + exception.Message
End Try
didww.api.didwwapi dataAPI = new didww.api.didwwapi();
dataAPI.Url = "http://sandbox.didww.com/api/";
string hashkey = "JHK87D89SKJ3245DLHS889SDS98JH934";
int uniq = 1054341;
int autorenew = 1;
int period = 3;
try
{
didww.api.DID DID = dataAPI.neworder(auth_string,
hashkey,
uniq,
autorenew,
period);
Message1.InnerHtml = "DID ID: " + DID.did_id;
Message1.InnerHtml += "<BR>DID Number: " + DID.did_number;
}
catch (Exception exception)
{
Message1.InnerHtml = "ERROR: " + exception.Message;
}
|
|
Up
4. Build mapping for DID
This method will build mapping for selected DID ID. The DID ID value is passed from method neworder.
You will need to assign 'DID ID' to 'did_id' variable.
Note: If you want to use the Default mapping, this method should be ignored.
Map Protocols are:
1 - SIP
2 - IAX2
3 - H.323
The default format of URI mapping is PROTOCOL/IPADDRESS.
If you want add DIDNUMBER to URI, please use add_did = 1. The format will be: PROTOCOL/IPADDRESS/DIDNUMBER
|
Method Signature |
| VB |
C# |
|
Dim Result as Integer = dataAPI.buildmapping(auth_string, did_id, map_proto, map_uri, add_did)
int result = dataAPI.buildmapping(auth_string, did_id, map_proto, map_uri, add_did);
|
string auth_string
integer did_id
integer map_proto
string map_uri
integer add_did
|
|
|
Code example |
| VB |
C# |
Dim dataAPI As didww.api.didwwapi = New didww.api.didwwapi()
dataAPI.Url = "http://sandbox.didww.com/api/"
Dim did_id As Integer = 1342
Dim map_proto as Integer = 1 '1 - SIP, 2 - IAX2, 3 - H.323
Dim map_uri as String = "333@sip.didww.com"
Dim add_did As Integer = 0
Try
Dim Result as Integer = dataAPI.buildmapping(auth_string, _
did_id, _
map_proto, _
map_uri, _
add_did)
Message1.InnerHtml &= "Result: " & Result
Catch exception As Exception
Message1.InnerHtml = "ERROR: " + exception.Message
End Try
didww.api.didwwapi dataAPI = new didww.api.didwwapi();
dataAPI.Url = "http://sandbox.didww.com/api/";
int did_id = 9;
int map_proto = 1;
string map_uri = "999@sip.didww.com";
int add_did = 0;
try
{
int result = dataAPI.buildmapping(auth_string, did_id, map_proto, map_uri, add_did);
Message1.InnerHtml += "Result: " + result;
}
catch (Exception exception)
{
Message1.InnerHtml = "ERROR: " + exception.Message;
}
|
|
Up
5. Change mapping for DID
This method will change mapping for selected DID number. The DID number (did_number) should have full format without dashes and white spaces.
Map Protocols are:
1 - SIP
2 - IAX2
3 - H.323
The default format of URI mapping is PROTOCOL/IPADDRESS.
If you want add DIDNUMBER to URI, please use add_did = 1. The format will be: PROTOCOL/IPADDRESS/DIDNUMBER
|
Method Signature |
| VB |
C# |
|
Dim Result as Integer = dataAPI.change_mapping(auth_string, did_number, map_proto, map_uri, add_did)
int result = dataAPI.change_mapping(auth_string, did_number, map_proto, map_uri, add_did);
|
string auth_string
string did_number
integer map_proto
string map_uri
integer add_did
|
|
|
Up
6. Get region details
This method will return region details
|
Method Signature |
| VB |
C# |
|
Dim Region as didww.api.Region = dataAPI.get_region_details(auth_string, uniq)
didww.api.Region Regions = dataAPI.get_region_details(auth_string, uniq);
|
string auth_string
string uniq
|
Return Region: |
Country name: United States
City name: New York
Monthly: 8.50
|
Up
7. Get DID details
This method will return DID details
|
Method Signature |
| VB |
C# |
|
Dim DID as didww.api.DID = dataAPI.get_did_details(auth_string, did_number)
didww.api.DID DID = dataAPI.get_did_details(auth_string, did_number);
|
string auth_string
string did_number
|
Return DID: |
Did country name: United States
Did city name: New York NY
Did number format: 1-516-700100
Did status: Active
Did timeleft: 1 mon
Did expire date: 2007-06-23 03:06:27
Did order id: 123456
Did order status: Completed
Did autorenew: Disabled
Did mapping format: SIP/212.150.36.116/1516700100
Did mapping default: No
Did id: 205
Did price: 5.00
|
Up
8. Order autorenew status
This method will change Auto-renew status.
0 - Disable Auto-renew
1 - Enable Auto-Renew
|
Method Signature |
| VB |
C# |
|
Dim Result as Integer = dataAPI.order_autorenew_status(auth_string, did_number, autorenew)
int result = dataAPI.order_autorenew_status(auth_string, did_number, autorenew);
|
string auth_string
string did_number
integer autorenew
|
Return integer: result |
|
|
Up
9. Renew DID
This method will renew DID for provided period (months).
Valid periods are: 1, 3, 6, 12, 24 Months
Autorenew: 0 - Disable, 1 - Enable
|
Method Signature |
| VB |
C# |
|
Dim DID as didww.api.DID = dataAPI.new_order_renew(auth_string, did_number, period, autorenew)
didww.api.DID DID = dataAPI.new_order_renew(auth_string, did_number, period, autorenew);
|
string auth_string
string did_number
integer period
integer autorenew
|
Return DID |
Did country name: United States
Did city name: New York NY
Did number format: 1-516-700100
Did status: Active
Did timeleft: 2 mon
Did expire date: 2007-07-23 03:06:27
Did order id: 123456
Did order status: Completed
Did autorenew: Disabled
Did mapping format: SIP/212.150.36.116/1516700100
Did mapping default: No
Did id: 205
|
Up
10. Cancel DID
This method will cancel DID.
Note: Canceled DIDs cannot be restored.
|
Method Signature |
| VB |
C# |
|
Dim Result as Integer = dataAPI.did_cancel(auth_string, did_number)
int result = dataAPI.did_cancel(auth_string, did_number);
|
string auth_string
string did_number
|
Return result: |
|
|
Up
11. Cancel Order
This method will cancel any Pending Order.
Note: Canceled Orders cannot be restored. Sandbox does not support this function.
|
Method Signature |
| VB |
C# |
|
Dim Result as Integer = dataAPI.order_cancel(auth_string, did_number)
int result = dataAPI.order_cancel(auth_string, did_number);
|
string auth_string
string did_number
|
Return result: |
|
|
Up
|
|
|
| |