sprinklr-inc/twitter4j-ads

403:The request is understood, but it has been refused.

Closed this issue · 4 comments

HI I am getting below error while accessing using below code

try {
BaseAdsListResponseIterable allTwitterEntityStats = statApi.fetchStatsSync("938627011618263040", TwitterEntityType.CAMPAIGN, Lists.newArrayList("943794807771627521"), since, until, Boolean.TRUE, Granularity.TOTAL, TwitterAdObjective.VIDEO_VIEWS, Placement.ALL_ON_TWITTER);
for (BaseAdsListResponse allTwitterEntityStat : allTwitterEntityStats) {
twitterEntityStatsList.addAll(allTwitterEntityStat.getData());
}
System.out.println(twitterEntityStatsList.size());
}

Error-
403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
{"errors":[{"code":"NOT_FOUND","message":"Account 938627011618263040 was not found"}],"request":{"params":{}}}

Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=8e111100 or
http://www.google.co.jp/search?q=0634e189
TwitterException{exceptionCode=[8e111100-0634e189], statusCode=403, message=Account 938627011618263040 was not found, code=-1, retryAfter=-1, rateLimitStatus=RateLimitStatusJSONImpl{remaining=249, limit=250, resetTimeInSeconds=1519795510, secondsUntilReset=434}, version=2.0-SNAPSHOT, headers= {date=[Wed, 28 Feb 2018 05:10:10 GMT], null=[HTTP/1.1 403 Forbidden], server=[tsa_b], content-length=[132], x-response-time=[16], x-frame-options=[SAMEORIGIN], content-encoding=[gzip], x-rate-limit-reset=[1519795510], x-rate-limit-remaining=[249], x-rate-limit-limit=[250], x-transaction=[00d2aaad009b105f], strict-transport-security=[max-age=631138519], x-api-warn=[Warning: You're using a deprecated version of this API. Upgrade your API: https://developer.twitter.com/en/docs/ads/general/overview/versions.], set-cookie=[guest_id=v1%3A151979461084286506; Expires=Fri, 28 Feb 2020 05:10:10 UTC; Path=/; Domain=.twitter.com, personalization_id="v1_34jRrsISzeYPydy1+ZyzvA=="; Expires=Fri, 28 Feb 2020 05:10:10 UTC; Path=/; Domain=.twitter.com], x-xss-protection=[1; mode=block; report=https://twitter.com/i/xss_report], x-content-type-options=[nosniff], content-disposition=[attachment; filename=json.json], x-connection-hash=[a33c58efaba02aced9ccb360d93d3137], x-access-level=[read-write-directmessages], x-current-api-version=[3.0], x-runtime=[0.001025], x-api-version=[2.0], content-type=[application/json;charset=utf-8]}}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:186)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:62)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:81)
at twitter4j.TwitterAdsClient.get(TwitterAdsClient.java:278)
at twitter4j.TwitterAdsClient.executeHttpListRequest(TwitterAdsClient.java:83)
at twitter4j.TwitterAdsClient.executeHttpListRequest(TwitterAdsClient.java:76)
at twitter4j.impl.TwitterAdsStatApiImpl.fetchStatsSync(TwitterAdsStatApiImpl.java:75)
at com.sony.example.MediaView.main(MediaView.java:28)

My account has ADS API - DEVELOPER ACCESS

my goal is to get the total video views of an uploaded video in twitter .

any suggestion will be great help !!

The ad account id looks something like 18ce53vgfly (my ad account id)

If you open ads.twitter.com then you will see yours in the url.
The ad account id can be fetched from the adAccount JSON object too. Can pull up the documentation for you in case you need help.

Closed this issue as its not related to the SDK.