Create Harbor Saved Query Draft
Changed onCreates a stable Harbor saved query with its initial mutable draft.
Saved queries are supported only for Polytomic-managed Harbors whose backing Connection type is polytomic_harbor. Customer-managed Harbor backings return an unsupported-backing error.
The saved query receives a stable ID, but it remains absent from published saved-query reads until an administrator publishes its initial draft.
Use {{parameter_name}} references in sql_template. Each reference must have one scalar declaration. Validation values and defaults must match the declared string, number, boolean, date, timestamp, or uuid type.
Unknown JSON fields, including fields inside parameter declarations, return 400 Bad Request before the draft is saved. Use default_value, not default, for parameter defaults.
When you omit a parameter during execution, Polytomic uses its published default_value, never its draft validation value. An omitted optional parameter without a default binds SQL NULL. A required parameter allows omission when a default exists, but rejects explicit null even with a default.
For a report window, use a required parameter with a default so omission selects a useful window and explicit null is rejected:
{"name": "days", "type": "number", "required": true, "default_value": 7}
Request
- Base URLhttps://app.polytomic.com
- Auth
- HTTP bearer
- or HTTP basic
Path parameters
Unique identifier of the Harbor
Headers
Request body
Example request
{
"name": "Monthly revenue",
"owner": "Data Platform",
"parameters": [
{
"name": "start_date"
}
],
"sql_template": "SELECT account_id, sum(amount) AS revenue FROM orders WHERE created_at >= {{start_date}} GROUP BY account_id"
}Response
OK
Example response
{
"data": {
"created_by": "248df4b7-aa70-47b8-a036-33ac447e668d",
"id": "248df4b7-aa70-47b8-a036-33ac447e668d",
"parameters": [
{
"name": "start_date"
}
],
"saved_query_id": "248df4b7-aa70-47b8-a036-33ac447e668d",
"updated_by": "248df4b7-aa70-47b8-a036-33ac447e668d"
}
}Changes
- breaking
the
response's property type changed fromobjectto no type for status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - info
added to the
response propertyallOflist for the response status
- breaking
- info
endpoint added
- info