SD Service

Usage Example :

http://www.streetdirectory.com/api/developer/docs/examples/sdservice-simple.html
var service = new SDService(map);
var api_key = '0d95f0051bc63ad5a4905a95e8856a082e7a8f37';

// your function
function search(region, keyword, selected_act, selected_profile) {
    $("#loadingImg").show();
    $("#info").hide();
    
    selected_callback = 'set_data';
    if(selected_profile == 'sd_mobile')
        selected_callback = 'set_data';
    else if(selected_profile == 'template_1')
        selected_callback = 'set_data_template';
    else if(selected_profile == 'template_2')
        selected_callback = 'set_data_template';
    
    /* Alternatively you can also do the following */
    var searchOption = {
        mode : "search",
        act: selected_act,
        profile : selected_profile,
        country : region.toLowerCase(),
        q : keyword,
        show_additional : 1,
        output : "js",
        callback : selected_callback,
        start: 0,
        limit: 50
    };
    service.requestData(searchOption, api_key');
}

// you should define function set_data()
function set_data(json) {
    
}
Parameters Description
mode search  
act business / location / all  
start start index optional
limit total result returned optional
country country (sg, id, my)  
profile output profile (sd_mobile, template_1, template_2)  
show_additional show additional info (1 = true, 0 = false)  
q search text  

Response : (mobile profile)

Attributes Description
total total data found
id data ID
v title
a address text
t type (1 = location, 2 = business)
pid place ID
aid address ID
lid link ID
cat category ID
bid company ID
b is branch or not
tel phone number
x position - langitude
y position - latitude
bld is main building or not
ad is premium or not
pcn place name
biz has busines or not

js

set_Data([
    {
        "total":200
    },
    {
        "id":"326983",
        "v":"Suntec City Mall",
        "a":"3 Temasek Boulevard. (S)038983",
        "t":2,
        "pid":"8675",
        "aid":"19",
        "lid":"5890",
        "cat":"958",
        "bid":"137454",
        "b":"1",
        "tel":"68252668",
        "x":"103.85783083663",
        "y":"1.2949717192733",
        "bld":0,
        "ad":0,
        "pcn":"Suntec City Mall"
    },
    {
        "id":"283901",
        "v":"Suntec Business Solutions Singapore Pte Ltd",
        "a":"8 Wilkie Road. (S)228095",
        "t":2,
        "pid":"35984",
        "aid":"144084",
        "lid":"175817",
        "cat":"4147",
        "bid":"56935",
        "b":"1",
        "tel":"63922616",
        "x":"103.84985322138",
        "y":"1.3022588134506",
        "bld":0,
        "ad":0,
        "pcn":"Wilkie Edge"
    }
]);

Response : (template_1 profile)

Attributes Description
total total data found
t title
a address text
x position - langitude
y position - latitude
u url

js

set_data_template([
    {
        "total":198
    },
    {
        "t":"Suntec City Mall",
        "a":"3 Temasek Boulevard. (S)038983",
        "x":"103.85783083663",
        "y":"1.2949717192733",
        "u":"http:\/\/www.streetdirectory.com\/asia_travel\/travel\/travel_id_8675\/travel_site_19\/"
    },
    {
        "t":"Suntec Tower Five",
        "a":"5 Temasek Boulevard. (S)038985",
        "x":"103.85803786042",
        "y":"1.2945314665822",
        "u":"http:\/\/www.streetdirectory.com\/asia_travel\/travel\/travel_id_8680\/travel_site_21\/"
    }
]);

Response : (template_2 profile)

Attributes Description
total total data found
t title
a address text
x position - langitude
y position - latitude
aid address ID
pid place ID
pc postal code
dt data type (1 - landmark, 2 - business)
st_na street name
blk_no block number
u url

js

set_data_template([
    {
        "total":198
    },
    {
        "t":"Suntec City Mall",
        "a":"3 Temasek Boulevard. (S)038983",
        "x":"103.85783083663",
        "y":"1.2949717192733",
        "aid":"19",
        "pid":"8675",
        "pc":"038983",
        "dt":1,
        "st_na":"Temasek Boulevard",
        "blk_no":"3",
        "u":"http:\/\/www.streetdirectory.com\/asia_travel\/travel\/travel_id_8675\/travel_site_19\/"
    },
    {
        "t":"Suntec Tower Five",
        "a":"5 Temasek Boulevard. (S)038985",
        "x":"103.85803786042",
        "y":"1.2945314665822",
        "aid":"21",
        "pid":"8680",
        "pc":"038985",
        "dt":1,
        "st_na":"Temasek Boulevard",
        "blk_no":"5",
        "u":"http:\/\/www.streetdirectory.com\/asia_travel\/travel\/travel_id_8680\/travel_site_21\/"
    }
]);