Vous êtes sur la page 1sur 27

LOCAL DISTRIBUTION SERVICES (LDS) API

Version: 3.3 Last Updated: Jan 2012

Local.com Local Distribution Service (LDS) API

Version | 3.3

Table of Contents
OVERVIEW ........................................................................................................................................................ 4 LDS ACCOUNT SETUP ....................................................................................................................................... 6 Traditional Method A (Using aff Parameter) ............................................................................................... 6 New Method B (New Method Using appid Parameter) ............................................................................... 6 LDS API FUNDAMENTALS ................................................................................................................................. 6 Call Basics ..................................................................................................................................................... 6 The LDS Sandbox .......................................................................................................................................... 7 INPUT PARAMETERS......................................................................................................................................... 7 Required Parameters ................................................................................................................................... 7 Optional Parameters .................................................................................................................................... 8 CALL SYNTAX .................................................................................................................................................... 9 EXAMPLES ...................................................................................................................................................... 10 Input using a City and State ....................................................................................................................... 10 Input using a ZIP code and Maxresults of 20 ............................................................................................. 11 PARAMETER NOTES........................................................................................................................................ 11 Results Sorting Options .............................................................................................................................. 11 Sorting Details ............................................................................................................................................ 11 Distance ...................................................................................................................................................... 12 Filtering by Letter ....................................................................................................................................... 12 Location in LDS ........................................................................................................................................... 12 THE <info> SEGMENT ..................................................................................................................................... 13 The <parameters> Subsection ................................................................................................................... 13 The <location> section ............................................................................................................................... 13 The <type> Subsection ............................................................................................................................... 14 The <nearbycities> Subsection................................................................................................................... 14 The <weather> Subsection ......................................................................................................................... 14 The <spelling> Subsection .......................................................................................................................... 14 The <alphabet> Subsection ........................................................................................................................ 15 The <categoryStat> Subsection .................................................................................................................. 15
Page | 2

Local.com Local Distribution Service (LDS) API

Version | 3.3

The <error> Subsection .............................................................................................................................. 15 The <resultset> Subsection ........................................................................................................................ 15 The <result> Subsection ............................................................................................................................. 16 The <local> Subsection ............................................................................................................................... 17 The <extended> Subsection ....................................................................................................................... 18 CALLING LDS FOR PROFILE PAGE ................................................................................................................... 19 The <profile> Segment ............................................................................................................................... 21 SAMPLE CALLS ................................................................................................................................................ 22 A Sample Call in C# ..................................................................................................................................... 22 A Sample Call in Java .................................................................................................................................. 23 A Sample Call in PHP .................................................................................................................................. 23 APPENDICES ................................................................................................................................................... 25 Appendix A XML Feed Results Example .................................................................................................. 25 Appendix B Frequently Asked Questions ................................................................................................ 27

Page | 3

Local.com Local Distribution Service (LDS) API

Version | 3.3

OVERVIEW
The Local.com Local Distribution Service (LDS) application programming interface (API) provides an open standards interface for use by developers at Local.com partner sites. This interface is referred to as the LDS API. The LDS API works with any platform or technology and gives developers full access to an XML feed of local search results, profile pages, and advertising for all locations in the United States. Built on Local.coms proprietary search technology, the LDS API connects subscribers to a high-speed, highly-reliable, content-rich source of local business listings and targeted local advertising. There are two LDS api endpoints. Any new user needs to use the v2 api as it has more features. For example, Json format is supported only in v2 api. We also encourage existing LDS user to upgrade to v2 api. LDS v1 api is provided for backward compatibility purpose for a period of time and will be dropped out later. LDS api endpoint V2:
http://lds.local.com/lds/v2/search.jsp?aff=[aff]&keyword=[Keyword]&location=[Location]&ip=[IP]& referrer=[Referrer]&rp=[ReferrerFullUrl]&httpuseragent=[HttpUserAgent]

LDS call endpoint V1:


http://lds.local.com/lds/search.jsp?aff=[aff]&keyword=[Keyword]&location=[Location]&ip=[IP]&ref errer= [Referrer]&rp=[ReferrerFullUrl]&httpuseragent=[HttpUserAgent]

This guide describes the calls in the LDS API and helps you understand the LDS data feed on your web properties to maximize your revenues on local search traffic. The major sections in this guide are as follows: LDS Account Setup describes what you need to do before using the LDS API. LDS API Fundamentals provides basic information on the LDS API. Input Parameters describe the various required and optional parameters of an LDS API call. Call Syntax describes the syntax of an LDS API call. Examples show various examples of LDS API input and the resulting XML output. Parameter Notes describe the syntax of an LDS API call. Info Section describes the <info> section that appears within each XML response. This section may contain multiple subsections, each of which may contain multiple fields. o o o o o o The <parameters> subsection The <location> subsection The <spelling> subsection The <alphabet> subsection The <error> subsection The <categoryStat> subsection
Page | 4

Local.com Local Distribution Service (LDS) API


o The <resultset> subsection

Version | 3.3

Calling LDS for Profile Page describes how to access the profile page of a courtesy listing. Sample Calls provides a sample LDS API call in three different programming languages: C#, Java, and PHP. Appendix A, XML Feed Results Example, provides an instance of the feed results. Appendix B, Frequently Asked Questions, answers commonly asked questions. Use this guide's table of contents if you're looking for something specific. If there's something you need and cant find within this guide, send your question to our customer support at ldssupport@local.com and we'll get you what you need.

Page | 5

Local.com Local Distribution Service (LDS) API

Version | 3.3

LDS ACCOUNT SETUP


Before using the LDS API, contact your Local.com representative to obtain information on accessing the LDS server and to obtain valid access credentials (a login name and password). There are two methods to set up your LDS account. The first (referred to as the traditional method) requires you to white list your server IP and host URL while the second (referred to as Method B) allows you to bypass the server IP and host URL check. Depending on how your account is set up, be sure to follow the following associated guidelines.

Traditional Method A (Using aff Parameter)


In general, to get your account set up using this method, the following information is required to set up a Partners LDS account: 1. 2. IP address or IP range of the server(s) which make(s) request to LDS. Host root URL that makes requests to LDS.

As the above information will be used to valid all LDS calls, be sure to use the correct server IP and host root URL (that were provided for your account setup); otherwise errors will be encountered for your LDS request. After your server IP and host URL were white-listed and your LDS account is setup, an affiliate ID will be provided to you. You must use this affiliate ID for all of your LDS calls.

New Method B (New Method Using appid Parameter)


With this method, you do not need to provide us anything. After the contract is signed, your LDS account will be set up and an appid will be provided to you. You must use this appid for all of your LDS calls. HELPFUL TIP:
If you are set up to use appid, our system will not check the server IP and host URL. However, the click rules still apply. For more information, please refer to the Frequently Asked Questions (FAQ) section of this guide.

LDS API FUNDAMENTALS


Once you understand the different parts of the API, you can start creating your client application. This section describes some things to keep in mind when creating your client application.

Call Basics
The LDS API uses a REST-like interface. This means that our LDS method calls are made over the internet by sending HTTP GET or POST requests to the LDS API REST server. Nearly any computer language can be used to communicate over HTTP with the REST server. A
Page | 6

Local.com Local Distribution Service (LDS) API

Version | 3.3

request is made through a URL to the specified Local.com server which returns an XML or JSON document via HTTP. The data in the returned document will vary according to the values of parameters passed in the API call (such as the keyword and the location, for example).

The LDS Sandbox


The LDS Sandbox is a non-production environment that provides full access to the LDS API. You can use it to develop and test your client applications without needing to worry about how it might affect a production environment or production data. For information on accessing the Sandbox, contact your Local.com representative.

INPUT PARAMETERS
Required Parameters
Parameter aff /appid Description Aff is the affiliate ID assigned to you after your LDS account is set up. Appid is the application ID assigned to you after your LDS account is set up. Note: Depending on how your LDS account is created, you must use the correct identifier when calling LDS. As noted above, when appid is used, we do not need to white list the server IP and root host URL. The key word, or keywords (separated by commas), specifying what to search for. The geographic location associated with the search request. This may be a city and state combination, a zip code, a landmark, an area code, or a specific street address. United States locations only. See Determine location in LDS later in this document for information on how LDS handles cities provided without states. IP address of the user requesting the search. This parameter is used by Local.com to validate clicks against searches. Note: This is not the server IP which calls LDS. As a general guideline, LDS search end user ID and click end user IP must match as Local.com click application detects the end user IP and this IP must match the LDS IP parameter. Root URL of the site displaying the result set. This parameter is used to validate clicks and searches and to ensure quality traffic. Example: www.yourdomain.com. Note: Be sure to specify the http referrer; otherwise a click with an empty http referrer is filtered out and not validated. The referrer parameter must match the root URL of the click http referrer.
Page | 7

keyword location

ip

referrer

Local.com Local Distribution Service (LDS) API


rp

Version | 3.3

The full URL of a page making search request. It is highly recommended passing this parameter to get premium advertisers. Note: The value must be url-encoded. Example: http%3A%2F%2Fwww.local.com/result.aspx%3Fkeyword%3Dpizza+hut% 26location%3Dirvine+ca User Agent of user performing search. It is highly recommended passing this parameter to get premium advertisers. Note: The value must be url-encoded. Example: Mozilla/4.0%20(compatible;%20MSIE%206.0;%20Windows%20NT%205.1; %20SV1;%20Tablet%20PC%201.7;%20.NET%20CLR%201.0.3705;%20.NET% 20CLR%201.1.4322)

httpuseragent

Optional Parameters
Parameters subaff Description Sub-affiliate. Partner can use this parameter to differentiate traffic source. API response format in XML or json. Json format is supported only in v2 api. Specifies how courtesy results are to be sorted. See Results Sorting Options later in this document for more information. Allows courtesy results to be filtered by letter. See Results Sorting Options later in this document for more information. Sets the maximum number of results received in each Valid Values/ Default Value Alphanumeric, hyphen (-), underscore (_), and period (.). No default. Default value is xml. Example &subaff=foobar

format

&format=xml &format=json

courtesysort

distance | name | relevance |"rating" Default value is relevance. #, any letter of the alphabet or 0-9 No default.

&courtesysort=distance

courtesyfirstletter

&courtesytfirstletter=a

maxresults

Any integer. Default value is 10.

&maxresults=10

Page | 8

Local.com Local Distribution Service (LDS) API


segment of the feed. Sets the starting page of results to return, based on the setting of maxresults. The resultindex parameter, if present, takes higher priority. Specifies the specific result at which to start returning results. Instructs the Local.com parser to look for a location within the keyword string. See Determine location in LDS for more information.

Version | 3.3

pagestart

Any integer greater than zero. Default value is 1.

&pagestart=2

resultindex

parsekeyword

Any integer greater than zero. No default. true | false Default value is false.

&resultindex=11

&parsekeyword=true

Note: In order for the above request to be valid, the user shall include a city and state combination, a zip code, a landmark, an area code, or a specific street address.

CALL SYNTAX
The following shows the basic syntax (followed by an example) of LDS API calls that use an aff and an appid. In the syntax shown below, the [BracketedItems] are parameter place holders to be replaced with appropriate data when actually making a request. As described later in this document, there are other optional parameters that you may also include in your LDS API calls. Query Syntax Using an aff
http://lds.local.com/lds/v2/search.jsp?aff=[aff]&keyword=[Keyword]&location=[Location]&ip=[IP]& referrer= [Referrer]&rp=[ReferrerFullUrl]&httpuseragent=[HttpUserAgent]

Example

Page | 9

Local.com Local Distribution Service (LDS) API

Version | 3.3

http://lds.local.com/lds/v2/search.jsp?aff=test&keyword=pizza&location=92618&ip=63.251.207.35 &referrer=www.local.com&rp=http%3A%2F%2Fwww.local.com/result.aspx%3Fkeyword%3Dpizza% 26location%392618&httpuseragent=Mozilla

Query Syntax Using an appid


http://lds.local.com/lds/v2/search.jsp?appid=[appid]&keyword=[Keyword]&location=[Location]&i p=[IP] &referrer=[Referrer]&rp=[ReferrerFullUrl]&httpuseragent=[HttpUserAgent]

Example
http://lds.local.com/lds/v2/search.jsp?appid=4786E856-01C1-40C1-951DF06C731718C4&keyword= hotels&location=disneyland&ip=63.251.207.35&referrer=www.local.com&rp=http%3A%2F%2Fwww. local.com/result.aspx%3Fkeyword%3Dhotels%26location%3Ddisneyland&httpuseragent=Mozilla

As illustrated above, each request must include at least the following seven parameters: aff or appid, keyword, location, ip, referrer, rp, and httpuseragent.

EXAMPLES
Input using a City and State
http://lds.local.com/lds/v2/search.jsp?aff=test&keyword=pizza&location=irvine+ca&ip=10.23.25.1 &referrer=www.local.com&rp=http%3A%2F%2Fwww.local.com/result.aspx%3Fkeyword%3Dpizza% 26location%3Dirvine+ca&httpuseragent=Mozilla&resultindex=0&pagestart=1&maxresults=10

Example XML Output <lds> <copyright>Copyright 1999-2008 Local.com Corporation</copyright> <info> <parameters> <executiontime>200</executiontime> <affiliate>test</affiliate> <keyword>pizza</keyword> <location>irvine ca</location> <ip>10.23.25.1</ip> <referrer>www.local.com</referrer>
Page | 10

Local.com Local Distribution Service (LDS) API

Version | 3.3

<rp>http%3A%2F%2Fwww.local.com/result.aspx%3Fkeyword%3Dpizza%26locat ion%3Dirvine+ca</rp> <httpuseragent>Mozilla</httpuseragent> <resultindex>0</resultindex> <pagestart>1</pagestart> <maxresults>10</maxresults> </parameters> </lds>

Input using a ZIP code and Maxresults of 20


http://lds.local.com/lds/v2/search.jsp?aff=test&keyword=pizza&location=92618&ip=10.23.25.1&ref errer=www.local.com&rp=http%3A%2F%2Fwww.local.com/result.aspx%3Fkeyword%3Dpizza%26lo cation%3D92618&httpuseragent=Mozilla&maxresults=20

