forms
Creates, updates, deletes, gets or lists a forms resource.
Overview
| Name | forms |
| Type | Resource |
| Id | datadog.service_management.forms |
Fields
The following fields are returned by SELECT queries:
- get_form
- list_forms
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | The ID of the form. (example: 22f6006a-2302-4926-9396-d2dfcf7b0b34) |
attributes | object | The attributes of a form. |
type | string | The resource type for a form. (forms) (default: forms, example: forms) |
| Name | Datatype | Description |
|---|---|---|
id | string (uuid) | The ID of the form. (example: 22f6006a-2302-4926-9396-d2dfcf7b0b34) |
attributes | object | The attributes of a form. |
type | string | The resource type for a form. (forms) (default: forms, example: forms) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_form | select | form_id | version | Get a form definition by its ID. |
list_forms | select | Get all forms for the authenticated user's organization. | ||
create_form | insert | data | Create a new form. The form is created in draft mode and must be published before it can be used. This also creates a new datastore for form responses and links it to the form. | |
update_form | update | form_id, data | Update a form's properties such as its name, description, or datastore configuration. | |
delete_form | delete | form_id | Delete a form by its ID. This will also try to delete the associated datastore. | |
create_and_publish_form | exec | data | Creates a new form and immediately publishes its initial version. This also creates a new datastore for form responses and links it to the form. | |
clone_form | exec | form_id, data | Clone an existing form. The clone is created in draft mode using the source form's latest version. | |
publish_form | exec | form_id, data | Publish a specific version of a form, making it available for submissions. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
form_id | string (uuid) | The ID of the form. (example: 22f6006a-2302-4926-9396-d2dfcf7b0b34) |
site | string | The Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both. |
version | string | The version of the form to retrieve. Use 'latest' for the most recent draft, 'published' for the last published version, or a specific version number. |
SELECT examples
- get_form
- list_forms
Get a form definition by its ID.
SELECT
id,
attributes,
type
FROM datadog.service_management.forms
WHERE form_id = '{{ form_id }}' -- required
AND version = '{{ version }}'
;
Get all forms for the authenticated user's organization.
SELECT
id,
attributes,
type
FROM datadog.service_management.forms
;
INSERT examples
- create_form
- Manifest
Create a new form. The form is created in draft mode and must be published before it can be used. This also creates a new datastore for form responses and links it to the form.
INSERT INTO datadog.service_management.forms (
data
)
SELECT
'{{ data }}' /* required */
RETURNING
data
;
# Description fields are for documentation purposes
- name: forms
props:
- name: data
description: |
The data for creating a form.
value:
attributes:
anonymous: {{ anonymous }}
data_definition:
description: "{{ description }}"
properties: "{{ properties }}"
required:
- "{{ required }}"
title: "{{ title }}"
type: "{{ type }}"
description: "{{ description }}"
idp_survey: {{ idp_survey }}
name: "{{ name }}"
single_response: {{ single_response }}
ui_definition:
ui:order:
- "{{ ui:order }}"
ui:theme:
primaryColor: "{{ primaryColor }}"
type: "{{ type }}"
UPDATE examples
- update_form
Update a form's properties such as its name, description, or datastore configuration.
UPDATE datadog.service_management.forms
SET
data = '{{ data }}'
WHERE
form_id = '{{ form_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data;
DELETE examples
- delete_form
Delete a form by its ID. This will also try to delete the associated datastore.
DELETE FROM datadog.service_management.forms
WHERE form_id = '{{ form_id }}' --required
;
Lifecycle Methods
EXEC variables use wire (API) names.
- create_and_publish_form
- clone_form
- publish_form
Creates a new form and immediately publishes its initial version. This also creates a new datastore for form responses and links it to the form.
EXEC datadog.service_management.forms.create_and_publish_form
@@json=
'{
"data": "{{ data }}"
}'
;
Clone an existing form. The clone is created in draft mode using the source form's latest version.
EXEC datadog.service_management.forms.clone_form
@form_id='{{ form_id }}' --required,
@@json=
'{
"data": "{{ data }}"
}'
;
Publish a specific version of a form, making it available for submissions.
EXEC datadog.service_management.forms.publish_form
@form_id='{{ form_id }}' --required,
@@json=
'{
"data": "{{ data }}"
}'
;