Template Metadata

Inspect the variables a template references before exporting it.

Overview

The metadata endpoint compiles one of your templates and reports the variables it references along with any errors found while parsing the source. Use it to discover which variables to supply when calling the Template Export endpoint.

All requests must be authenticated with an API key. See Authentication for how to create one.

Endpoint

GET /api/tasks/{templateId}/metadata

Replace {templateId} with the ID of the template you want to inspect.

Example

cURL
curl "https://www.hardcopies.net/api/tasks/TEMPLATE_ID/metadata" \
  -H "Authorization: YOUR_API_KEY"

Response

On success the endpoint returns 200 OK with a JSON body containing a variables array and an errors array.

Response body
{
  "variables": [
    { "name": "owner", "type": "string" },
    { "name": "includeNotes", "type": "boolean" }
  ],
  "errors": [
    {
      "message": "Unexpected token",
      "position": { "line": 4, "column": 1 },
      "severity": "error"
    }
  ]
}

Variables

Each entry in the variables array describes a variable the template references. The type is inferred from how the variable is used in the source.

TypeMeaning
stringUsed as inline text. Supply a string value when exporting.
booleanUsed as a condition. Supply a boolean value when exporting.
conflictUsed both as text and as a condition, so it cannot be satisfied with a single value. Fix the template before exporting.

Errors array

The errors array lists problems found while parsing the template source. It is empty when the template parses cleanly. Each entry includes a message, a position with the line and column, and a severity of error or warning.

Errors

Failures are returned as JSON with an error message.

StatusDescription
401 UnauthorizedThe API key is missing or invalid.
404 Not FoundNo template matches the given templateId.
429 Too Many RequestsThe API key has exceeded its rate limit.