close
The Wayback Machine - https://web.archive.org/web/20130508081440/https://dev.twitter.com/issues/383

Issue #383: lists/members/create_all returns 404 if any user_id is invalid

I am trying to add many users to Twitter lists programmatically. The program works by retrieving the user_ids of all of the people a Twitter user is following and then adding those people to list. For whatever reason, culling those user_ids ocassionally returns non-existent or suspended users. When my script takes the list of user_ids and attempts to add them to lists with lists/members/create_all (100 at a time), Twitter's API chokes if any of those bogus user_ids appear in the request, returning a 404. This is the only REST endpoint I know of that fails on the entire request if any parameter is bad.

Unfortunately, I have no way of knowing which of the user_ids is bad unless I run users/lookup for all of them. (This is expensive; it requires dozens of additional Twitter API queries.) users/lookup does NOT choke on bogus user_ids but simply returns no data in those cases (desired behavior). For example, if you do users/lookup on 20 user_ids and 1 of those is bogus, users/lookup simply returns 19 results. I can capture this data into an array and then compare it with my original array of user_ids. Again, doable but expensive.

This seems to be a bug. If lists/members/create_all receives multiple user IDs and any of them are bogus, the API should proceed to add the good user_ids and gracefully ignore the bad ones.

Thanks.