How can i generate an API key for Baidu China for an website store locator?

15.2k views Asked by At

I have been asked by our developers to give them an API key for Baidu maps so they can set up our on site store locator and I'm not really sure how to go about doing this.

I tried to set up an account on Baidu but it asked for a chinese mobile number. Do I have to get one of these before I can get the key? And how easy is it to work out how to obtain the key once i've got an account?

Can anyone advise on the best way to set this up?

Thanks in advance!

2

There are 2 answers

7
peedee On

Update 2016: It now appears to be possible to use non-Chinese phone numbers to create Baidu accounts, see this page.

Once you're logged into Baidu you need to find their LBS (location-based services) cloud and go to the control center there:

http://lbsyun.baidu.com/apiconsole/key

There you click "Create a new app/key" 创建应用(0/20) (orange button). In the popup you give it a name and then in your case probably select "for server". The following list of checkboxes is for the things you want to BLOCK for your key. If you want access to everything then tick NOTHING (took me a while to figure that out, I always ticked everything...)

For server keys you can select an IP based whitelist for users, you would enter the addresses of your servers there. I'm not sure about the other (sn) option.

When you click Confirm the new key should appear in the table, copy & use it.

1
Dan Dascalescu On

Here's an easier answer than peedee's:

  1. If you can't read Chinese, install the Google Translate extension in Chrome (translate.google.com can't translate HTTPS pages). On each new page, you'll have to click the extension in the toolbar and choose "TRANSLATE THIS PAGE".
  2. Create an account at http://passport.baidu.com. You'll need a valid email address and a password.
  3. Set up a developer account at http://developer.baidu.com/user/reg. You'll need to verify a mobile phone number by typing in a code sent via SMS. A Google Voice worked for that. The format for US numbers is "(1)760-123-4567". You only have 60 seconds to enter the 6-digit code.
  4. Go to http://lbsyun.baidu.com/apiconsole/key.
  5. Click the "I agree" button.
  6. Choose "Browser" as the application type.
  7. Enter * in the Refer whitelist (unless you want to only allow certain domains to use the API)

That's it. You'll get an "Access application (AK)" key.