我需要Facebook营销API的帮助 . 我正在尝试使用Facebook Java API制作广告 . 我已将电子邮件存储在我的数据库中,我希望我的程序能够获取这些电子邮件ID并将其推送到自定义受众群体中 . 但我面临着“AdCreative”的一些问题 . 它有两个名为SetLinkUrl和SetObjectUrl的参数 . 我不明白在这些参数中传递什么 . 我尝试给链接页面我试图推广但它不起作用 .
对于AdCreative部分,这就是我正在做的事情 .
AdCreative creative = account.createAdCreative()
.setTitle("Java SDK Test Creative")
.setBody("Java SDK Test Creative")
//.setImageHash(imageFile.hashCode())
.setLinkUrl("xyz")
.setObjectUrl("xyz")
.execute();
在这里,xyz链接到我的Facebook页面 . 我收到了这个错误 .
com.facebook.ads.sdk.APIException$FailedRequestException: {"error":{"message":"Invalid parameter","type":"OAuthException","code":100,"error_subcode":1885833,"is_transient":false,"error_user_title":"Ad Must Be Associated With a Facebook Page","error_user_msg":"Ads and ad creatives must be associated with a Facebook Page. Try connecting your ad or ad creative to a Page and resubmit your ad.","fbtrace_id":"HGmvidCVerR"}}
at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:226)
at com.facebook.ads.sdk.APIRequest.access$1(APIRequest.java:203)
at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.sendPost(APIRequest.java:409)
at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.execute(APIRequest.java:335)
at com.facebook.ads.sdk.APIRequest.executeInternal(APIRequest.java:160)
at com.facebook.ads.sdk.AdAccount$APIRequestCreateAdCreative.execute(AdAccount.java:1848)
at com.facebook.ads.sdk.AdAccount$APIRequestCreateAdCreative.execute(AdAccount.java:1843)
at demo.BasicExample.main(BasicExample.java:149)
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/v2.11/act_103127053798775/adcreatives
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$10.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source)
at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:207)
... 7 more
Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/v2.11/act_103127053798775/adcreatives
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(Unknown Source)
at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:205)
... 7 more
我只是在某处读到Facebook不允许facebook域名链接减少垃圾邮件 . 所以我不明白该通过什么 . 请帮帮我 . 或者如果任何人都可以解释整个“AdCreative”部分,那就太棒了 .
另外,我不理解“图像哈希”部分 . 请解释
谢谢 .
1 回答
来自docs:
也: