BlueMix URL Rating widget on WebSphere Commerce for product ratings

bluemix-ratings-wc

Ok, this is really just a teaser post as I will divulge the process used to get my Blue Mix URL rating widget into the WebSphere Commerce Composer framework a bit later.

I will say, now that the widget is in a real application I was able to test out some more use cases and fix a few bugs to make sure the widget is re-usable across a site. In this use case I am using it to rate products. I made a few changes to the NodeRED flow including adding more data saved for some future ideas I have. Here is the current block of data saved in the MongoDB for each rating received:

{
 "url": "http://mytestserver.com/webapp/wcs/stores/servlet/en/aurora1/electronics/tablets-10229--1/budget-tablet",
 "rating": 4,
 "host": "mytestserver.com",
 "cookie": "1406562990550",
 "date": "Wed, 30 Jul 2014 18:31:35 GMT",
 "_id": {
 "$oid": "53d93a07cb353621005aaadf"
 }
}

Notice I added “date“, “host” and “cookie” to the output. The date is actually filled in by the server for consistency and the cookie is a time stamp saved in the shopper browser for the page using HTML5 storage. I figure I will be able to use this data for reporting later and possibly as a WebSphere Commerce precision marketing action to get me a list of “top products” for a given domain.

The other change I had to make was to allow my service to respond with cross domain calls. I just put a little JavaScript between the post request and response nodes and added “Access-Control-Allow-Origin” to the call. I could probably isolate this to the specific domain eventually.

Cross Domain Setting

The next addition I made was if the browser already rated a product (cookie + URL) is already stored into the database send back a piece of data in the response of the “getRating” call to notify the browser to not let that person vote again. I really like how I can just connect nodes together conditionally and essentially introduce some complex decision making flows into the mix. Here you can see my decision “Check for cookie” and then ultimately append the flag in the “Check for already voted” function:

already voted logicHere is the Check for already voted function:

already voted code

Continue reading

URL Rating application on BlueMix – Part 2 – the user interface

starsThe next step in my Node-RED application on BlueMix is to create some user interface that calls the services I defined in my Node-RED flow sheet. If you recall from the last post, I created two services:

  • /postrating – which will post a rating for a given url
  • /rating – which retrieves the average rating for the url

For now, I will use the index.html to test the user interface. I want to make it dead simple for someone to use this in the end so the only need is to include the javascript file and define a div with an id of “urlRate”, like so:

[codesyntax lang=”html4strict”]

</div> </div>

[/codesyntax]

In this next video I create a basic jQuery user interface that allows the user to click on a star and register their rating for the given page. There are no checks and balances in the application as of yet – ie. I can click as many times as I want so I can test my services.

Continue reading

Creating a URL Rating Application in Node-RED on BlueMix – Part 1

starsThis is the first part of a new application I am creating using Node-RED on BlueMix. With very little programming, I show how you can get a basic URL rating application up and running very quickly using Node-RED. In this first part I focus on the two primary web services, posting a rating and getting a rating for a URL.

Continue reading

Today’s Bluemix Virtual Meetup Live On YouTube and Google+ starts in 5 minutes!

Originally from Ryan Baxters blog here.

You can watch today’s Bluemix Virtual Meetup on mobile cloud services live at 10 AM EST on YouTube.  There are 3 options for watching.

  1. Watch out on the YouTube page.
  2. Watch on the Google+ page.  If you watch on Google+ you will be able to ask questions.
  3. Watch right here

Top 10 most popular videos about IBM BlueMix

These are currently the most viewed videos on YouTube about the IBM BlueMix platform:

#10

#9

#8

#7

#6

#5

#4

#3

#2

#1

Node-RED boilerplate on #BlueMix now uses Cloudant NoSQL DB

Not sure if anyone noticed this but the Node-RED boilerplate application on BlueMix now uses the Cloudant NoSQL database service for storage. The beta version used Mongo:

CLOUDANT

Using the Eclipse client for editing BlueMix projects on Git Jazz Hub

In this tip of the day I show how easy it is to setup your IBM BlueMix and Jazz Hub project in the Eclipse client for editing. This will allow you to edit your project off-line and take advantage of the many plugins the Eclipse client has to offer.


Continue reading