Académique Documents
Professionnel Documents
Culture Documents
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
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
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]
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
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
Version | 3.3
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.
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
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).
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
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
&maxresults=10
Page | 8
Version | 3.3
pagestart
&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
Version | 3.3
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
Version | 3.3
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
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
Version | 3.3
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>
Version | 3.3
Page | 15
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
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>
<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.
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.
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" />
Input Parameters:
Page | 19
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
Version | 3.3
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
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
Version | 3.3
try {
Page | 23
Version | 3.3
Page | 24
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
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'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
Version | 3.3
The LDS click filter codes are as follows: ipDoesNotMatchSearch = 1 ReferrerDoesNotMatchSearch = 2 ExceededMaxClicksDay = 16 DoubleClick = 32
Page | 27