[twitter-dev] Re: PHP/cURL statuses/update results in 200 OK, but no actual update

2009-11-15 Thread Raffi Krikorian


i concur - until we are sending back an error code if your status  
update was rejected (for being a duplicate or for going over 140  
characters), option #1 seems like the most prudent want to go about  
this.



Twitter has stated that providing a clear indication of when this has
occurred (I don't recall whether it was stated whether it will be an
error code per se or not) is on the short list, but no ETA on a fix
has been given.

Until this is resolved, you basically have two options for trying to
detect it:

1) Keep track of the highest status ID you've encountered.  When a
status update is submitted, check the status ID in the response.  If  
the

update succeeded, the new ID will be higher than any old ID.  If it
failed, you'll get an older status (with an older, lower ID) instead.

2) Compare the text that you sent with the text you got back.  If
they're different, it failed - or Twitter did automatic URL shortening
or modified the text in some other manner.  If the new status is an
exact duplicate of the previous status, this would also falsely lead  
you

to believe that it had succeeded when it actually failed; depending on
your application, this may or may not be relevant.

Obviously, I consider method 1 to be the more reliable (although there
are certain race conditions in which it would fail, too), but it does
require you to keep that latest seen ID around and relatively
up-to-date.


--
Raffi Krikorian
Twitter Platform Team
ra...@twitter.com | @raffi






[twitter-dev] Re: PHP/cURL statuses/update results in 200 OK, but no actual update

2009-11-14 Thread Dave Sherohman

On Fri, Nov 13, 2009 at 01:56:40PM -0800, EvilJordan wrote:
 Very simple PHP/cURL script to update a status.
 
 With the curl output set to verbose, I see the connection being made
 and a response code of 200 OK.
 
 Unfortunately, my status isn't actually updating and I can't figure
 out why. The status message is urlencoded, basic authentication is
 successful, and using curl from the command line works just fine.

For the last month or so, Twitter has been silently rejecting status
updates which either exceed 140 characters or are duplicates of any
previous status for that user (not just the most recent).  When this
occurs, the response is a 200 OK and carries the user's most recent
successful status as its body.

You can easily avoid the silent failures for exceeding 140 characters by
double-checking the length of the text before sending it, but predicting
whether an update will fail due to duplication is not such a simple
task...

Twitter has stated that providing a clear indication of when this has
occurred (I don't recall whether it was stated whether it will be an
error code per se or not) is on the short list, but no ETA on a fix
has been given.

Until this is resolved, you basically have two options for trying to
detect it:

1) Keep track of the highest status ID you've encountered.  When a
status update is submitted, check the status ID in the response.  If the
update succeeded, the new ID will be higher than any old ID.  If it
failed, you'll get an older status (with an older, lower ID) instead.

2) Compare the text that you sent with the text you got back.  If
they're different, it failed - or Twitter did automatic URL shortening
or modified the text in some other manner.  If the new status is an
exact duplicate of the previous status, this would also falsely lead you
to believe that it had succeeded when it actually failed; depending on
your application, this may or may not be relevant.

Obviously, I consider method 1 to be the more reliable (although there
are certain race conditions in which it would fail, too), but it does
require you to keep that latest seen ID around and relatively
up-to-date.

-- 
Dave Sherohman