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

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!

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.

Here's an easier answer than peedee's:
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".
Create an account at http://passport.baidu.com. You'll need a valid email address and a password.
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.
Go to http://lbsyun.baidu.com/apiconsole/key.
Click the "I agree" button.
Choose "Browser" as the application type.
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.

Related

Where to find my Ocp-Apim-Subscription-Key in Windows azure

I want to use an api, but i can't find the Ocp-Apim-Subscription-Key at the page below:
Thanks.
You can find it by going to API Management services, then APIs. Select your API, your endpoint and then select the Test tab on the right hand side. Go down to Headers and against Ocp-Apim-Subscription-Key you will see it hidden; select the eye to see it.
please, following the instructions below.
You have to go through the azure portal and select your API
management component then click on the Publisher Portal in the
left top corner.
Go through the APIs and then Products tab.
Click on the ADD API TO PRODUCTS button and then select an
appropriate option.
Go through the azure portal again, but click on the Developer
Portal in the left top corner.
Click on the ComboBox which is placed on the right side and
choose Profile.
You will be able to see the access keys for the products and pick
the key for the product which you have chosen in the previous steps
(Starter or Unlimited).
Method 1:
From https://portal.azure.com/ go to your API Management service -> Subscriptions
There will find default ones and some created by your own.
Method 2:
Via https://resources.azure.com/ using HTTP GET method
az rest --method get `
--uri 'https://management.azure.com/subscriptions/{SUBSCRIPTION_ID}/resourceGroups/{RESOURCE_GROUP_NAME}/providers/Microsoft.ApiManagement/service/{API_MANAGER_NAME}/subscriptions?api-version=2018-01-01' `
--query "value[0].properties.primaryKey" | ConvertFrom-Json
Explanation:
Replace placeholders {SUBSCRIPTION_ID},{API_MANAGER_NAME},{RESOURCE_GROUP_NAME} by your own values
"value[0]. -> indicates the required key value: first,second in the list, because as you can see in the portal there are multiple for different scopes: Starter, Service access, Unlimited etc.
properties.primaryKey -> each value has 2 defined keys: primaryKey and secondaryKey
api-version=2018-01-01 -> check the right version, can be found from https://resources.azure.com/ or from ARM template for the API Manager resource
I found the subscription key here:
In the Azure portal, navigate to the "API Management service".
Go to "Subscriptions" under the "APIs"-heading.
Press "Add subscription".
Enter a "Name", select API as "Scope" then select your API under "API".
Press "Save". This will create a subscription for the selected API.
In the list of subscriptions, locate the subscription you just created, then press the "..."-button to the far right.
Press "Show/hide keys".
The subscription key is visible and can be copied from the "Primary key"-field.
Not sure where everyone is getting their answers from...
Maybe it's just old information, but at this time you can find them by doing the following:
Go to portal.azure.com
Select "Create a resource"
Create a resource. I'm using computer vision so I search for that and hit enter
Select "create"
Go to the newly created resource
On the left side panel under the "Resource Management" section select "Keys and Endpoint"
Key 1 and Key 2 are used as the "Ocp-Apim-Subscription-Key".
That's it. Those should work for you wherever it asks for the "Ocp-Apim-Subscription-Key".
This is how I found the keys
go to the resource
Click developer portal
Click the username on right-handhand side (for me it was "Administrator"). This will drop down a menu list
Click Profile
See a list of all keys. you can click the show link to view the keys and copy them
(August 2018) For our purposes (AI / ML) I found it under Cognitive Services > Resource Management > Keys - https://portal.azure.com/#blade/HubsExtension/Resources/resourceType/Microsoft.CognitiveServices%2Faccounts
It will be under other services though I can't say which (as you have to be using one to see the attributes of it).
It's also called the Programmatic Key. As of January 2018, if you log on to luis.ai, you can find it under settings (when you click on your name in the upper right hand corner).
Not sure why the LUIS Api documentations say the key is in azure and why there's a naming difference :/

Google I'm Feeling Lucky URL

