'Twitter API - 403 Forbidden Error

I have a very simple snippet of code which was working till yesterday and has stopped working today?

var url = 'http://search.twitter.com/search.json?q=dogs?callback=?';
var reddit = 'http://reddit.com/r/technology.json?callback=?';

$.getJSON(url, function(data) { 
    console.log(data);
});

//Error - GET http://search.twitter.com/search.json?q=dogs?callback=jQuery172082220473815687_1365829251904&_=1365829251949 403 (Forbidden) 

Here is the source - http://jsfiddle.net/ZeuKp/2

Can anyone tell why am I getting a 403 error. Have I exceed the rate on the API, which seems highly unlikely as I just switched on my local server?

Thanks!



Solution 1:[1]

I have solved this issue by reducing the message characters length to 140. as defined here https://dev.twitter.com/overview/api/counting-characters.

Also you can check errrorCode and errorMessage by casting TwitterException into TwitterApiException.

 statusesService.update(newMessage, null, null, null,
                null, null, null, null, null, new Callback<Tweet>() {
                   @Override
                    public void success(Result<Tweet> result) {
                        Debugger.i("success", result.toString());
                    }
                 @Override
                    public void failure(TwitterException e) {
                        TwitterApiException twitterApiException = (TwitterApiException) e;
                       Debugger.e("failure", "getErrorCode() : " + twitterApiException.getErrorCode());
                        Debugger.e("failure", "getErrorMessage() : " + twitterApiException.getErrorMessage());
                    }
                });

Solution 2:[2]

One more point. In case if you're using the API v1, for example like this library https://github.com/twitter/hbc is used to access the stream API (https://stream.twitter.com).

Your project needs to have Elevated access and you need to apply for it because initially, it has only Essential access. The application is free.

You can check here if your project has the Elevated access https://developer.twitter.com/en/portal/products/elevated

Solution 3:[3]

Very very very important: You need to apply for the "Elevated" access in your twitter dev account.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ahsan Javed
Solution 2 Max
Solution 3 psv