Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow including display values in API /records fetches #880

Open
dsagal opened this issue Mar 4, 2024 · 0 comments
Open

Allow including display values in API /records fetches #880

dsagal opened this issue Mar 4, 2024 · 0 comments

Comments

@dsagal
Copy link
Member

dsagal commented Mar 4, 2024

The API GET /records call today returns the underlying values of Grist cells, for example:

  • Numeric values are returned as numbers in the JSON response
  • Date values (like '2024-03-04) are returned as numbers, seconds since epoch, e.g. 1709510400`.
  • Reference values are returned as row IDs

Sometimes it's helpful to get values as a user would see them, i.e. the display values. For example, display values are what gets exported in CSV or Excel exports. For example:

  • Numeric values with formatting, like $1,000.00 or 37%
  • Date values with formatting, like 2024-03-04 or March 3, 2024
  • Reference values as their corresponding display value (e.g. name of contact rather than row ID of contact)

Proposal is to add an optional query parameter includeDisplay=1 to GET /records call. When set to a true value, the response would include an extra display property for each record:

{
      "id": 6,
      "fields": {
        "Contact": 19,
        "Notes": "Hello world",
        "Date": 1589068800,
        "Type": "Email"
      },
      "display": {
        "Contact": "Sporer Group",
        "Date": "2020-05-10",
      }
}

The display property would include only those values that are formatted and different from the value in fields (e.g. plain text values would be omitted, and probably booleans and unformatted numbers). The formatting used would follow the same logic as for CSV or Excel exports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant