Documentation menu

Edit a community template draft

PATCHhttps://api.instacloud.com/orgs/{orgId}/templates/{code}

Token scope: account · org — read-only tokens refused (not a GET).

Parameters

NameInTypeRequiredDescription
orgIdpathstringyes
codepathstringyes

Request body

application/json

FieldTypeRequiredDescription
codestringnoRename. Only before the first publish.
namestringno
taglinestring | nullno
categorystring | nullno
readmestring | nullno
logoUrlstring | nullnoAn https:// image link. The link and its percent-encoded form are each at most 2048 characters. null clears it.
variablesobject[]noOnly the variables that changed, at most 600, the cap a project apply has. A name deleted in this PATCH can be added again only in a later PATCH. One invalid entry answers 400 and nothing is saved.
variables.servicestringyes
variables.namestringyesThe generator's name for the variable: the view's originalName when it is renamed, else its name. On an add, the new variable's name.
variables.choiceobject | null | nullnonull clears the choice, back to what the generator chose. Omitted leaves the choice as it is.
variables.newNamestring | nullnoRenames the variable: ^[A-Z][A-Z0-9_]{0,63}$, and no other variable of the service may have that name. null clears the rename. Omitted leaves the name as it is.
variables.addtruenoAdds a required variable called name to a web service or worker: ^[A-Z][A-Z0-9_]{0,63}$, a name no variable of the service has or shows, at most 200 variables per service and 1000 per template. The entry carries nothing else. A choice for it rides in its own entry, and adds run before every other entry.
variables.deletetruenoDeletes a variable the author added, with its choice and rename. One from the project answers 400: remove it with choice removed. The entry carries nothing else, and deletes run after every other entry.
servicesobject[]noOnly the services that changed, at most 100. An add or a delete entry carries nothing else. Service adds run first and deletes run after every other entry. A template holds at most 50 services. A name deleted in this PATCH can be added again only in a later PATCH. One invalid entry answers 400 and nothing is saved.
services.namestringyesThe service. On an add, the new service name: lower-kebab, at most 39 characters, a name no service of the template has.
services.removedbooleannotrue leaves the service out of the published template, false restores it. Omitted leaves it as it is. A service the author added is deleted instead, and true on one answers 400.
services.settingsobject | null | nullnoOnly the fields that changed: each replaces that field. null clears every setting of the service. Postgres takes only pgVersion and storage only public. Redis, MySQL and MongoDB answer 400, and so does a field the service type does not take.
services.addobjectnoA service the author adds to a template: a compute service from an image, web with a port and a worker without one, or a managed database or bucket by type.
services.deletetruenoDeletes a service the author added, with every setting, choice, rename and added variable kept under its name. One from the project answers 400: remove it with removed true. The entry carries nothing else, and deletes run after every other entry.
expectedUpdatedAtstringyesThe draft's updatedAt as the client rendered it. A different current value answers 409 template_draft_changed.

Responses

200

Default Response

