Add Template API support - #280
Conversation
jdillman-splunk
commented
Sep 9, 2026
- Client methods for Create, Get, Update, Delete, and Search of Template records
- Template model support for Dashboard and Chart root elements, including imports and datasource metadata
- Tests and fixtures covering create/get/update/delete/search and error responses
| import "encoding/json" | ||
|
|
||
| // RecordType is the schema type used by Template API records. | ||
| const RecordType = "https://schema.splunkdev.com/dashify/v1/templates/Record" |
There was a problem hiding this comment.
I had just tried to resolve this URL, and it doesn't work.
Is that to be expected?
There was a problem hiding this comment.
yeah that's expected. Not really sure why we do that either (maybe it's a future thing) but everywhere we refer to the TemplateRecord we use that.
There was a problem hiding this comment.
additional info in this comment: #280 (comment)
| // Collection describes a page of Template URI references. | ||
| type Collection struct { | ||
| Type string `json:"type"` | ||
| Self string `json:"self"` | ||
| Next *string `json:"next"` | ||
| Prev *string `json:"prev"` | ||
| Count int64 `json:"count"` | ||
| Items []string `json:"items"` | ||
| } |
There was a problem hiding this comment.
So this is pagination definition for what exactly?
There was a problem hiding this comment.
The template search.
/v2/template?size=200&search=foobar&rootElement=Dashboard
"data": {
"count": 186,
"items": [
"/v2/template/HKAB1GoAEBY",
...
],
"next": null,
"prev": null,
"self": "/v2/template?rootElement=Dashboard&offset=0&size=200&search=j",
"type": "https://schema.splunkdev.com/dashify/v1/common/Collection"
},
There was a problem hiding this comment.
Is it possible to rename this type or update the godoc to make it clearer to the user that this is a pagination value?
There was a problem hiding this comment.
renamed and made it a bit more clear it's related to pagination in the comments
| "data": { | ||
| "id": "HNPz_pNAIAE", | ||
| "self": "/v2/template/HNPz_pNAIAE", | ||
| "type": "https://schema.splunkdev.com/dashify/v1/templates/Record", |
There was a problem hiding this comment.
This is a non resolvable domain
There was a problem hiding this comment.
yep.
All our reference types are like this and I can't say I fully understand the reason ... placeholder maybe?
Here is what AI said:
Why URIs instead of a plain enum string like "Record": it's a namespacing convention — borrowing splunkdev.com to make the tag globally unique and attributable to this org/product, the same way XML namespaces or JSON-LD @type values work. It doesn't imply a fetchable document. There's real precedent for this: RFC 7807 (Problem Details for HTTP APIs) defines a type field as a URI reference that clients are explicitly told need not be dereferenceable — it's identity, not location.
There was a problem hiding this comment.
My preference is to omit the domain and schema and just have #/path/to/reference similar to how one would define in OpenAPI spec.
What I am trying to avoid is a future bug bounty issue.
There was a problem hiding this comment.
Removed the domain and schema
Drop the schema.splunkdev.com domain from record/collection type URIs in favor of local #/... fragments, avoiding a URI that looks dereferenceable and reads as an internal-domain reference. Rename Content -> CreateUpdateTemplateRequest and Collection -> SearchPage for clarity per review feedback.