Templates

Create a template

Creates a new template for generating job subgraphs.

post/v1/templates

Request

  • Base URL
    https://docs.grepr.ai (the document declares no server; this is the origin it was published from)
  • Auth
    • API key in header GREPR-API-KEY
    • or OpenID Connect (https://grepr-prod.us.auth0.com/.well-known/openid-configuration)

Request body

builtInboolean

Read-only property indicating whether this template is a built-in, non-editable template.

descriptionstring

Description of the template.

idstring

Unique identifier for the template.

inputSchemaobject

JSONSchema (https://json-schema.org/draft/2020-12) for validating the inputs to the template. Make sure you make this validation forwards/backwards compatible to ensure that the template version can be upgraded and rolled back.

inputsobject

Map of input names used in a parent subgraph that uses a TemplateOperation to their internal connections within the subgraph. Can be missing if there are no inputs to the subgraph

isLatestboolean
latestboolean
namestring required

Name of the template.

organizationIdstring

Organization ID to which the template belongs. This is null for built-in templates.

outputsobject

Map of output names used in a parent subgraph that uses a TemplateOperation to their internal connections within the subgraph. Can be missing if there are no outputs from the subgraph

sourceHashstring

SHA-256 hash of template source and all dependencies (utils, types, build config, package versions). Used to track when template dependencies change and avoid unnecessary updates.

teamIdsstring[]

Set of team IDs that can use this template.

templatestring required

A javascript string that generates the JSON for the job subgraph. It will receive as input a User object and the inputs provided via the operation when it is getting resolved into a subgraph.

versioninteger required

Version of the template.

Example request

{
  "description": "Parses JSON log events and extracts fields.",
  "draftOutputs": [
    {
      "name": "parsedOutput",
      "tagKey": "draft",
      "tagValue": "true"
    }
  ],
  "id": "template-123",
  "inputs": {
    "input": "log_reducer:input"
  },
  "name": "Parse JSON Logs",
  "organizationId": "org-456",
  "sourceHash": "c354755d7b9b669e3111fcdd40a3432386d13a1b5548c2464ca2d73bcf3f70f1",
  "teamIds": [
    "team-1",
    "team-2"
  ],
  "version": 1
}

Response

Template created successfully

Changes

No recorded changes to this operation across all 1 revision of this API.