Status Code 400 - request without authentication


#1

Hi!

I am having trouble with creating lists using twitter4j. Currently I have a sqlite database storing the list_id and an array of usernames to go into the list. However, “twitter.createUserListMembers(list_id, usernameArray);” isnt being executed because apparently the request has no authetication. My access token, consumer key and consumer secret are all correct. Can somebody please help?

This is my code. If you need any more relevant code please ask!

protected ArrayList doInBackground(String… args) {
Log.d(“Execution”, “doInBackground()”);

        try {

            ConfigurationBuilder builder = new ConfigurationBuilder();
            builder.setOAuthConsumerKey(consumerKey);
            builder.setOAuthConsumerSecret(consumerSecret);
            accessToken = new AccessToken(accessToke,
                    accessTokenSecret);

            twitter = new TwitterFactory(builder.build()).getInstance(accessToken);

            page = new Paging(1);
            cursor = -1;

            for (String log : usernameArray) {
                Log.v("Execution", "Array contents " + log);
            }

            Log.d("Execution", "Listid long is " + list_id);
            Log.d("Execution", "Initiate for loop 1");

            twitter.createUserListMembers(list_id, usernameArray);
            Log.d("Execution", "Initiate for loop 2");
            twitter.getUserListMembers(list_id, cursor);
            statuses = twitter.getUserListStatuses(list_id, page);
            for (twitter4j.Status status : statuses) {
                Log.d("Execution", "for loop is executing");
                HashMap<String, String> hm = new HashMap<String, String>();
                hm.put("from", status.getUser().getName());
                hm.put("to", status.getText());
                listData.add(hm);
            }

The error message -

05-03 18:07:08.124: E/TE(17412): Twitter Exception400:The request was invalid. An accompanying error message will explain why. This is the status code will be returned during version 1.0 rate limiting(https://dev.twitter.com/pages/rate-limiting). In API v1.1, a request without authentication is considered invalid and you will get this response.
05-03 18:07:08.124: E/TE(17412): message - Query parameters are missing.
05-03 18:07:08.124: E/TE(17412): code - 25
05-03 18:07:08.124: E/TE(17412): Relevant discussions can be found on the Internet at:
05-03 18:07:08.124: E/TE(17412): http://www.google.co.jp/search?q=a1c4ea64 or
05-03 18:07:08.124: E/TE(17412): http://www.google.co.jp/search?q=4fa314f3
05-03 18:07:08.124: E/TE(17412): TwitterException{exceptionCode=[a1c4ea64-4fa314f3], statusCode=400, message=Query parameters are missing., code=25, retryAfter=-1, rateLimitStatus=null, version=4.0.1}

Thank you!

Adam