Learn more about Twitter data with this insight from IBM Bluemix.
The docs explain how the API works including the query language. In general, it is pretty simple, but the best news is that you can skip getting results and just use the count method instead. That means I can easily get sentiment analysis with 4 API calls (one for each sentiment). As an aside, I ended up not displaying all four sentiments in my charts, but the back end code still fetches them all.
The code in the forEach there is handling applying each HTTP result to a proper location in my main result object. Generally, your array of results will match how they were applied to the array, but as I’m using 5 forEach statements for my reports, I can’t know for sure the order they will be added to the array. Kind of complex, but that’s all nicely hidden away in my library. Back in the main Node.js route that handles all of this, it is rather simple.