Summary Data

Summary Data is an API that gives users the ability to store quickly accessible or small data related to a user. This means no need to setup a database to handle simple state manipulation. There are five data metrics to store data with. These data metrics are:

  • Data Metric 0 - for string or small stringified JSON payload

  • Data Metric 1 - for publicly accessible integer value (typically available to the users under the specified service metric alias)

  • Data Metric 2 - for publicly accessible big decimal value (typically available to the users under the specified service metric alias)

  • Data Metric 3 - for privately accessible integer value

  • Data Metric 4 - for privately accessible big decimal value

Update Summary Data

A good example of how to use this in e-commerce would be using the metric 0 field to store pending cart information. Metric 1 can be used to store the total number of orders, and Metric 2 can be used to store the total amount spent on the e-commerce site providing the user with an overview of their interaction with the e-commerce website without any need for you to implement any backend to support this. This is also useful in gaming where you could store basic information in the metric 0 and the kill count or XP - or both. All without needing to break your focus on game development while also providing users with useful insight. Additionally, this data is made available on the dashboard where developers can access their service data to see the average value of the data being persisted in the numeric field to provide them with quick analytics and insight for better user experience.

fetch('https://api.opencider.com/user/summary-data', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    'metric0': '{"most_recent_transactions":[...]}',
    'metric1': 10, //available balance in USD
    'metric2': 11, //actual balance in USD
    'metric3': 500, //transactions done
    'metric4': 1746645756796, //last transaction timestamp
    'incrBy': true, //true - increments existing numeric data by payload, false - overwrites existing data
    'token': 'service_user_token'
  })
});

Get Summary Data

To retrieve the stored data, we will be calling this end-point. Apart from serving as a source of insightful analytics based on user-data on the app, Summary Data can be used as a small data store and a cache. It can also be used to create synchronization between devices as the data is stored in the cloud and can be accessed from any authorized device.

fetch('https://api.opencider.com/user/summary-data?token=service_user_token');

Leaderboard

You can also access leader board functionalities based on the metric 1 data. This can be especially useful for games. An example of this is recording the high scores in the metric 1 field and then showing a leaderboard based on the high score simply by calling this function.

fetch('https://api.opencider.com/user/summary-data/leaderboard?token=service_user_token&limit=10');

This function can also be useful to gamify other web or mobile app experiences like showing the top .

Last updated