How to use Baidu Cloud API

How to use Baidu Cloud API

There are many free APIs in Baidu Cloud. We register an account to obtain these API interfaces, but many people don’t know how to use them after buying them. Here I will introduce the usage of Baidu Cloud APIs.
Note: This article is used in the WeChat applet, and the usage methods of other languages ​​are almost the same.

First, register an account in Baidu Cloud, which is free of charge.

Open the API store page in the cloud market.
insert image description here
Select an API and purchase.
insert image description here
Take the weather forecast API as an example:
insert image description here
after the purchase is completed, the order can be found in the management console of the buyer center.
insert image description here
Or you can see this order in the cloud market.
insert image description here
Click Manage.
insert image description here
Here is the basic information
insert image description here
. There is an AppCode in the basic information, and you can see it by clicking Show Secret Key.

Then write the request in the applet. Configure our AppCode
insert image description here
insert image description here
shadow part in the request header (header) is the user's own AppCode

Then click to debug in the basic information of Baidu Cloud.
insert image description here

The call address on this page is the interface we can call directly.
insert image description here
We can also enter this page to debug, the headers are written in the same way.
insert image description here
This is how we call Baidu Cloud API. The same is true in node. After configuring our AppCode in the header, we can request smoothly.

Don't forget to open this configuration when using http requests, otherwise an error will be reported
insert image description here

Guess you like

Origin blog.csdn.net/m0_46496355/article/details/116177307