I'd love to use the data from my cricket club on our website - not by embedding reports, but by using retrieving the data and processing it using a front-end technology (like React). The members of my club are not tech-savvy and have difficulty navigating the web, so I'd like to make it as easy for them as possible.
My suggestion of an API would be like this:
- REST-like interface, or GraphQL
- secured as per the existing API
- returns JSON (or other human-readable output, but JSON would be way at the top of the list)
I'm a software architect and would be happy to offer assistance in creating/maintaining this API.
Hi Jim,
It sounds like you just need a JSON output option for all the reports, correct?
Rather than sending them as HTML tables, you just need JSON.
It doesn't need an "extensive API", right?
An output something like this?
[
{
"FIELD1": "#",
"FIELD2": "Name",
"FIELD3": "Team",
"FIELD4": "Opposition",
"FIELD5": "Date",
"FIELD6": "Ground",
"FIELD7": "Bat Pos",
"FIELD8": "Score"
},
{
"FIELD1": "1",
"FIELD2": "Jeremy Board",
"FIELD3": "Blagdon",
"FIELD4": "Chaddesley Corbett",
"FIELD5": "16 Aug 2005",
"FIELD6": "Chaddesley Corbett",
"FIELD7": "1",
"FIELD8": "189"
},
{
"FIELD1": "2",
"FIELD2": "Simon Westbrook",
"FIELD3": "Blagdon",
"FIELD4": "Lapworth",
"FIELD5": "14 Aug 2012",
"FIELD6": "Lapworth",
"FIELD7": "3",
"FIELD8": "177*"
},
{
"FIELD1": "3",
"FIELD2": "Simon Westbrook",
"FIELD3": "Blagdon",
"FIELD4": "Failand & Portbury",
"FIELD5": "16 May 1998",
"FIELD6": "Failand & Portbury",
"FIELD7": "2",
"FIELD8": "175*"
},
{
"FIELD1": "4",
"FIELD2": "Simon Byas",
"FIELD3": "Blagdon",
"FIELD4": "East Huntspill",
"FIELD5": "16 May 1993",
"FIELD6": "East Huntspill",
"FIELD7": "4",
"FIELD8": "173*"
}
]
Perhaps I misunderstood the current API - can I get all data from it? I'd like to get individual match data, plus all the reports but in JSON format. If this is already available, amazing.
The output would be better as something like:
[ { "position": "1", "name": "Jeremy Board", "team": "Blagdon", "opposition": "Chaddesley Corbett", "date": "16 Aug 2005", "ground": "Chaddesley Corbett", "batPos": "1", "score": "189" }, { "position": "2", "name": "Simon Westbrook", "team": "Blagdon", "opposition": "Lapworth", "date": "14 Aug 2012", "ground": "Lapworth", "batPos": "3", "score": "177*" }, { "position": "3", "name": "Simon Westbrook", "team": "Blagdon", "opposition": "Failand & Portbury", "date": "16 May 1998", "ground": "Failand & Portbury", "batPos": "2", "score": "175*" }, { "position": "4", "name": "Simon Byas", "team": "Blagdon", "opposition": "East Huntspill", "date": "16 May 1993", "ground": "East Huntspill", "batPos": "4", "score": "173*" } ]
Currently, all reports come out as HTML tables which you can style however you like with CSS. You can get all stats reports plus match scorecards. Any report that you can run in the admin panel/reports can be rendered this way.
What you are asking for is to send the data as JSON rather than HTML. This is not available at the moment.
I must say though, it sounds like a lot of hard work to render things from JSON when our system already does it all for you in HTML tables. Styling with CSS is a lot, lot simpler in my opinion.
I did not realise all reports were available in the current API - apologies for that. I'll investigate that over the next while.
I understand that HTML tables are extremely useful, but having the raw data to hand is helpful in certain situations e.g. cut-down versions of reports, combinations with other data sources (particularly some private personal data)
Thanks for your help, and congrats on the entire CricketStatz application, it really is excellent.
@Jim Gallagher I will work on this page some more today to make it a lot clearer on what you can do with the reports: https://www.cricketstatz.com/adding-reports-to-your-web-site
(Update: I have just done an overhaul of that guide and added a lot more info)
I have also moved this post to the questions section so we can continue our conversation if needed. I am always happy to work with developers.
Out of interest, which club/association are you with?
Thanks - the guide now explains several ways of integrating the cricketstatz output reports into other sites.
My club is called the Slammers - we're a tiny single-team friendlies-only social club in Dublin, Ireland. I enter the stats as a hobby, and as a way of preserving the history. I've only done this for about 3 seasons now.
I'm looking at the linkreport.aspx options now, and they work well in Chrome and Postman, returning partial HTML docs, usually tables. Trying to call these reports through code, though, throws a CORS error. Is this something you think you could enable?
OK response header has now been added to the linkreport.aspx call: