locked
Bing search API (Parameter has invalid value." "SearchRequest.AppId" 1002)

    Question

  • I am trying to access the Bing Search API using the following tutorial:
    http://msdn.microsoft.com/en-us/library/windows/apps/hh770849.aspx

    But i keep getting the error message returned from the bing search server:
    "Parameter has invalid value."
    "SearchRequest.AppId"
    1002

    I am using the AppID that i registered for under the URL:
    https://datamarket.azure.com/account/keys

    Am i doing something wrong here?

    Saturday, August 4, 2012 11:15 PM

Answers

All replies

  • Could someone please confirm this is the correct place to get the key
    Saturday, August 4, 2012 11:17 PM
  • From the tutorial you linked:
    For more information on how to obtain an app ID key, see the bing developer center.
    --Rob
    Sunday, August 5, 2012 7:38 PM
    Owner
  • I have the same issue I have got an account key - in the following format...

    5***aaa***Jagbhj***ags**E4ptRJa7SrHGKWSSo=

    so when I construct the URL as

    http://api.bing.net/xml.aspx?Appid=5***aaa***Jagbhj***ags**E4ptRJa7SrHGKWSSo=&query=sushi&sources=web

    why does this fail?? I also have got my account key from azure


    thanks stu
    • Edited by stummo Friday, October 5, 2012 12:10 AM
    Friday, October 5, 2012 12:08 AM
  • I'm having the same issue.  Tried every sort of variation, wondering if it's a server side issue at this point.

    So far I've tried: 

    1. Url encoding the appid, the appid shows up correctly in the error message
    2. Creating new appids through the My Account -> Account Keys
    3. Using urls mentioned elsewhere in the docs like "https://api.datamarket.azure.com/Data.ashx/Bing/Search/v1/Web"

    http://api.bing.net/json.aspx?Appid=...UkjfUNtKfdoHvTETySkuDFFk8djLRABjwIM%3D&sources=web&query=Qualcomm

    Where "..." is the first 8 characters of the id.

    • Edited by hrob2 Saturday, November 3, 2012 8:50 AM
    • Proposed as answer by hrob2 Saturday, November 3, 2012 3:58 PM
    • Unproposed as answer by hrob2 Saturday, November 3, 2012 3:58 PM
    Saturday, November 3, 2012 8:40 AM
  • Got it working in python, but not how I expected according to the original documentation.  Particularly strict on the case of the parameters and the single quotes around the query string:


    queryBingFor = "'" + q + "'" # the apostrophe's required as that is the format the API Url expects. 
    quoted_query = urllib.quote(queryBingFor)

    rootURL = "https://api.datamarket.azure.com/Bing/Search/"
    searchURL = rootURL + "Web?$format=json&$top=20&Query=" + quoted_query

    password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
    password_mgr.add_password(None, searchURL,username,accountKey)

    handler = urllib2.HTTPBasicAuthHandler(password_mgr)
    opener = urllib2.build_opener(handler)
    urllib2.install_opener(opener)
    r = urllib2.urlopen(searchURL).read()
    #print r.geturl()
    print r

    r = json.loads(r)

    • Proposed as answer by hrob2 Saturday, November 3, 2012 4:04 PM
    Saturday, November 3, 2012 4:03 PM