Why is the twitter API throwing this error? - java

The error message suggests that my "request was denied due to update limits". But this account hasn't tweeted anythin in the last 24 hours and it also says retryAfter=-1. I tried it with the current stable and the snapshot build of twitter4j but it didn't help. Does someone know what is wrong?
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).
message - Application cannot perform write actions. Contact Twitter Platform Operations through https://support.twitter.com/forms/platform
code - 261
Relevant discussions can be found on the Internet at:
http://www.google.co.jp/search?q=2fc5b7cb or
http://www.google.co.jp/search?q=0f38fea7
TwitterException{exceptionCode=[2fc5b7cb-0f38fea7], statusCode=403, message=Application cannot perform write actions. Contact Twitter Platform Operations through https://support.twitter.com/forms/platform, code=261, retryAfter=-1, rateLimitStatus=null, version=4.0.5-SNAPSHOT(build: bbbd24f6c492677f65d3956ed6b74a2ae75d5bc3)}
at twitter4j.HttpClientImpl.handleRequest(HttpClientImpl.java:164)
at twitter4j.HttpClientBase.request(HttpClientBase.java:57)
at twitter4j.HttpClientBase.post(HttpClientBase.java:86)
at twitter4j.TwitterImpl.post(TwitterImpl.java:1812)
at twitter4j.TwitterImpl.updateStatus(TwitterImpl.java:218)

Code 261 means the API-token was suspended. It takes only 10 minutes to appeal the suspension and get everything up and running again.

If the suspension isn't lifted (I appealed several times but it didn't), you could create a new standalone app (in the overview) and replace the consumer and access tokens with the new ones. It worked for me.

Related

Unknown Move Destination: STORESCP

I have just installed dcm4chee4-4.4.0.Beta1, following INSTALL.md instructions and everything works fine except movescu test.
When I run this test I can see an error in standalone/log/server.log (previously I launched in another console storescp -b11115). This is the error:
2015-09-13 12:48:49,105 INFO [org.dcm4che3.net.Association] (pool-6-thread-7) DCM4CHEE<-MOVESCU(7): processing 1:C-MOVE-RQ[pcid=1, prior=0
cuid=1.2.840.10008.5.1.4.1.2.2.2 - Study Root Query/Retrieve Information Model - MOVE
tsuid=1.2.840.10008.1.2 - Implicit VR Little Endian failed. Caused by: org.dcm4che3.net.service.DicomServiceException: Unknown Move Destination: STORESCP#localhost:11115
at org.dcm4chee.archive.retrieve.scp.CMoveSCP.calculateMatches(CMoveSCP.java:184) [dcm4chee-arc-retrieve-scp-4.4.0.Beta1.jar:]
I think this is because of configuration, maybe I have to add STORESCP as acceptedAET or similar, but I can find info on how to do it. I search through ldap using Apache Directory Studio, but I didn't find anything.
Thanks in advance.
Using dcm4che3, it goes like this if you're implementing an SCP and need to define which other SCPs are allowed to C-STORE things to you.
// Usual calamity creating Connection, ApplicationEntity and Device
...
ApplicationEntity ae = new ApplicationEntity("MYAETITLE");
String[] acceptedAETs = { "STORESCP", "GEPACS" }; // etc...
ae.setAcceptedCallingAETitles(acceptedAETs);
I assume that your favourite SCP (STORESCP) may need to know where to find the SCP known by MYAETITLE; identified by IP address and port. Typically you connect to an SCP as a SCU, issuing a C-MOVE (in the scenario laid out here) instructing the SCP to do a C-STORE to the AET identified in the C-MOVE.
I'm a bit confused by your choice of AE Title in your question (STORESCP) because that indicates that you kind of mix up the two SCPs involved here; the one receiving the C-MOVE (which should not be called STORESCP :) and the one implementing the C-STORE behaviour. The answer I gave above, is aimed at the SCP implementing the C-STORE behaviour.

GcsServiceImpl.createOrReplace Not working?

Summary
This happened since May 20th's night (Pacific Time). Initially, I thought it was Google Cloud Storage failure. It seems now that they supported my way of storing data before. But somehow, after May 20th, that API does not work the same way as before.
How did I call
GcsFileOptions fileOptions = new GcsFileOptions.Builder().mimeType("image/png").acl("public-read").build();
GcsFilename filename = new GcsFilename(fileBucket, objectName); // fileBucket="test", objectName="/code/my/yeuei"
GcsService service = GcsServiceFactory.createGcsService();
GcsOutputChannel oc = service.createOrReplace(filename,fileOptions); //error happens here.
Error
Google Cloud Storage API gives error when the object is not existing.
GcsServiceImpl.createOrReplace method
I am creating a new object.
E 10:03:00.643 com.sun.jersey.spi.container.ContainerResponse mapMappableContainerException: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
com.google.appengine.tools.cloudstorage.NonRetriableException: java.lang.NullPointerException
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:120)
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:166)
at com.google.appengine.tools.cloudstorage.RetryHelper.runWithRetries(RetryHelper.java:156)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl.createOrReplace(GcsServiceImpl.java:68)
This line seems causing the error -
Caused by: java.lang.NullPointerException
at com.google.appengine.tools.cloudstorage.oauth.URLFetchUtils$HTTPRequestInfo.<init>(URLFetchUtils.java:80)
at com.google.appengine.tools.cloudstorage.oauth.OauthRawGcsService.beginObjectCreation(OauthRawGcsService.java:184)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:71)
at com.google.appengine.tools.cloudstorage.GcsServiceImpl$1.call(GcsServiceImpl.java:68)
at com.google.appengine.tools.cloudstorage.RetryHelper.doRetry(RetryHelper.java:108)
Nothing on the status page. You might wish to check it in the future.
Ok. This is resolved. I am still not sure how it is introduced in the first place.
Here is what happens -
There is a class URLFetchUtils in App Engine GCS Client library, when it initiates, it did not check if payload is null, that creates the NullPointer exception. Today, GCS Java Client Library has an update fixed this issue, so if you use the latest version (app engine GCS 0.3.12), this error will go away. Interestingly, I have no idea how it worked before :) ... But anyway, I am glad that my app is working again - after about 24 hours down.

How to handle Delivery Status Notification of GMail

Does gmail support RFC1892(Delivery Status Notification) ?
If so, how can I use JavaMail to parse the DSN. (Sample code is highly appreciated)
If not, When a email can't be delivered through gmail, a failure message is returned. How can I detect these "bounced" messages?
1 - I don't know.
2 - Add dsn.jar from JavaMail to your classpath. Then use something like this:
if (msg.isMimeType("multipart/report")) {
MultipartReport r = (MultipartReport)msg.getContent();
// see com.sun.mail.dsn package javadocs for MutlipartReport
}
3 - http://www.oracle.com/technetwork/java/javamail/faq/index.html#bounce
Related to this question.
The X-Failed-Recipients header seems to be the quickest way to identify gmail DSN. After that, it seems you must parse the text/plain content.
The subject seems to be Delivery Status Notification (*status*) where statuses that I've seen are: Failure, Delay.

Unexpected error when publishing photo to page

I'm trying to publish a photo to a page using the following:
FacebookClient client = new DefaultFacebookClient(destinationAccessToken);
BinaryAttachment attachment = BinaryAttachment.with(imageName, imageInputStream);
Photo photoResponse = client.publish("/me/photos", Photo.class, attachment);
I'm getting the following response:
{
"error": {
"message":"An unexpected error has occurred. Please retry your request later.",
"type":"OAuthException",
"code":2
}
}
When I use the same code to publish to a user wall it works fine.
I've also tried posting to "/{page id}/photos" with the same result.
The destination access token has the manage_pages, photo_upload, publish_actions, and publish_stream permissions amongst others.
What am I doing wrong here?
UPDATE:
If I publish to a predetermined album using "/{album id}/photos" then it works. Quoting this Facebook developer blog post:
https://graph.facebook.com/USER_ID/photos - The photo will be
published to an album created for your app. We automatically create an
album for your app if it does not already exist. All photos uploaded
this way will then be added to this same album.
So is this behavior broken for pages? Or am I misunderstanding something here?
UPDATE 2:
I found a bug report for this issue, so I'm posting that as an answer.
UPDATE 3:
The bug seems to have been resolved.
I found the Facebook bug report corresponding to this behavior:
http://developers.facebook.com/bugs/355536551171535
So it would seem I'm not doing anything wrong. I guess the temporary workaround would be to check for a predetermined album and create it if necessary, then publish to it. (Note that the user_photos permission is not needed for this workaround, since albums/photos on pages are always public).

Twiiter4J getDirectMessages() does not work anymore?

I am using Twitter4J 2.2.5 (latest, tried other versions). And can no longer get direct messages to work at all. The same code used to work a while ago. I assume Twitter changed something.
I'm using
Twitter.getDirectMessages()
and it gives the error below. No idea why, I can see the direct messages for the account if I login, but always get this error. The limit error makes no sense, as the account is no where near the limit.
Other API work, like followers/fried/status/etc.
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 (http://support.twitter.com/forums/10711/entries/15364).
Relevant discussions can be on the Internet at:
http://www.google.co.jp/search?q=00919618 or
http://www.google.co.jp/search?q=332bf6ca
TwitterException{exceptionCode=[00919618-332bf6ca], statusCode=403, retryAfter=0, rateLimitStatus=RateLimitStatusJSONImpl{remainingHits=107, hourlyLimit=350, resetTimeInSeconds=1328297, secondsUntilReset=1116, resetTime=Fri Feb 03 14:39:45 EST 2012}, version=2.2.2}
at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:189)
at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:93)
at twitter4j.TwitterImpl.get(TwitterImpl.java:1721)
at twitter4j.TwitterImpl.getDirectMessages(TwitterImpl.java:874)
at org.pandora.sense.twitter.TwitterDirectMessaging.checkDirectMessages(TwitterDirectMessaging.java:44)
at org.pandora.sense.twitter.TwitterDirectMessaging.checkProfile(TwitterDirectMessaging.java:35)
at org.pandora.sense.twitter.Twitter$1.run(Twitter.java:100)
at java.lang.Thread.run(Thread.java:662)
Twitter has some time ago changed the rules for direct messages. An app must be especially authorized by the user to access the direct messages.
Did you make sure this is true for you? You may go to the twitter web site and check for the app.
To get the direct message you should try the below code.It works for me.
getDirectMessages(); gives list of direct messages. We need to put for loop to get text of each message.
List<DirectMessage> messages = twitter.getDirectMessages();
for (DirectMessage message : messages)
{
System.out.println(message.getText());
}
Let me know if you get any error.

Categories

Resources