Example XML Output <lds> <copyright>Copyright 1999-2008 Local.com Corporation</copyright> <info> <parameters> <executiontime>176</executiontime> <affiliate>test </affiliate> <keyword>pizza</keyword> <location>92618</location> <resultindex>0</resultindex> <pagestart>1</pagestart> <maxresults>20</maxresults> </parameters> </info> </lds>

PARAMETER NOTES
Results Sorting Options
LDS allows you to specify how courtesy results in the returned XML feed are sorted. Results can be sorted by relevance, distance, business name, or star rating. You can also request that results be returned by business name according to specific letters of the alphabet.

Sorting Details
By including a &courtesysort= parameter in the request, you can specify how courtesy results in the returned XML feed are sorted. By default (if you omit the parameter), the results are sorted according to Local.coms proprietary combination of relevance (based on keyword) and distance.
Page | 11

Local.com Local Distribution Service (LDS) API

Version | 3.3

If you include a &courtesysort= parameter, the results are sorted the way you specify. &courtesysort=relevance lists the results by descending relevance to the specified keyword. In this case, more relevant listings that are farther away from the search center will be higher in the returned list than closer, less relevant ones. &courtesysort=distance lists the closest results first. &courtesysort=name sorts the results alphabetically. &courtesysort=rating sorts the results from high to low by star rating (0 to 5 stars).

Distance
A search is performed using a 30-mile radius from the center of the specified search location. The search location (e.g. a city, state, zip or area code) is defined as the population center of that geo. If a specific address or landmark is provided, the search location is centered on that address or landmark. Distances provided in the feed and used to perform distance-based sorts are measured from the search location.

Filtering by Letter
Local.com courtesy results can also be filtered by letters of the alphabet so that only a limited subset of the results will be returned. By passing in the parameter courtesyfirstletter and providing a pound sign (#) or a letter of the alphabet, LDS will return only results that start with a number or the specified letter. This must be used with the &courtesysort=name parameter to create an alphabetically-sorted list of results starting with a particular letter. This allows users to create alphabetic filters in the UIs of their sites. See the Using the Feed Results section for more information on the <alphabet> section of the feed, which can help to create a more intelligent alphabetic filter.

Location in LDS
If the location parameter is empty or invalid, LDS uses GEOIP to determine the search location. However, GEOIP may fail at times. It is recommended to use parsekeyword=true when location parameter is empty. This will allow the LDS search parser to look for location in the keyword string and to identify any locations contained herein. If provided location parameter is empty or invalid and parsekeyword=true, LDS uses GEOIP to determine the user location. If GEOIP is successful, the GEOIP location is used for the LDS location. If GEOIP fails, LDS parses location in keyword.

Page | 12

Local.com Local Distribution Service (LDS) API

Version | 3.3

THE <info> SEGMENT


The <info> segment within each returned XML feed contains general data about the request made to LDS and the returned response. This section may contain multiple subsections, each of which may contain multiple fields. The various subsections that may appear with the <info> section are as follows:

The <parameters> Subsection


Field <executiontime> Description Time, in milliseconds, for LDS to process the request Note: This field can be used to determine the overall performance of the system, especially if you notice slow response on the site. Make a note of the times you see here over several test queries. Affiliate ID used to call the feed Keyword passed in for the search The <location> subsection specifying the location for the search. Note: As determined by passing parameters, or through GeoIP lookup As passed in by the feed requestor, the number of the first courtesy result to be displayed The page number of the first courtesy result to be displayed, as passed in the request. The number of results to display per page, as passed in the request.

<affiliate> <keyword> <location>

<resultindex> <pagestart> <maxresults>

The <location> section


Field <streetnumber> <street> <city> Description Street (address) number, as passed in the request or as determined by the search parser. Street name, as passed in the request or as determined by the search parser. City for the search, as passed in the request or as determined by the search parser. Note: If a zip code or landmark is passed, the search parser will determine the most appropriate city for the request and display that here.
Page | 13

Local.com Local Distribution Service (LDS) API


<state>

Version | 3.3

State for the search, as passed in the request or as determined by the search parser. Note: If a zip code or landmark is passed, the search parser will determine the most appropriate state for the request and display that here. Zipcode for the search, as passed in the request or as determined by the search parser. Note: If a city, state or landmark is passed, the search parser will determine the most appropriate Zip for the request and display that here. If passed in as a search parameter. Otherwise, it will not be displayed. If passed in as a search parameter. Otherwise, it will not be displayed. Latitude of the center of the search radius, as determined by the search parser. Longitude of the center of the search radius, as determined by the search parser.

<zipcode>

<areacode> <landmark> <latitude> <longitude>

The <type> Subsection


This subsection of the returned XML feed identifies the type of location used to determine the search latitude and longitude. The value codes are 1 = Landmark, 2 = Zipcode, 4 = City, 8 = Areacode, 16 = State. The value codes are additive, so a value of 20 indicates that both a City (4) and State (16) were used. Example: <type>20</type>

The <nearbycities> Subsection


This subsection of the returned XML feed lists the names of up to 10 cities near the business location. Each name is enclosed within a <location></location> delimiter pair. Example: <nearbycities><location>East Irvine, CA</location><location>Tustin, CA</location><location>Aliso Viejo, CA</location></nearbycities>

The <weather> Subsection


This subsection of the returned XML feed displays the current weather conditions of the business location. Example: <weather></weather>

The <spelling> Subsection


This subsection of the returned XML feed displays alternate spelling suggestions as determined by the search parser. If a user has misspelled a common word, a list of alternatives will appear in this section. These may be used by the web sites front end to provide users with a clickable list of alternative spellings.
Page | 14

Local.com Local Distribution Service (LDS) API


Example: <spelling></spelling>

Version | 3.3

The <alphabet> Subsection


This subsection of the returned XML feed is a single field containing a list of letters and numerals (0-9). The letters in this list represent the letters by which a user may filter the courtesy results list. For example, if a business in the results set is Acme Flowers, then A would appear in the <alphabet> section. If no business in the result set begins with Z, then Z will not appear in the list. This can be used in conjunction with the courtesysort and courtesyfirstletter parameters described above to create alphabetized, filtered lists of courtesy results. For an example of how this list is used in actual practice, visit the search results page of Local.com. Try searching for less-common business types and you will see a more limited set of letters returned in this section. Example: <alphabet>0-9ABCDEFGHIJKLMNOPQRSTUVWY</alphabet>

The <categoryStat> Subsection


This subsection of the returned XML feed displays the category statistics for the courtesy results. It displays the category bdc, the category name, and the number of returned items associated with the bdc. You can use this information in conjunction with category filtering of courtesy results. Example: </categoryStat><category><bdc>25070200</bdc> <title>Florists & Flowers</title><count>558</count></category><category><bdc>10110300</bdc><title> Ornamental Nursery Services</title><count>152</count></category></categoryStat>

The <error> Subsection


This subsection of the returned XML feed displays feed errors in a human-readable format. Use these error descriptions when reporting feed problems to your Local.com representative. Example: <error></error>

The <resultset> Subsection


This subsection of the returned XML feed contains all of the advertising and business listing results for the feed. It is divided into several <resultset> segments, each of which contains a number of results. Reading in these segments will provide different kinds of listings that can be displayed on a Web sites results page. There are two parameters in each resultset: 1. Segment indicates the type of result returned for that resultset. 2. Total indicates the total number of results returned in that section for the query, regardless of the number actually displayed in the feed (as determined by the maxresults parameter). Valid values for the segment parameter are:

Page | 15

Local.com Local Distribution Service (LDS) API


Value Localppc Nationalppc Description

Version | 3.3

Displays local pay-per-click ads. These ads are those attached to a particular geography and sorted by bid price. Displays national pay-per-click ads. These ads are those not attached to a particular geography and sorted by bid price. Displays local best business listings based on location. Displays local business listings from Partner A. Displays pay-per-click ads from Partner B. Displays pay-per-call ads from Partner C. Displays pay-per-click ads from Partner D. Displays pay-per-click ads from Partner E. These ads may be not sorted by bid price. Displays subscription ads contained in the Local.com ad center that have preferred ad placement in the Featured Sponsor section of www.Local.com.

Localfavorite Displays local favorite business listings based on location. Localbest PartnerA PartnerB Sponsored PartnerD Featured Subscription

Displays Local.coms business listings results, sorted according to the parameters specified in the feed request. Each of the above segments adheres to the same basic XML layout. Note: Some of the above segments may not show in the XML result, depending on your account setup. Ask a Local.com representative about which segments should appear in your feed result. Segments that contain locally-oriented results have additional fields of data provided.

Courtesy

The <result> Subsection


There is one <result> subsection for each locally-based advertisement or listing that satisfies the search criteria specified in the request. Each <result> subsection in the returned XML feed includes the following fields, which may or may not be populated for a particular result: 1. Listing title or business name 2. Listing description 3. Click bid value 4. Click URL 5. Display URL 6. Position of the listing in the results list 7. Rating icon 8. Phone track URL 9. External review URL 10. External profile URL The following table summarizes these fields.
Page | 16

Local.com Local Distribution Service (LDS) API


Field <title> <description> <bid> Description

Version | 3.3

The title of the advertisement or the name of the business associated with the listing. The text of the advertisement or a description of the listing (if available). The bid value for a click (or call) for the advertisement. Note: Bid values for pay-per-call ads are for calls only, not clicks. The URL created by Local.coms click processing system that captures data about each click and redirects the user to the requested ad. Should you want to learn about how LDS tracks the number of clicks for advertisement, please refer to Appendix B: Frequently Asked Questions. The URL to be displayed by the Web site. This creates a better appearance than the ClickURL. The position of the advertisement or listing in the results list, as determined by the sorting rules applied. A rating icon for the business. The URL of the telephone track of the business. The URL of an external profile of the business.

<clickurl>

<displayurl> <position> <rating_icon> <phone_track_url> <external_profile_url> <extended>

<external_review_url> The URL of an external review of the business. A subsection specifying additional information about the advertisement or listing. The <result> subsection also includes a <local> and <extended> subsection, which may or may not be populated for a particular result.

The <local> Subsection


The <local> subsection in the returned XML feed for each locally-based advertisement or listing specifies geographical information for the business. It includes the following fields, which may or may not be populated for a particular result: 1. Name 2. Address 3. City 4. State 5. Zipcode 6. Phone 7. Latitude 8. Longitude 9. MapURL 10. Distance The following table summarizes these fields.
Page | 17

Local.com Local Distribution Service (LDS) API


Field <name> <address> <city> <state> <zipcode> <phone> <latitude> <longitude> <mapurl> <distance> Description

Version | 3.3

The business name, especially if different from the ad title. The street address of the business. The city of the business. The state of the business. The zip code of the business. The telephone number of the business. The latitude of the business location. The longitude of the business location. A URL provided by Local.com that points to the free map provided at maps.local.com. The distance, in miles, of the business from the center of the search location. Note: This is provided only for those listings or ads with a physical address.

The <extended> Subsection


The <extended> subsection in the returned XML feed for each locally-based advertisement or listing specifies additional information about the advertisement or listing. It includes the following fields, which may or may not be populated for a particular result: 1. Advertiser ID 2. Listing ID 3. Category 4. Category text description 5. A_url 6. Web url 7. Result description 8. Star rating 9. Review description The following table summarizes these fields. Field advertiserid listingid category categorynnnnnnnn A_url weburl Description The id of the advertiser. The id of the listing. A category number (BDC code) associated with the business. The category text description for the BDC number nnnnnnnn. The web url of the business The web url of the business.
Page | 18

Local.com Local Distribution Service (LDS) API

Version | 3.3

Note: If both A_url and weburl are available, we recommend that you use A_url for the display. resultDesc starRating reviewDesc Description of the business. Average review rating score, ranges from 0 to 5 stars. Description of the most recent review snip.

Each data item within an extended subsection is a key and value pair. For example, a listing ID is specified within an extended subsection as follows: <data key="listingid" value="65435826" /> If a particular data item has multiple attributes, such as a business category has both a category number (BDC code) and a text description, you use multiple key and value pairs to show the linkage. In the following example, there are four category numbers (BDC codes) and four category text descriptions. Each category number is linked to its text description by two key and value pairs. Category 10040102 is linked to Horticultural Plants. Category 10110212 is linked to Plants Indoor Wholesale. Category 11210604 is linked to Silk Flowers & Plants Rental & Leasing. Category 10110214 is linked to Plants Wholesale. <data key="category" value="10040102" /> <data key="category10040102" value="Horticultural Plants" /> <data key="category" value="10110212" /> <data key="category10110212" value="Plants Indoor Wholesale" /> <data key="category" value="11210604" /> <data key="category11210604" value="Silk Flowers & Plants Rental & Leasing" /> <data key="category" value="10110214" /> <data key="category10110214" value="Plants Wholesale" />

CALLING LDS FOR PROFILE PAGE


Each result in courtesy section has a profile page, which can be called by way of the LDS API. This section summarizes how to call such a profile page. HELPFUL TIP:
Note: If you need to call LDS for profile data, please make sure to ask Local.com representative for a profile page affiliate id. This identifier is different from the SERP affiliate identifier. Syntax: http://lds.local.com/lds/v2/search.jsp?aff=[Aff]&listingid=[Listingid]&keyword=[Keyword]&location =[Location]&ip=[IP]&referrer=[Referrer]&rp=[ReferrerFullUrl]&httpuseragent=[HttpUserAgent]

Input Parameters:
Page | 19

Local.com Local Distribution Service (LDS) API


1. 2. 3. 4. 5. 6. 7. 8. aff or appid - required listingID - required keyword - optional location - optional ip - required referrer required rp required httpuseragent required

Version | 3.3

Notes: 1) The only different parameter between calling results for SERP and profile page is listingid, which contains a listingid field under an <extended> section of <courtesy> segment. 2) Keyword and Location parameters are optional. 3) As is the case for localsearch-results calls, the subaff parameter can be used to differentiate traffic source for profile-page calls. Example URL Using aff
http://lds.local.com/lds/v2/search.jsp?aff=test_p&listingid=52284088&ip=10.23.25.1&referrer=www.l ocal.com&rp=http%3A%2F%2Fwww.local.com/details.aspx&httpuseragent=Mozilla

