This document describes the new GraphQL APIs for displaying changelog data for metrics and assets (projects). These APIs provide the same functionality as the live views but can be consumed by frontend applications.
Two new GraphQL APIs have been created:
metricsChangelog- For displaying metrics creation and deprecation eventsassetsChangelog- For displaying asset (project) creation and hiding events
Query: metricsChangelog
Description: Returns a paginated list of dates with metrics creation and deprecation events.
Parameters:
page(optional, default: 1) - Page number (starts from 1)pageSize(optional, default: 20) - Number of date entries per pagesearchTerm(optional) - Search term to filter metrics by name or technical identifier
Returns: MetricsChangelogResult
entries- List ofMetricsChangelogDateEntrycontaining:date- Date as GraphQL Date typecreatedMetrics- List ofMetricChangelogEventfor metrics created on this datedeprecatedMetrics- List ofMetricDeprecationEventfor metrics deprecated on this date
pagination- Pagination information includinghasMore,totalDates,currentPage,totalPages
Example Query:
query {
metricsChangelog(page: 1, pageSize: 20, searchTerm: "price") {
entries {
date
createdMetrics {
metric {
humanReadableName
metric
docs {
link
}
}
eventTimestamp
}
deprecatedMetrics {
metric {
humanReadableName
metric
}
eventTimestamp
deprecationNote
}
}
pagination {
hasMore
currentPage
totalDates
totalPages
}
}
}Query: assetsChangelog
Description: Returns a paginated list of dates with asset (project) creation and hiding events.
Parameters:
page(optional, default: 1) - Page number (starts from 1)pageSize(optional, default: 10) - Number of date entries per pagesearchTerm(optional) - Search term to filter assets by name or ticker
Returns: AssetsChangelogResult
entries- List ofAssetsChangelogDateEntrycontaining:date- Date as GraphQL Date typecreatedAssets- List ofAssetChangelogEventfor assets created on this datehiddenAssets- List ofAssetHidingEventfor assets hidden on this date
pagination- Pagination information includinghasMore,totalDates,currentPage,totalPages
Example Query:
query {
assetsChangelog(page: 1, pageSize: 10, searchTerm: "bitcoin") {
entries {
date
createdAssets {
asset {
name
ticker
slug
logoUrl
description
link
}
eventTimestamp
}
hiddenAssets {
asset {
name
ticker
slug
}
eventTimestamp
hidingReason
}
}
pagination {
hasMore
totalDates
currentPage
totalPages
}
}
}humanReadableName- Human-readable name of the metricmetric- Technical metric identifierdocs- List of documentation links
name- Name of the assetticker- Trading ticker symbolslug- URL-safe identifierlogoUrl- URL to the asset logodescription- Description of the assetlink- Link to the asset page on Santiment
eventTimestamp- When the event occurreddeprecationNote- Optional note for metric deprecationhidingReason- Reason for hiding an asset
- Pagination: Both APIs use consistent
page/pageSizeparameters that support:- Infinite Scroll: Frontend increments
pageand appends results - Traditional Pagination: Frontend shows page numbers and jumps to specific pages
- Infinite Scroll: Frontend increments
- Search: Both APIs support filtering by relevant terms (metric names vs asset names/tickers)
Run the tests with:
mix test test/sanbase_web/graphql/changelog/changelog_api_test.exs