diff --git a/java/README.md b/java/README.md
index 7b1677d94..3c991ac04 100644
--- a/java/README.md
+++ b/java/README.md
@@ -15,7 +15,7 @@
### 源码构建
```shell
-mvn clean install
+sh build.sh
```
### maven使用
@@ -29,7 +29,7 @@ mvn clean install
${version}
```
-最新版本![Maven](https://img.shields.io/maven-central/v/com.baidu.dev2/baiduads-sdk.svg)
+备注:请在Maven仓库上找最新的版本。
## 使用方式
@@ -42,8 +42,14 @@ mvn clean install
* API tests for AccountService
*/
public class AccountServiceTest {
-
- private final AccountService api = new AccountService();
+
+ private static String appId = "{appId}";
+
+ private static Long userId = 0L; // {userId}
+
+ private static String authCode = "{authCode}";
+
+ private static String secretKey = "{secretKey}";
/**
* @throws ApiException
@@ -51,27 +57,39 @@ public class AccountServiceTest {
*/
@Test
public void getAccountInfoTest() throws ApiException {
- // init header
+ // get accessToken
+ OAuthService oAuthService = new OAuthService();
+ GetAccessTokenRequest request = new GetAccessTokenRequest();
+ request.setAppId(appId);
+ request.setUserId(userId);
+ request.setAuthCode(authCode);
+ request.setSecretKey(secretKey);
+ GetAccessTokenResponse response = oAuthService.getAccessToken(request);
+ String accessToken = response.getData().getAccessToken();
+
+ // init service
+ AccountService accountService = new AccountService();
+ // init request header
ApiRequestHeader requestHeader = new ApiRequestHeader();
- requestHeader.setUsername("********");
- requestHeader.setPassword("********");
- requestHeader.setToken("****************");
-
- // init request body
- ApiAccountQueryRequest request = new ApiAccountQueryRequest();
- List accountFields = new ArrayList<>();
- accountFields.add("pictureOptimizeSegmentStatus");
- request.setAccountFields(accountFields);
-
- // init request wrapper
+ // set oauth info
+ requestHeader.setUserName("{userName}");
+ requestHeader.setAccessToken(accessToken);
+
+ // init request
+ ApiAccountQueryRequest queryRequest = new ApiAccountQueryRequest();
+ ArrayList fields = new ArrayList<>();
+ fields.add("pictureOptimizeSegmentStatus");
+ fields.add("balance");
+ fields.add("userLevel");
+ queryRequest.setAccountFields(fields);
+
+ // init requster wrapper
GetAccountInfoRequestWrapper requestWrapper = new GetAccountInfoRequestWrapper();
requestWrapper.setHeader(requestHeader);
- requestWrapper.setBody(request);
-
-
- GetAccountInfoResponseWrapper response = api.getAccountInfo(requestWrapper);
+ requestWrapper.setBody(queryRequest);
- Assert.assertTrue(response.getHeader().getStatus() == 0);
+ GetAccountInfoResponseWrapper responseWrapper = accountService.getAccountInfo(requestWrapper);
+ Assert.assertTrue(responseWrapper.getHeader().getStatus() == 0);
}
}
@@ -86,10 +104,10 @@ public class AccountServiceTest {
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
-*CampaignFeedService* | [**addCampaignFeed**](docs/CampaignFeedService.md#addCampaignFeed) | **POST** /json/feed/v1/CampaignFeedService/addCampaignFeed |
-*CampaignFeedService* | [**deleteCampaignFeed**](docs/CampaignFeedService.md#deleteCampaignFeed) | **POST** /json/feed/v1/CampaignFeedService/deleteCampaignFeed |
-*CampaignFeedService* | [**getCampaignFeed**](docs/CampaignFeedService.md#getCampaignFeed) | **POST** /json/feed/v1/CampaignFeedService/getCampaignFeed |
-*CampaignFeedService* | [**updateCampaignFeed**](docs/CampaignFeedService.md#updateCampaignFeed) | **POST** /json/feed/v1/CampaignFeedService/updateCampaignFeed |
+*CampaignFeedService* | [**addCampaignFeed**](docs/CampaignFeedService.md#addCampaignFeed) | **POST** /json/feed/v1/CampaignFeedService/addCampaignFeed |
+*CampaignFeedService* | [**deleteCampaignFeed**](docs/CampaignFeedService.md#deleteCampaignFeed) | **POST** /json/feed/v1/CampaignFeedService/deleteCampaignFeed |
+*CampaignFeedService* | [**getCampaignFeed**](docs/CampaignFeedService.md#getCampaignFeed) | **POST** /json/feed/v1/CampaignFeedService/getCampaignFeed |
+*CampaignFeedService* | [**updateCampaignFeed**](docs/CampaignFeedService.md#updateCampaignFeed) | **POST** /json/feed/v1/CampaignFeedService/updateCampaignFeed |
## 讨论
diff --git a/java/baiduads-sdk-samples/src/main/java/com/baidu/dev2/api/samples/feed/CreateFeedAd.java b/java/baiduads-sdk-samples/src/main/java/com/baidu/dev2/api/samples/feed/CreateFeedAd.java
index 0583e8a1c..22f0d641d 100644
--- a/java/baiduads-sdk-samples/src/main/java/com/baidu/dev2/api/samples/feed/CreateFeedAd.java
+++ b/java/baiduads-sdk-samples/src/main/java/com/baidu/dev2/api/samples/feed/CreateFeedAd.java
@@ -36,9 +36,8 @@ public class CreateFeedAd {
static {
header = new ApiRequestHeader();
- header.setPassword("xxxxx");
- header.setUsername("xxxxx");
- header.setToken("xxxxx");
+ header.setAccessToken("xxxxx"); // accessToken需要通过授权环节生成
+ header.setUserName("xxxxx"); // 替换成自己的用户名
}
/**
diff --git a/java/baiduads-sdk-samples/src/main/java/com/baidu/dev2/api/samples/search/CreateSearchAd.java b/java/baiduads-sdk-samples/src/main/java/com/baidu/dev2/api/samples/search/CreateSearchAd.java
index 7aa84913f..c85040ef0 100644
--- a/java/baiduads-sdk-samples/src/main/java/com/baidu/dev2/api/samples/search/CreateSearchAd.java
+++ b/java/baiduads-sdk-samples/src/main/java/com/baidu/dev2/api/samples/search/CreateSearchAd.java
@@ -42,9 +42,8 @@ public class CreateSearchAd {
static {
header = new ApiRequestHeader();
- header.setPassword("xxxxx");
- header.setUsername("xxxxx");
- header.setToken("xxxxx");
+ header.setAccessToken("xxxxx"); // accessToken需要通过授权环节生成
+ header.setUserName("xxxxx"); // 替换成自己的用户名
}
/**
diff --git a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/account/GetAccountInfo.java b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/account/GetAccountInfo.java
index 0c5d78527..08983ccbe 100644
--- a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/account/GetAccountInfo.java
+++ b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/account/GetAccountInfo.java
@@ -26,9 +26,8 @@ public static void main(String[] args) {
// init requset header
ApiRequestHeader requestHeader = new ApiRequestHeader();
- requestHeader.setToken("xxxxx"); // 替换为自己的token
- requestHeader.setUsername("xxxxx"); // 替换为自己的用户名
- requestHeader.setPassword("xxxxx"); // 替换为自己的密码
+ requestHeader.setAccessToken("xxxxx"); // 替换为授权生成的accessToken
+ requestHeader.setUserName("xxxxx"); // 替换为自己的用户名
// init requset
ApiAccountQueryRequest request = new ApiAccountQueryRequest();
diff --git a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/balance/BalanceServiceTest.java b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/balance/BalanceServiceTest.java
index 73d681e2b..8807131be 100644
--- a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/balance/BalanceServiceTest.java
+++ b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/balance/BalanceServiceTest.java
@@ -21,9 +21,8 @@ public class BalanceServiceTest {
public void before() {
balanceService = new BalanceService();
header = new ApiRequestHeader();
- header.setUsername("xxxxx"); // 替换为自己的用户名
- header.setPassword("xxxxx"); // 替换为自己的密码
- header.setToken("xxxxx"); // 替换为自己的token
+ header.setAccessToken("xxxxx"); // 替换为授权生成的accessToken
+ header.setUserName("xxxxx"); // 替换为自己的用户名
}
@Test
diff --git a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/marketingfile/MarketingFileServiceTest.java b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/marketingfile/MarketingFileServiceTest.java
index 4b965e0a5..8e0e3830e 100644
--- a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/marketingfile/MarketingFileServiceTest.java
+++ b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/marketingfile/MarketingFileServiceTest.java
@@ -23,10 +23,8 @@ public void before() {
service = new MarketingFileService();
header = new ApiRequestHeader();
// 请填写自己的信息
- header.setToken("xxxxx");
- header.setUsername("xxxxx");
- header.setPassword("xxxxx");
- header.setTarget("xxxxx");
+ header.setAccessToken("xxxxx"); // 替换为授权生成的accessToken
+ header.setUserName("xxxxx"); // 替换为自己的用户名
}
/***
diff --git a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/payment/PaymentServiceTest.java b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/payment/PaymentServiceTest.java
index 799324131..af55d2a6a 100644
--- a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/payment/PaymentServiceTest.java
+++ b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/payment/PaymentServiceTest.java
@@ -28,9 +28,8 @@ public class PaymentServiceTest {
public void before() {
paymentService = new PaymentService();
header = new ApiRequestHeader();
- header.setUsername("xxxxx"); // 替换为自己的用户名
- header.setPassword("xxxxx"); // 替换为自己的密码
- header.setToken("xxxxx"); // 替换为自己的token
+ header.setAccessToken("xxxxx"); // 替换为授权生成的accessToken
+ header.setUserName("xxxxx"); // 替换为自己的用户名
}
@Test
diff --git a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/videoupload/VideoUploadServiceTest.java b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/videoupload/VideoUploadServiceTest.java
index c3a603482..dc8ebdbbe 100644
--- a/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/videoupload/VideoUploadServiceTest.java
+++ b/java/baiduads-sdk/src/test/com/baidu/dev2/api/sdk/videoupload/VideoUploadServiceTest.java
@@ -24,10 +24,8 @@ public void before() {
service = new VideoUploadService();
header = new ApiRequestHeader();
// 请填写自己的信息
- header.setToken("xxxxx");
- header.setUsername("xxxxx");
- header.setPassword("xxxxx");
- header.setTarget("xxxxx");
+ header.setAccessToken("xxxxx"); // 替换为授权生成的accessToken
+ header.setUserName("xxxxx"); // 替换为自己的用户名
}
@Test
diff --git a/java/build.sh b/java/build.sh
old mode 100644
new mode 100755
diff --git a/java/cmc.sh b/java/cmc.sh
old mode 100644
new mode 100755
diff --git a/java/postBuild.sh b/java/postBuild.sh
old mode 100644
new mode 100755
diff --git a/python/baiduads-sdk-auto/docs/KeywordType.md b/python/baiduads-sdk-auto/docs/KeywordType.md
index 499983a90..06ad34524 100644
--- a/python/baiduads-sdk-auto/docs/KeywordType.md
+++ b/python/baiduads-sdk-auto/docs/KeywordType.md
@@ -53,7 +53,6 @@ Name | Type | Description | Notes
**top_page_views** | **int** | | [optional]
**top_p_clicks** | **int** | | [optional]
**campaign_bid_type** | **int** | | [optional]
-**es_conversion** | **float** | | [optional]
**any string name** | **bool, date, datetime, dict, float, int, list, str, none_type** | any string name can be used but the value must be the correct type | [optional]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)