Example XML Output <?xml version="1.0" ?> - <lds> <copyright>Copyright 1999-2008 Local.com Corporation</copyright> + <info> - <profile> <listingId>52284088</listingId> <agencyId>AX</agencyId> <name>Thai Vegetarian Cuisine</name> <description /> <address>14370 Culver Dr</address> <city>Irvine</city> <state>CA</state> <zipCode>92604</zipCode> <phone>9495518222</phone> <latitude>33.705741</latitude> <longitude>-117.786563</longitude> <advertiserId>0019337143</advertiserId> <emailAddress /> <hours /> <creditCards /> <languages /> <seniorDiscount /> <sic /> <naics /> <urls /> - <categories>
Page | 20

Local.com Local Distribution Service (LDS) API


<category id="16030000">Restaurants</category> </categories> - <breadcrumb> <category level="1" id="16000000">Food And Dining</category> <category level="2" id="16030000">Restaurants</category> </breadcrumb> - <reviews> + <review partner="LocaLReview" agencyId="LM" reviewId="252"> </reviews> <logoFullLocation /> + <web_references> <offers /> <coupons /> </profile> - <resultsets> + <resultset segment="partnerB" total="6"> + <resultset segment="partnerD " total="16"> + <resultset segment="localppc" total="33"> </resultsets> </lds>

