API

Get Information about a Metric

GET https://api.futureland.tv/metrics/:metricId

Response

{
  "id": "919b054b-3024-444f-b9f8-f0de4d982acd",
  "name": "⚖️ Body Weight",
  "unit": "kilogram",
  "defaultValue": null,
  "user_id": 365,
  "total": 4221.6,
  "average": 68.0903225806451,
  "count": 62
}

Get Aggregated Data from the Last 30 Days

GET https://api.futureland.tv/metrics/:metricId/last-30-days

Response

[
  {
    "date": "2023-04-05T00:00:00.000Z",
    "total": 68.8,
    "average": 68.8,
    "count": 1,
    "unit": "kilogram"
  },
  {
    "date": "2023-04-06T00:00:00.000Z",
    "total": 68.35,
    "average": 68.35,
    "count": 1,
    "unit": "kilogram"
  },
  {
    "date": "2023-04-07T00:00:00.000Z",
    "total": 68.1,
    "average": 68.1,
    "count": 1,
    "unit": "kilogram"
  },
  ...
]

Create new MetricData

POST https://api.futureland.tv/metrics-data

{
  "id": "e40559db-fb74-46d4-a269-ada54e6cb1aa", // optional (will autogenerate if omitted))
	"value": 69.75,
	"unit": "kilogram",
	"date": "2024-06-17T17:27:54.875Z",
	"timezone": "America/Toronto", // optional (if omitted will use user's current timezone)
	"metric_id": "919b054b-3024-444f-b9f8-f0de4d982acd"
}

Sync MetricData of Metric

lastSyncedAt is a timestamp in ISO 8601 format. You can set it to 0 if you want to receive all MetricData of a Metric.

This route will include MetricData from other users that shared their MetricData with this Metric

GET https://api.futureland.tv/metrics/:metricId/metric-data/sync-pull?lastSyncedAt={timestamp}

{
	"updated": [
		{
			"id": "34e583bf-8c37-4f01-a69b-27b4686319f1",
			"unit": "number",
			"value": 21,
			"date": "2024-11-15T23:50:44.000Z",
			"timezone": "Asia/Makassar",
			"numberOfComments": 0,
			"metric_id": "09a13d61-9927-6fd8-b539-8ed62c805999",
			"entry_id": null,
			"user_id": 365,
			"createdAt": "2024-11-15T23:50:44.000Z",
			"updatedAt": "2024-11-15T23:51:42.203Z",
			"blocks": [
				{
					"id": "fa95e58e-04ce-4688-8112-431f6096b4d3",
					"index": 0,
					"type": "text",
					"text": "This is a quick test.",
					"finishedProcessingAt": "2024-11-15T23:51:40.418Z",
					"createdAt": "2024-11-15T23:51:40.396Z",
					"updatedAt": "2024-11-15T23:51:40.418Z",
					"metric_data_id": "34e583bf-8c37-4f01-a69b-27b4686319f1",
					"defaultFile": null
				},
				{
					"id": "5fe00b04-bb14-46f1-b579-28a5b065b7e0",
					"index": 1,
					"type": "image",
					"text": "1*qj5E9Tr90JtygPqGXvXq0Q-1495084862.jpeg",
					"finishedProcessingAt": "2024-11-15T23:51:42.201Z",
					"createdAt": "2024-11-15T23:51:40.850Z",
					"updatedAt": "2024-11-15T23:51:42.201Z",
					"metric_data_id": "34e583bf-8c37-4f01-a69b-27b4686319f1",
					"defaultFile": {
						"url": "https://cdn.futureland.tv/app/metric-data/34e583bf-8c37-4f01-a69b-27b4686319f1/5fe00b04-bb14-46f1-b579-28a5b065b7e0/default.jpeg",
						"extension": "jpeg",
						"id": 265613,
						"width": 1000,
						"height": 543,
						"duration": null,
						"size": 42033,
						"mimeType": "image/jpeg",
						"path": "app/metric-data/34e583bf-8c37-4f01-a69b-27b4686319f1/5fe00b04-bb14-46f1-b579-28a5b065b7e0/default.jpeg",
						"createdAt": "2024-11-15T23:51:42.195Z"
					}
				}
			],
			"workout": null
		}
	],
	"deleted": [
		"f0409765-7d87-4cd0-bc33-8777da2226f3",
		"f242915b-b432-4720-a1dc-c606f6da62cd",
		"486d4904-62b6-4328-a90b-2cddf15665b6",
		"e4c0ee21-9c99-401e-a5dc-6a5f6fdef265",
		"b34448d0-33ce-4c6b-a46b-64b8efd26897",
		"c9532e26-efe8-4a1d-a8ae-162f167526dd",
		"588f0e96-52ae-4452-b082-7efb9a942f0c"
	]
}