Author Topic: Data feed suggestions  (Read 8321 times)

Keen

  • Elite Boss
  • *****
  • Posts: 370
Data feed suggestions
« on: February 09, 2011, 11:05:40 AM »
Hello all,

I've been using Sentinel this month and liking it so far, mostly because it's lightweight and do not impact my game experience (unlike HeroStats).

One of the features I like most is the character feed. I have a personal blog where I have a Javascript snippet with my character data, updating it manually after every game session. I figured I could use CIT's feed for this, but there are a few things that keep me from it:

  • The data is shown "as is", meaning you can not just insert it in your page using a <script> tag. Including it via Ajax is not possible due to the "same domain policy" on Ajax requests. The only way to add it to your page is to use a server-side language (such as PHP) as a proxy, since the same-domain policy does not apply to them.
  • The character list on the page can be sorted, but that sorting is not applied to the feed.
  • Alignment tracking is not complete yet, it only tracks "Hero" and "Villain", and I have all alignments (including Praetorian ones) listed in my snippet.

For the first item, I suggest a way to convert the JSON feed into a script, not just raw data. Also, it could be a different option, because the raw JSON feed is still useful. Maybe call it "Javascript feed" or something. Currently, the raw "JSON feed" is like this:

Code: [Select]
[{"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...}]
The new "Javascript feed" could be something like this:

Code: [Select]
var CIT_DATA = [{"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...}];
The difference would be that the data is stored inside a variable, which makes the variable available in your page when you do the following:

Code: [Select]
<script type="text/javascript" src="http://cit.cohtitan.com/js/priv/123abc"/>
If you do the above with the current JSON feed, the data isn't stored anywhere and you can't use it.

The character sorting feature is very useful to me. I have several level 50's and there's no way to sort them "the way I want" using the character variables. Having it applied on the feed as well would save me the trouble of creating client-side scripts for sorting.

Last but not least, complete Alignment tracking, which I believe is already in the works. Hopefully.

That's about it. Thanks for listening and keep up the good work :)

Not a native English speaker.
But I'll let you point and laugh at my typos so I can fix them. :)

Aggelakis

  • Elite Boss
  • *****
  • Posts: 3,001
Re: Data feed suggestions
« Reply #1 on: February 09, 2011, 11:31:27 AM »
[other stuff]
I have no idea!

Quote
Last but not least, complete Alignment tracking, which I believe is already in the works. Hopefully.
I do know this one: Yes, the Titan team is hard at work overhauling CIT to be updated for GR/I19.
Bob Dole!! Bob Dole. Bob Dole! Bob Dole. Bob Dole. Bob Dole... Bob Dole... Bob... Dole...... Bob...


ParagonWiki
OuroPortal

Diellan

  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 540
    • SG/VG Site
Re: Data feed suggestions
« Reply #2 on: February 09, 2011, 11:42:15 AM »
For the first item, I suggest a way to convert the JSON feed into a script, not just raw data. Also, it could be a different option, because the raw JSON feed is still useful. Maybe call it "Javascript feed" or something. Currently, the raw "JSON feed" is like this:

Code: [Select]
[{"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...}]
The new "Javascript feed" could be something like this:

Code: [Select]
var CIT_DATA = [{"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...}];

Actually, the correct way to do this would be via JSONP, not via a variable. So you'd make the call as http://cit.cohtitan.com/js/priv/123abc?callback=functionName and you'd receive the a response of
Code: [Select]
functionName({"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...});

Keen

  • Elite Boss
  • *****
  • Posts: 370
Re: Data feed suggestions
« Reply #3 on: February 09, 2011, 12:14:20 PM »
Actually, the correct way to do this would be via JSONP, not via a variable. So you'd make the call as http://cit.cohtitan.com/js/priv/123abc?callback=functionName and you'd receive the a response of
Code: [Select]
functionName({"char_id":"123","name":"Keen Stronghold","status":"Offline",...}, {...}, ..., {...});

That's certainly a much cleaner solution. :)

But it's currently unsupported by the JSON feed, right? I tested it with a working feed and the output didn't change.

Not a native English speaker.
But I'll let you point and laugh at my typos so I can fix them. :)

Sekoia

  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 1,848
Re: Data feed suggestions
« Reply #4 on: February 09, 2011, 02:42:47 PM »
JSONP is currently unsupported, but I'll add it to the list of things to look into. CIT has lots of work pending so I can't say when we'll get to it.

Sekoia

  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 1,848
Re: Data feed suggestions
« Reply #5 on: February 15, 2011, 11:44:12 PM »
Turned out JSONP was pretty easy to implement. The method for calling it is slightly different than described above, though. Instead of http://cit.cohtitan.com/json/priv/123abc?callback=functionName, use http://cit.cohtitan.com/json/priv/123abc/functionName. There's info on the feed pages about it.

Keen

  • Elite Boss
  • *****
  • Posts: 370
Re: Data feed suggestions
« Reply #6 on: February 16, 2011, 12:28:36 AM »
Awesome, thanks!!

Not a native English speaker.
But I'll let you point and laugh at my typos so I can fix them. :)

Keen

  • Elite Boss
  • *****
  • Posts: 370
Re: Data feed suggestions
« Reply #7 on: May 12, 2011, 07:59:57 PM »
So, if anyone has been following this (other than me), all requests asked by the OP (which happens to be me) made it live with today's patch (made by me) to CIT:

  • "Alignment" field now lists the correct character alignment;
  • Custom character sorting is now applied to the feeds.

Thanks!

No problem!

 ;D

Not a native English speaker.
But I'll let you point and laugh at my typos so I can fix them. :)

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: Data feed suggestions
« Reply #8 on: May 12, 2011, 08:18:49 PM »
Thanks!

No problem!

 ;D

Keep doing awesome work and we'll keep letting you talk to yourself. (-:

DeProgrammer

  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 350
    • DePro Depot
Re: Data feed suggestions
« Reply #9 on: May 12, 2011, 08:28:44 PM »
You posted Waterworks, too! ... sooo I posted the news post. Only four weeks after I decided it was time to release it. :P