Version | 3.3

The <profile> Segment


There is a new segment named <profile> that contains profile data for a locally-based advertisement or listing. Common fields for this segment include the following fields, which may or may not be populated for a particular result: Field Listingid Name Address City State Zipcode Phone Latitude Longitude Emailaddress Hours Creditcards Urls Categories Description Id of the profile listing Business name of the listing Address of the listing City of the listing State of the listing Zip code of the listing Phone number of the listing Latitude of the listing location Longitude of the listing location Email address of the listing Hours of operations of the listing Credit card accepted by the listing Urls of the listing Categories of the listing
Page | 21

Local.com Local Distribution Service (LDS) API


Field Breadcrumb Description

Version | 3.3

Pick the main category and list its parent category as breadcrumb format The breadcrumb can be used as a category relationship drill down. The lower level category is the parent of a larger one. Reviews of the business listing More detailed description of the business Web references for the listing

Reviews Content Web_references

SAMPLE CALLS
The topics that follow show examples of an LDS API call in three different programming languages: C#, Java, and PHP.

A Sample Call in C#
The following C# LDS API call requests results for flower retailers near Irvine, CA: HttpWebRequest req; HttpWebResponse res = null; StreamReader reader; StringBuilder response; try { req=WebRequest.Create("http://lds.local.com/lds/v2/search.jsp?aff=test&keyword =flowers &location=irvine+ca&ip=63.251.207.35&referrer=www.local.com&rp=
http%3A%2F%2Fwww.local.com/result.aspx%3Fkeyword%3Dflowers%26 location%3Dirvine+ca&httpuseragent=Mozilla") as HttpWebRequest;

