Read a scaffold file of a template change preview of an application component
POST/applications/:applicationId/components/:applicationComponentId/template/preview/file
Returns the content of one scaffold file of the template change preview: one of the preview's otherFiles, rendered from
the target template with the resource's properties. Read-only: nothing is written and no build is started. The UI and agents call it
on demand, when the user wants to see a file.
Body: the same as POST .../template/preview without includePaths (it is not part of this body), plus path, exactly one of that preview's
otherFiles[].path. Any other path, including .codenow.yaml, Dockerfile and the
helm/ files (they are in the preview's files[]), is rejected with E7017.
Response: path, inRepository, binary and vsRepository {result, current, target}
with base64-encoded contents: current is the file on the default branch, target the rendering.
result is CHANGED or IDENTICAL for a file already in the repository, TARGET_ONLY
with current: null for a new one. vsRepository is omitted when binary is true
(the content is not text, e.g. a Gradle wrapper jar): the content of a binary file is not returned; to get the file, include its path in includePaths so it is committed to the branch.
CodeNOW does not require these files: the change (PUT .../template) commits one to its branch only when it is in
includePaths; otherwise the user applies it by hand, as far as the resource needs it.
Errors (problem+json, parameters.errorId where CodeNOW assigns a code): the same as the preview — 400 E7011 /
E7001 or a property / not-ready rejection, 403, 404, 502 E7014, 502 (too large) / 504 (no answer in time)
without errorId — plus 400 E7017 when path is not one of the preview's otherFiles.
400 E7020 the target template itself cannot be rendered (context: templateId, version,
path; the message names the template, the file and the line). Nothing was changed. Do not retry and do not vary
properties: tell the user.
A running build does not block it: it never returns 409.
Request
Responses
- 200
- 400
- 401
- 403
- 404
- 429
- 500
- 502
- 504
The rendered file and its comparison with the repository; nothing was changed
The change (or its preview) was rejected. Coded rejections carry parameters.errorId and parameters.context (key/value pairs) in the problem+json body:
E7011the template is not valid for this resource type (context:templateId,customTemplate,resourceType);E7001the version does not exist (context:id,version).E7020the target template itself cannot be rendered (context:templateId,version,path; the message names the template, the file and the line). Nothing was changed. Do not retry and do not varyproperties: tell the user.
E7017the path is not a scaffold file of this preview (platform-owned paths included); run the preview again and pick a path fromotherFiles(context:path).
Without anerrorId: a template property failed validation (same as on creation), or the resource is not ready.
No valid API key provided.
The caller may not edit the resource.
The resource does not exist (or not under this parent). Nothing was changed.
Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.
Something went wrong on CodeNOW's end.
E7014 the repository's default branch could not be read, or the resource's SCM provider / repository cannot be resolved,
or the resource's own path in the repository runs through a symbolic link (refused; retrying does not help) (context: appComponentId); no partial preview. Retry later, or check the resource's SCM settings if it persists.
Without errorId: the answer is larger than the API passes on; nothing was changed.
CodeNOW did not answer in time; nothing was changed. Retry later.