Generating templates for resource creation
When you use the HCP management API to create a resource, the best way to ensure that the request body includes the applicable properties is to use a template. You can generate your own template by submitting a GET request for an existing resource of the same type. In the request, include the verbose=false
query parameter on the resource URL (or omit the verbose
parameter to accept the default of false
).
With a nonverbose GET request HCP returns only properties whose values you can set. This enables you to use the response body as a template for the request body for creating additional resources of the same type.
In most cases, in response to a nonverbose GET request, HCP returns all the properties required for creating a resource of the same type and none of the properties that are invalid on a PUT request. The only exception is for namespaces, where the response body does not include the versioningSettings
property. To complete the template for namespaces, you need to add this property.