res = request.GetResponse() as HttpWebResponse; if (req.HaveResponse == true && res != null) { reader = new StreamReader(res.GetResponseStream()); response = new StringBuilder(reader.ReadToEnd()); // Parse response here } } catch (WebException wex) { // Handle exception here } finally
Page | 22

Local.com Local Distribution Service (LDS) API


{ if (res != null) { res.Close(); } }

Version | 3.3

A Sample Call in Java


The following Java LDS API call requests results for flower retailers near Irvine, CA: // Using Apache httpclient module HttpClient client = new HttpClient(); HttpMethod method = newGetMethod("http://lds.local.com/lds/v2/search.jsp?aff=test&keyword=flowers &location=irvine+ca&ip=63.251.207.35&referrer=www.local.com&rp=http%3A%2F%2F www. local.com/result.aspx%3Fkeyword%3Dflowers%26location%3Dirvine+ca&httpuseragent= Mozilla"); try { client.executeMethod(method); if (method.getStatusCode() == HttpStatus.SC_OK) { String response = method.getResponseBodyAsString(); // Parse response here } } catch (IOException e) { // Handle exception here } finally { method.releaseConnection(); }

A Sample Call in PHP


The following PHP LDS API call requests results for flower retailers near Irvine, CA: <?php $r = new HttpRequest(http://lds.local.com/lds/search.jsp?aff=test&keyword=flowers &location=irvine+ca&ip=63.251.207.35&referrer=www.local.com&rp=http%3A%2F%2F
www. local.com/result.aspx%3Fkeyword%3Dflowers%26location%3Dirvine+ca &httpuseragent= Mozilla ', HttpRequest::METH_GET);

try {
Page | 23

Local.com Local Distribution Service (LDS) API


$r->send(); if ($r->getResponseCode() == 200) { $res = $r->getResponseBody()); // Parse response here } } catch (HttpException $ex) { // Handle exception } ?>

Version | 3.3

Page | 24

Local.com Local Distribution Service (LDS) API

Version | 3.3

APPENDICES
Appendix A XML Feed Results Example
<?xml version="1.0" encoding="UTF-8" ?> - <lds> <copyright>Copyright 1999-2011 Local.com Corporation</copyright> - <info> - <parameters> <executionTime>1478</executionTime> <affiliate>locm_s</affiliate> <keyword>pizza</keyword> <location>irvine ca</location> <resultIndex>1</resultIndex> <pageStart>1</pageStart> <maxResults>10</maxResults> </parameters> - <location> <city>Irvine</city> <state>CA</state> <zipCode>92618</zipCode> <latitude>33.679632</latitude> <longitude>-117.791492</longitude> <type>20</type> - <nearbyCities> <location>East Irvine, CA</location> <location>Tustin, CA</location> <location>Santa Ana, CA</location> <location>Newport Coast, CA</location> <location>Laguna Woods, CA</location> </nearbyCities> </location> <alphabet>ABCDEFGHIJKLMNOPQRSTUVWXYZ</alphabet> <searchId>c3a0a6c5-f59e-44aa-a3b8-218c4a6bbb9e</searchId> </info> - <resultSets> - <resultSet segment="courtesy" total="1142"> - <result> <title>Lamppost Pizza</title> <bid>0</bid> <position>1</position> <address>4230 Barranca Pkwy</address> <city>Irvine</city> <state>CA</state> <zipCode>92604</zipCode> <phone>9495590900</phone> <latitude>33.68126669098593</latitude> <longitude>-117.80436256658123</longitude> Page | 25

Local.com Local Distribution Service (LDS) API

Version | 3.3

<distance>0.75</distance> - <extended> <data key="category" value="16163600" /> <data key="listingid" value="104892286" /> <data key="category16163600" value="Pizza Restaurant" /> </extended> </result> - <result> <title>Z Pizza</title> <bid>0</bid> <position>2</position> <address>5365 Alton Pkwy Ste I</address> <city>Irvine</city> <state>CA</state> <zipCode>92604</zipCode> <phone>9495511555</phone> <latitude>33.67129722535065</latitude> <longitude>-117.78912188923074</longitude> <distance>0.59</distance> - <extended> <data key="starRating" value="3.666667" /> <data key="category" value="16163600" /> <data key="listingid" value="80457527" /> <data key="Acxiom_displayurl" value="www.zpizza.com" /> <data key="Acxiom_url" value="www.zpizza.com" /> <data key="category16163600" value="Pizza Restaurant" /> <data key="url" value="Acxiom" /> </extended> </result> </resultSet> - <resultSet segment="nationalppc" total="6"> - <result> <title>Domino&#39;s <b>Pizza</b> Delivery</title> <description>Delivering Quality from the Farm to Your Front Door! Order Yours Today</description> <bid>0.21</bid> - <clickUrl> </clickUrl> <displayUrl>www.Dominos.com</displayUrl> <position>1</position> </result> - <result> </resultSet> </resultSets> </lds>

Page | 26

Local.com Local Distribution Service (LDS) API

Version | 3.3

Appendix B Frequently Asked Questions


1. With the traditional method, what information is required in order to set up an account? The following information is required to set up a Partners LDS account using the traditional method: a. IP address of the server (or IP range of the servers) which will make requests to LDS. If the IP address (or range of addresses) is not white listed in our system, you will get the following response: <error>Failed: AllowedAffiliateIpFilter</error> b. Host root URL that makes request to LDS. If the root url is not white listed in our system , you will get the following response <error>Failed: AllowedReferrerFilter</error> Note: If you are using appid for authentication, you will not get the above error. If the appid is not valid, you will get the following response: <error>Invalid AppId </error> 2. How does LDS monitor clicks for advertisement? Local.com uses click.local.com as the click URL for all advertisements. Therefore, be sure to use the click.local.com URL for any monetization event. The click.local.com application detects the HTTP referrer and end user IP addresses via the HTTP header. Here are a few guidelines: Be sure to send HTTP referrer in your application as click.local.com needs HTTP referrer in HTTP header to validate the click. A click with empty HTTP referrer is filtered out. Do not throw out or hide the HTTP referrer. A network tool such as Fiddler is recommended to be used to check the HTTP referrer. The LDS search referrer and the click HTTP referrer must match. There is a referrer parameter in LDS. Referrer is root URL of site displaying the result. The LDS referrer parameter must match the root URL of the click HTTP referrer. The LDS search end user IP and the click end user IP must match. There is an IP parameter in LDS. The local.com click application detects the end user IP and that IP must match the LDS IP parameter.

The LDS click filter codes are as follows: ipDoesNotMatchSearch = 1 ReferrerDoesNotMatchSearch = 2 ExceededMaxClicksDay = 16 DoubleClick = 32

Page | 27

Vous aimerez peut-être aussi