So, I've spent about 2 hours trying to get the I'm Feeling Lucky URL to work. It seems the URL doesn't like the periods in the search parameter, so does anyone have any potential tricks?
Search Value= 40.840.1/8Z
The first result in a regular Google search is the correct page.
Here's what I've tried:
http://www.google.com/search?btnI=I&q=40.840.1/8Z
http://www.google.com/search?btnI=I&q=40.840.1%2F8Z
http://www.google.com/search?btnI=I&q=40%2E840%2E1/8Z
http://www.google.com/search?btnI=I&q=40%2E840%2E1%2F8Z
http://www.google.com/search?btnI=I&q=40%2F840%2F1%2F8Z
(That one was actually pretty close)
http://www.google.com/search?btnI=I&q=40%20840%201%208Z
And all of the above surrounded in quotes (%22)
The problem is that the I'm Feeling Lucky aspect doesn't work. It finds the correct results, it just doesn't navigate to the first result. I'm open to alternatives besides the I'm Feeling Lucky URL parameters as well.
I'm trying to implement this into a .NET application that provides employees with resource information, which is best received from the manufacturer's website(s). The trick is that the resources are from many different suppliers and the links need to be somewhat automatic. Basically I don't whomever manages the software to update these links. To navigate, I'm simply using the Process.Start("http://www.example.com/") command which uses the default browser to navigate to the address.
This post helped a lot by the way.
I wasn't able to get any closer than your closest one.
But if it helps, here's an alternative way of writing the "I'm feeling lucky" URL.
http://google.com/search?q=haimer+usa+40%2F840%2F1%2F8Z&btnI
What I did to find the right url is to navigate to google.com. After this I turned my internet connection off. I entered the search details and pressed submit. You can now see the url in the address bar, but it doesn't redirect you to the first result. You can now copy the url and see how google treats your dots and other weird characters.
So to recap:
Go to google.com
Turn your internet connection off
Enter search term
Press 'I'm feeling lucky'
Copy the url from the address bar
You can create a google custom search engine of your own, and either exclude certain sites or include specific sites only, use http://cse.google.com to do this.
There is a SO tag for google custom search

Google plus API - how to add "communities" as 'data-recipient'

I am trying to include a community as a recipient by using the Plus API and the 'data-recipients' property.
When I add the community ID, it shows "unknown user".
If I click manually, that is click on the IFrame, it allows me to see and choose the community I want to share the post with.
Any help on how to do so will be much appreciated.
thank-you.
I don't believe that this is supported. Communities are not users and the API does not support treating them as users even though in some cases they function similarly.
I tried testing this myself and I got a name unavailable value in the share dialog and it posted, but the share never displayed in the community.

Authenticate in Lotus Notes on localhost

This might sound a little complicated, but as I'm often working on my local databases in Lotus Notes I got the problem, that I can not authenticate. So I'm always working as Anonymous on my database.
The Problem is, that I can not test all functions, because for that I would need a valid Notesname.
How can I authenticate on localhost to work with my name/account and not as Anonymous?
You can not authenticate XPages/web applicatons using the local HTTP preview. You need to install a local server to do that (which is a good thing anyway for XPages development).
Try connecting to your machine using the fully qualified domain name, e.g. ^http://mymachine.mydomain.com instead of localhost
You can add yourself to your local address-book. And have it added to Database Security as Manager or whatever you want. That will help you to login using HTTP for local database.
I am looking to also do this, and I recalled a tip from searchdomino.com, the poster is Shawn Dezego
http://searchdomino.techtarget.com/tip/Testing-Authentication-Authorization-in-a-Web-App-Locally-WIthout-Running-a-Domino-Server
Here's the gist:
Just create any groups in your local address book and add your name to
the proper groups, roles etc. Then go to your Domains public address
book (Domino Directory), copy your person doc and paste it in your
local NAB. That's it.
This is the same basic tip as offered by the adjacent commenter. However, I think this may not work for Xpages apps, so I am loading a local server anyway.
Just create a person document in local NAB (names.nsf) and add HTTPpassword field with your password (hash it using #password("mypassword") formula) as text.
Make sure the person document contains the Fullname field, where you can put as test list your aliases. But Notes will use the first field entry as your name.
And remeber to set the first entry in canonical way (cn=user/ou=organization/o=domain)
Now you are ready to use this name in ACLs and names' (nested) groups.
I suggest to use hosts file to remap localhost with your site domain.
Enjoy!
(P.S. : You need to add anonymous entry in your db's ACL, and set it to editor access level. Once opened the application with browser, use the url command "&login" to force Notes to authenticate you)

How do you access browser history?

Some e-Marketing tools claim to choose which web page to display based on where you were before. That is, if you've been browsing truck sites and then go to Ford.com, your first page would be of the Ford Explorer.
I know you can get the immediate preceding page with HTTP_REFERRER, but how do you know where they were 6 sites ago?
Javascript this should get you started: http://www.dicabrio.com/javascript/steal-history.php
There are more nefarius means to: http://ha.ckers.org/blog/20070228/steal-browser-history-without-javascript/
Edit:I wanted to add that although this works it is a sleazy marketing teqnique and an invasion of privacy.
Unrelated but relevant, if you only want to look one page back and you can't get to the headers of a page, then document.referrer gives you the place a visitor came from.
You can't access the values for the entries in browser history (neither client side nor server side). All you can do is to send the browser back or forward a number of steps. The entries of the history are otherwise hidden from programmatic access.
Also note that HTTP_REFERER won't be there if the user typed the address in the URL bar instead of following a link to your page.
The browser history can't be directly accessed, but you can compare a list of sites with the user's history. This can be done because the browser attributes a different CSS style to a link that hasn't been visited and one that has.
Using this style difference you can change the content of you pages using pure CSS, but in general javascript is used. There is a good article here about using this trick to improve the user experience by displaying only the RSS aggregator or social bookmarking links that the user actually uses: http://www.niallkennedy.com/blog/2008/02/browser-history-sniff.html