FieldTypeRequiredDescription
templateobjectyes
template.idstringyesThe draft's stable id. A rename of its code keeps it, and a new draft gets a new one, even under a code a deleted draft had. Routes and editor links address a draft by its code.
template.codestringyes
template.orgIdstringyes
template.sourceProjectIdstring | nullyes
template.blankbooleanyesCreated with POST /orgs/{orgId}/templates, with no project behind it: every service is one the author added, and Regenerate From Project answers 400. A generated draft whose project was deleted is not blank.
template.status"draft" | "published" | "unpublished"yes
template.publishedVersionstring | nullyes
template.hasUnpublishedChangesbooleanyes
template.namestringyes
template.taglinestring | nullyes
template.categorystring | nullyes
template.readmestring | nullyes
template.defaultReadmestringyesA README skeleton built from the draft as it is now: service names and required variable names only, never a value. The console offers it behind a button; it is not stored.
template.logoUrlstring | nullyes
template.servicesobject[]yes
template.services.namestringyes
template.services.typestringyesweb with a port, worker without one, or the managed type (postgres, redis, mysql, mongodb or storage). It and the fields below are the values after the author's settings.
template.services.imagestring | nullyes
template.services.portinteger | nullyes
template.services.healthcheckstring | nullyes
template.services.volumebooleanyes
template.services.mountPathstring | nullyesnull with volume true: the volume mounts at the default /data. null with volume false: no volume.
template.services.commandstring | nullyes
template.services.alwaysOnboolean | nullyes
template.services.publicbooleannoStorage only, always present on a bucket: anonymous public-read, after the author's setting.
template.services.pgVersionintegernoPostgres only: the major a deploy creates the database on, after the author's setting. Absent when the project's database recorded none.
template.services.addedbooleannoPresent, and true, only on a service the author added: a PATCH deletes it for good. One from the project is removed instead.
template.services.removedbooleanyesThe author left this service out of the template. It stays listed so it can be restored.
template.services.variablesobject[]yesSorted by the generator's name (originalName when renamed). Empty for a managed database. A removed service lists what restoring it brings back.
template.services.variables.namestringyes
template.services.variables.kind"required" | "optional" | "default" | "reference" | "generated" | "fixed" | "removed"yes
template.services.variables.valuestringnodefault: the default text. reference: the token. fixed: the literal or the address reference.
template.services.variables.descriptionstringnoWhat whoever deploys reads. Omitted while it is the default sentence, which the console shows as an empty box.
template.services.variables.brokenReferencestringnoThe token this variable referenced before its service was removed from the template or left the project. The variable is then required.
template.services.variables.originalNamestringnoPresent only when the author renamed the variable: the generator's name, which a PATCH variables entry sends as name. name is then the new one.
template.services.variables.addedbooleannoPresent, and true, only on a variable the author added: a PATCH deletes it for good. One from the project is removed with choice removed instead.
template.referenceOptionsobject[]yesWhat a variable may reference in the template as it is now. A removed service offers nothing.
template.referenceOptions.tokenstringyesExactly what a reference choice sends and the manifest stores.
template.referenceOptions.servicestringyes
template.referenceOptions.keystringyesA credential key of a managed database or a storage bucket, or url or host of a web service.
template.editableFieldsobjectyesPer service type, the TemplateServiceSettings keys a template service of that type takes. A PATCH answers 400 for any other.
template.editableFields.web"image" | "port" | "healthcheck" | "command" | "mountPath" | "alwaysOn"[]yes
template.editableFields.worker"image" | "port" | "healthcheck" | "command" | "mountPath" | "alwaysOn"[]yes
template.editableFields.postgres"pgVersion"[]yes
template.editableFields.redisstring[]yes
template.editableFields.mysqlstring[]yes
template.editableFields.mongodbstring[]yes
template.editableFields.storage"public"[]yes
template.referenceKeysobjectyesPer managed service type, the credential keys a variable may reference on a service of that type, one the author has not applied yet included (secretNames.ts CANONICAL_KEYS). A web service's url and host are not listed.
template.referenceKeys.postgresstring[]yes
template.referenceKeys.redisstring[]yes
template.referenceKeys.mysqlstring[]yes
template.referenceKeys.mongodbstring[]yes
template.referenceKeys.storagestring[]yes
template.publishRequirementsobject[]yesAlways seven, in this order: has_service, no_blocked, no_conflicts, has_tagline, has_category, has_readme, required_descriptions.
template.publishRequirements.code"has_service" | "no_blocked" | "no_conflicts" | "has_tagline" | "has_category" | "has_readme" | "required_descriptions"yes
template.publishRequirements.okbooleanyes
template.publishRequirements.itemsstring[]yesno_blocked: each blocked reason. no_conflicts: one sentence with its fix for each name the author added that the project now has too, services first. required_descriptions: each <service>.<VAR> still without a description. Otherwise empty.
template.reportobjectyesWhat generation skipped, what blocks publishing (each with a fix), and notices.
template.report.skippedobject[]yes
template.report.skipped.servicestringno
template.report.skipped.variablestringno
template.report.skipped.reasonstringyes
template.report.skipped.fixstringno
template.report.blockedobject[]yes
template.report.blocked.servicestringno
template.report.blocked.variablestringno
template.report.blocked.reasonstringyes
template.report.blocked.fixstringno
template.report.noticesobject[]yes
template.report.notices.servicestringno
template.report.notices.variablestringno
template.report.notices.reasonstringyes
template.report.notices.fixstringno
template.updatedAtstringyes
template.takenDownbooleanyesStaff took this template down. It cannot be republished.
template.deployCountintegeryesSucceeded deployments of this template.
template.totalProjectsintegeryesDistinct projects that deployed this template since its first publish, any outcome: the number the gallery card shows (the catalog's totalProjects).

400

Default Response

FieldTypeRequiredDescription
errorstringyes

404

Default Response

FieldTypeRequiredDescription
errorstringyes

409

code template_draft_changed: the draft changed since the client read it (expectedUpdatedAt), review it and save again. Without a code: the new code is taken, or the template was already published and keeps its code.

FieldTypeRequiredDescription
errorstringyes
codestringnostable machine-readable reason, e.g. private_lane_disabled, private_lane_unavailable_in_region, public_access_closed, credential_change_in_progress

429

This user saved too many times in the last minute. Retry later.

FieldTypeRequiredDescription
errorstringyes

View as Markdown