facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
402 stars 332 forks source link

You are calling a deprecated version of the Ads API. Please update to the latest version,But I didn't find v12.0 in GitHub and mvnrepository #356

Closed wencaixu closed 1 year ago

wencaixu commented 3 years ago

Which SDK version are you using?

<!--facebook marketing api-->
<dependency>
    <groupId>com.facebook.business.sdk</groupId>
    <artifactId>facebook-java-business-sdk</artifactId>
    <version>[11.0.0,)</version>
</dependency>

What's the issue?

You are calling a deprecated version of the Ads API. Please update to the latest version,But I didn't find v12.0 in GitHub and mvnrepository

exception detail as following:

Steps/Sample code to reproduce the issue

String access_token = "xxxxxx";
String ad_account_id = "571478873974060";
String app_secret = "xxxxxx";
String page_id = "101385998969733";
String app_id = "xxxxx";
APIContext context = new APIContext(access_token).enableDebug(true);

Campaign campaign = new AdAccount(ad_account_id, context).createCampaign()
    .setName("My Campaign")
    .setBuyingType("AUCTION")
    .setObjective(Campaign.EnumObjective.VALUE_PAGE_LIKES)
    .setStatus(Campaign.EnumStatus.VALUE_PAUSED)
    .setSpecialAdCategories(Collections.singletonList(Campaign.EnumSpecialAdCategories.VALUE_NONE))
    .execute();  // issue reason

Observed Results:

Exception in thread "main" com.facebook.ads.sdk.APIException$FailedRequestException: {"error":{"message":"(#2635) You are calling a deprecated version of the Ads API. Please update to the latest version: v12.0.","type":"OAuthException","code":2635,"fbtrace_id":"A0gyETNO8NbYMjs1Ed3j0G1"}}
    at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:309)
    at com.facebook.ads.sdk.APIRequest.access$100(APIRequest.java:52)
    at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.sendPost(APIRequest.java:588)
    at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.execute(APIRequest.java:520)
    at com.facebook.ads.sdk.APIRequest.executeInternal(APIRequest.java:197)
    at com.facebook.ads.sdk.AdAccount$APIRequestCreateCampaign.execute(AdAccount.java:14738)
    at com.facebook.ads.sdk.AdAccount$APIRequestCreateCampaign.execute(AdAccount.java:14733)
    at com.metaapp.cloud.requests.service.facebook.SAMPLE_CODE.main(SAMPLE_CODE.java:25)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/v11.0/act_571478873974060/campaigns
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890)
    at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:290)
    ... 7 more
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/v11.0/act_571478873974060/campaigns
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
    at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
    at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:287)
    ... 7 more

Expected Results:

I hope to create it successfully and return to campaign

wencaixu commented 3 years ago

When I override platform version for test user,there only v12.0 can be chose.

Following is the image:

image

stale[bot] commented 2 years ago

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.