Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
jp.co.yahoo.api-ads:ads-search-api-lib
Advanced tools
Yahoo! JAPAN Ads Search Ads API library for Java
このライブラリは、Javaを使用して各APIを呼び出すクライアントが含まれています。
pom.xmlに下記の記述をしてください。
...
<dependency>
<groupId>jp.co.yahoo.api-ads</groupId>
<artifactId>ads-search-api-lib</artifactId>
<version>x.y.z</version>
</dependency>
...
versionはこちらを参照してください。https://mvnrepository.com/artifact/jp.co.yahoo.api-ads/ads-search-api-lib
クライアントID、クライアントシークレット、リフレッシュトークンを指定してクライアントを作成します。
String clientId = "INSERT_CLIENT_ID_HERE";
String clientSecret = "INSERT_CLIENT_SECRET_HERE";
String refreshToken = "INSERT_REFRESH_TOKEN_HERE";
YahooJapanAdsApiClient yahooJapanAdsApiClient = new YahooJapanAdsApiClient(clientId, clientSecret, refreshToken);
それぞれの値はこちらを参照してください。https://ads-developers.yahoo.co.jp/ja/ads-api/startup-guide/api-call.html
// Get the AccountService.
AccountServiceApi accountService = new AccountServiceApi(yahooJapanAdsApiClient);
// Create the AccountServiceSelector.
AccountServiceSelector accountServiceSelector = new AccountServiceSelector();
// Get the account.
AccountServiceGetResponse accountServiceGetResponse = accountService.accountServiceGetPost(accountServiceSelector);
// Get the ReportDefinitionService.
ReportDefinitionServiceApi reportDefinitionService = new ReportDefinitionServiceApi(yahooJapanAdsApiClient);
// Create the ReportDefinitionServiceOperation.
ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setReportName("INSERT_REPORT_NAME_HERE");
reportDefinition.setReportType(ReportDefinitionServiceReportType.ACCOUNT);
reportDefinition.setReportDateRangeType(ReportDefinitionServiceReportDateRangeType.LAST_7_DAYS);
reportDefinition.addFieldsItem("ACCOUNT_ID");
reportDefinition.addFieldsItem("ACCOUNT_NAME");
ReportDefinitionServiceOperation reportDefinitionServiceOperation = new ReportDefinitionServiceOperation();
reportDefinitionServiceOperation.setAccountId(INSERT_ACCOUNT_ID_HERE);
reportDefinitionServiceOperation.addOperandItem(reportDefinition);
// Create the Report.
ReportDefinitionServiceMutateResponse reportDefinitionServiceMutateResponse = reportDefinitionService.reportDefinitionServiceAddPost(reportDefinitionServiceOperation);
// Wait for the report to be completed.
// Create the ReportDefinitionServiceDownloadSelector.
Long reportJobId = reportDefinitionServiceMutateResponse.getRval().getValues().get(0).getReportDefinition().getReportJobId();
ReportDefinitionServiceDownloadSelector reportDefinitionServiceDownloadSelector = new ReportDefinitionServiceDownloadSelector();
reportDefinitionServiceDownloadSelector.setAccountId(INSERT_ACCOUNT_ID_HERE);
reportDefinitionServiceDownloadSelector.setReportJobId(reportJobId);
// Get the report.
Resource report = reportDefinitionService.reportDefinitionServiceDownloadPost(reportDefinitionServiceDownloadSelector);
// Get the OfflineConversionService.
OfflineConversionServiceApi offlineConversionService = new OfflineConversionServiceApi(yahooJapanAdsApiClient);
// Create the Parameter of OfflineConversionService.
Long accountId = INSERT_ACCOUNT_ID_HERE;
OfflineConversionServiceUploadType uploadType = OfflineConversionServiceUploadType.NEW; // Specify the uploadType.
String uploadFileName = "INSERT_UPLOAD_FILE_NAME_HERE";
// Create the Request body of OfflineConversionService.
Resource file = new FileSystemResource("/path/to/offlineConversion.csv");
// Upload the offlineConversion
OfflineConversionServiceUploadResponse offlineConversionServiceUploadResponse = offlineConversionService.offlineConversionServiceUploadPost(accountId, uploadType, uploadFileName, file);
アクセストークン更新時のコール単位でリトライの設定を
デフォルトから変更するにはシステムプロパティを使用します。
System.setProperty("jp.co.yahoo.adssearchapi.oauth2.retry.max_attempts", "3");
System.setProperty("jp.co.yahoo.adssearchapi.oauth2.retry.initial_interval", "1000");
System.setProperty("jp.co.yahoo.adssearchapi.oauth2.retry.multiplier", "2");
System.setProperty("jp.co.yahoo.adssearchapi.oauth2.retry.max_interval", "2000");
リトライをしない場合は下記のように設定します。
System.setProperty("jp.co.yahoo.adssearchapi.oauth2.retry.max_attempts", "1");
Yahoo! JAPANの提供するAPIに関するライブラリは、別途Yahoo! JAPANとの間で締結いただいた当該APIの提供に関する契約に基づき、APIユーザー様に提供されるものであり、Yahoo! JAPANとの間で当該契約を締結いただいていない場合は、ライブラリをご利用いただけません。
また、APIユーザー様に予め通知することなく、ライブラリの内容や仕様の変更または提供の停止もしくは中止をする場合があります。ご了承のうえご利用ください。
FAQs
Yahoo! JAPAN Ads Search Ads API library for Java
We found that jp.co.yahoo.api-ads:ads-search-api-lib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.