fliptables / bcjs

0 stars 0 forks source link

BC Endpoint spec #8

Closed getnashty closed 9 years ago

getnashty commented 9 years ago

BC script needs to talk to croovies.

Currently using two endpoints, one for getting ratings, and one for posting ratings.

Posting: https://github.com/fliptables/bcjs/blob/master/bc/bctxtFull.js#L2448

Ex: http://www.bettercontext.com/api/user_ratings?site_id=&item_id=&user_id=&rating[]=

This one is pretty clear, the rating dimensions are sent in as an array - so the order matters. I assume its handled 1-5 on the backend but hopefully @mmichael0413 can verify that for me.

Getting: https://github.com/fliptables/bcjs/blob/master/bc/bctxtFull.js#L2730

Ex: http://www.bettercontext.com/api/item_ratings?site_id=1&user_id=1&items[]=1&items[]=2&items[]=3 https://gist.github.com/getnashty/6d332dcc011a62ddec26

The response sends back objects with the id being equal to the id sent in, filled w/ up to 10 properties (as seen in the gist, or if you try the link). the m1-m5 are average metrics (m stands for metrics), and if u1-u5 exist, those are the user ratings. If there are no "u" properties, then the item hasn't been rated by the user.

We called this item_ratings, rather than user_ratings, as we were using the same endpoint even if there was no user (i.e. if the person wasn't logged in and wanted to see the avg ratings). Items was obviously an array of item IDs we wanted scores for (average scores, and user scores).

mmichael0413 commented 9 years ago

You are correct that the order of the metrics absolutely matters. The order of the metrics' values for setting and getting UserRatings must always be the same. And as an FYI, the values are saved as 1-10 as floats.

treasonx commented 9 years ago

Okay hmm this seems totally reasonable. I don't really see any problem with this API at all.

Should we just continue using this API format? Are there any new use cases which wouldnt be covered by this 2 endpoints?

getnashty commented 9 years ago

That sounds good to me, if we need to add new endpoints we can deal with it then right?

Sent from my iPhone

On Mar 30, 2015, at 6:42 AM, James Morrin notifications@github.com wrote:

Okay hmm this seems totally reasonable. I don't really see any problem with this API at all.

Should we just continue using this API format? Are there any new use cases which wouldnt be covered by this 2 endpoints?

— Reply to this email directly or view it on GitHub https://github.com/fliptables/bcjs/issues/8#issuecomment-87631444.

treasonx commented 9 years ago

We can always add more!!