我需要Facebook的营销应用程序接口的帮助。我正在尝试创建一个使用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“部分,那就太好了。
另外,我不理解"Image hash“部分。请解释一下
谢谢。
发布于 2017-11-22 13:14:51
从docs
您将无法再创建或编辑未连接到有效页面的活动广告和链接广告。请求将返回错误: ErrorCode::ADPRO2__AD_MUST_HAVE_PAGE (1885833)
另外:
如果您在广告创意的object_story_id或object_story_spec字段
中提供了有效的and,您仍然可以创建活动广告和链接广告
https://stackoverflow.com/questions/47434625
复制相似问题