Ready made code samples and short explanations to have you using the Table to Text APIs as quickly as possible.

Quickstart

First, the Body

The body of your API call should look like what is below. To get to a JSON like below, you should:

  • Start with a table with columns named asset_id, time, value, and name. To start, asset_id and name should have the same value in each cell.
  • Convert this table to JSON format
  • Add your API key, as illustrated below
{"post_body":
	{
    "metric_df": [
      {
        "value": 16,
        "time": "2020-12-23",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 15,
        "time": "2020-12-26",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 15,
        "time": "2020-12-27",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 11,
        "time": "2020-12-29",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 9,
        "time": "2020-12-31",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 15,
        "time": "2021-01-02",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 12,
        "time": "2021-01-04",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 17,
        "time": "2021-01-06",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 11,
        "time": "2021-01-07",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 5,
        "time": "2021-01-12",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      }
    ],
    "key": ["api_token_here"]
  } 
}

Then, the Whole Call

After you've got the body, you can wrap the whole thing in a POST call to one of our endpoints.
Describe trend is a place to start if you're not sure. :)

curl -XPOST -d '{
"post_body": {
    "metric_df": [
      {
        "value": 16,
        "time": "2020-12-23",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 15,
        "time": "2020-12-26",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 15,
        "time": "2020-12-27",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 11,
        "time": "2020-12-29",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 9,
        "time": "2020-12-31",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 15,
        "time": "2021-01-02",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 12,
        "time": "2021-01-04",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 17,
        "time": "2021-01-06",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 11,
        "time": "2021-01-07",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      },
      {
        "value": 5,
        "time": "2021-01-12",
        "asset_id": "Ben Simmons",
        "name": "points per game"
      }
    ],
    "key": ["api_token_here"]
  }
}' 'https://generate-text-mrwwgrktvq-ue.a.run.app/describe-trend'