Post to Twitter timeline using REST Assured

Profile picture for user devraj

To Post a tweet on Twitter timeline follow below steps:

Step 1: Create a twitter account. Add your mobile number if not already added.

Step 2: Create your app on Twitter and generate keys and tokens. Follow steps here.

Step 3: Add following code

public class TwitterAPITest 
	String consumerKey = "s1lAvT5uU3fPLhzgI5m4cFBz8";
	String consumerSecret = "0QU8aC58Ypy0hJQIeqs4Y1PJwjWV2OffdthjJ55JZJvZaGccns";
	String accessToken = "1441253365-gAUOzD1QjLZg7CCKpKJ84j8HRuONiTSGi9r9mZn";
	String tokenSecret = "tM1y94Nx4rD9iQirOIL9xxuUlGOForSLK7xGzlpl4Oy2y";
	public void setup()
		RestAssured.baseURI = "";
		RestAssured.basePath = "/1.1/statuses";

    /*Post request example*/
	public void postExample()
            .oauth(consumerKey, consumerSecret, accessToken, tokenSecret)
            .queryParam("status", "REST Assured Automation Tweet.")