Skip to content

Upload Single File Content



POST /api/v1/rum_sourcemap/upload_file_content

Overview

Writes a SourceMap-related text file under the specified environment and version.

Before Calling and Usage Steps

The current Key requires rum.rumCfgManage. Only the workspace to which the current Key belongs is supported. appId is obtained from content[].appId in the RUM Application List, and must be consistent with the SDK/error record app_id. It cannot be replaced with an internal database UUID. SourceMap is precisely located by application, environment (env), and version (version); case and whitespace are part of the identifier itself and must exactly match the collection record. Omitting env/version or passing an empty string indicates an empty environment/empty version, not a wildcard for all. The current hosting lifecycle requires each to be at most 256 characters.

This endpoint accepts JSON text content, not multipart ZIP or Base64 binary. filename is a relative path within the package, for example static/js/app.js.map; a leading / is stripped for compatibility, but .., backslashes, and unsafe links are prohibited. It is recommended to always pass a canonical relative path. content is encoded as-is in UTF-8. The current hosted path preserves leading and trailing whitespace/line breaks and does not decode the JSON string again into a file object. Omitting content writes an empty string; success alone does not prove that the file is parseable.

If a file with the same name already exists, it replaces that file while other files are retained. Multiple files can be uploaded one by one, but they are not published as an atomic whole package; during this period, reads may see a published subset. The single-file size and the total counted capacity for the version are subject to the site limit, which defaults to 2 GiB. For bulk uploads, ZIP is recommended to keep build artifacts consistent. For Web/RN, upload the .map files actually generated by the build and the necessary source/JS files. Android/iOS native binary symbols are better suited to the ZIP workflow.

A success value of true indicates that this file write has been confirmed; subsequent indexing/stabilization/cleanup recovery may complete asynchronously. A failed operation may also include uploadCommitted=true; do not replay a write that has already been confirmed as published. When 409 ownership/recovery is unconfirmed, retain the traceId and ask the administrator to handle it. Do not delete the occupied state or blindly retry the upload. After completion, verify with File Tree, and use Stack Parsing to verify the actual match; do not equate a record in the list with correct map content.

Request Headers

Parameter Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the workspace.
Example: <DF-API-KEY>
How to obtain or fill in: Obtain an OpenAPI Key with this operation permission from API Key Management in the target workspace.

Body Request Parameters

Parameter Type Required Description
appId string Y Required identifier of the active application in the current workspace; not an internal RumCfg UUID and cannot be used across workspaces.
Allowed null: False
Example: payment_web
How to obtain or fill in: Obtain from content[].appId in the RUM Application List or from the app_id in an error record.
version string Optional string; defaults to an empty version and is at most 256 characters. It does not represent the latest/all versions, and null is not allowed.
Allowed null: False
Allowed empty string: True
Example: 1.2.3
How to obtain or fill in: Obtain from the version actually released by the client/the version in an error record, corresponding to the build artifact.
env string Optional string; defaults to an empty environment and is at most 256 characters. It does not represent all environments, and null is not allowed.
Allowed null: False
Allowed empty string: True
Example: production
How to obtain or fill in: Obtain from the environment released by the client/the env in an error record, and keep it verbatim consistent with the upload.
filename string Y Required non-empty valid relative file path; POSIX / separators are recommended. A leading / is stripped for compatibility; .., backslashes/links, etc. within the path are rejected, and client absolute disk paths cannot be passed.
Allowed null: False
Allowed empty string: True
Example: static/js/app.js.map
How to obtain or fill in: Determine from the relative path of the build artifact and the source URL path in the error stack.
content string Optional string; omitting it results in an empty string, and the original UTF-8 text is preserved. No Base64 decoding is performed; uploading an empty map is not recommended.
Allowed null: False
Allowed empty string: True
Example: {"version":3,"sources":["app.ts"],"names":[],"mappings":"AAAA","sourcesContent":["console.log(1);"]}
How to obtain or fill in: Read the text SourceMap content generated by the build for this version and serialize it as a JSON string.

Additional Parameter Notes

Note: Only one sourcemap with the same version and env can exist under the same application. The uploaded file content directly overwrites the target file.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/rum_sourcemap/upload_file_content' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"appId":"payment_web","env":"production","version":"1.2.3","filename":"static/js/app.js.map","content":"{\"version\":3,\"sources\":[\"app.ts\"],\"names\":[],\"mappings\":\"AAAA\",\"sourcesContent\":[\"console.log(1);\"]}"}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content boolean On success, fixed to true; the single-file publication is confirmed, but the final asynchronous indexing/stabilization status still needs verification.
content.reasonCode string Error responses only: machine-readable reason, for example active_operation/invalid_scope/registry_missing.
content.action string Error responses only: suggested action, for example retry_after_operation/verify_ownership/check_scope_and_upload.
content.retryable boolean Error responses only: server-recommended retryable flag; it cannot be used alone to replay a published write.
content.uploadCommitted boolean Some single-file error diagnostics only: true indicates that the write has been confirmed as published; omission does not mean false or confirm that the write was not performed.
content.actualBytes integer Some capacity errors only: counted bytes.
content.maxBytes integer Byte limit for capacity/reads.
content.workspaceUUID string Some restricted error diagnostics: current workspace UUID.
content.appId string Some restricted error diagnostics: public application identifier.
content.rumCfgUUID string Some restricted error diagnostics: internal application identifier, used only for support troubleshooting, and does not replace the request appId.
content.env string Some error diagnostics: environment.
content.version string Some error diagnostics: version.
content.bundleUUID string Some error diagnostics: generation record ID for this operation, not uploadId.
content.state string Some error diagnostics: generation state.
content.resource string Some occupancy diagnostics: resource type, such as application/bundle.
content.shared boolean Some occupancy diagnostics: whether access is shared.
content.waitedSeconds number Some occupancy diagnostics: seconds already waited.
content.waitSeconds number Some occupancy diagnostics: allowed wait seconds.
content.waitExhausted boolean Some occupancy diagnostics: this wait was exhausted.
content.elapsedSeconds number Some single-file error diagnostics: operation elapsed seconds.
content.phase string Some error diagnostics: failure phase.
content.phaseElapsedSeconds number Some error diagnostics: phase elapsed seconds.
{
  "code": 200,
  "content": true,
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Response

For authentication, rate limiting, and common request errors, see Common Error Definitions.

Storage lifecycle compatibility error codes are retained: 409 is usually still ft.InvalidAction, and the localized message and content.reasonCode further distinguish the cause. Do not treat message names such as SourceMapOperationBusy as a guaranteed errorCode. Reads for a missing package/processing/unavailable usually return 404 ft.SourceMapPackageNotFound; see reasonCode for the specific cause. Retry with backoff only when retryable=true is explicitly returned and the current state allows it; when uploadCommitted=true, do not replay a write that has already been confirmed as published.

HTTP Status errorCode Trigger Condition Message or Response Description Handling
406 ft.ParameterValidationFailed Request field is missing, or the field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError Request JSON syntax is invalid Request JSON format error Correct the JSON according to content.reason, line, and column.
400 ft.JsonFormatError The JSON top level is not an object Format error in some JSON files Submit an object containing appId/filename.
404 ft.NotFoundRumSet The application is not in the current workspace, has been deleted, or does not exist The specified RUM configuration was not found Refresh the RUM Application List and use the actual appId in the current workspace.
409 ft.InvalidAction Upload/read/cleanup conflict, old directory takeover is incomplete, ownership/recovery is pending verification, or the environment/version exceeds the allowed lifecycle range Return a specific localized message based on reasonCode, for example, the SourceMap is being used by another upload, read, or cleanup operation Read content.reasonCode/action/retryable: for active_operation/active_upload, etc., back off as instructed; for owner_recovery_required/ownership_verification_required/legacy_invalid, etc., ask the administrator to verify first, and do not delete the occupancy record or force an overwrite yourself. For invalid_scope, check that env/version are at most 256 characters.
406 ft.InvalidFileName File relative path, symbolic link, or historical release path is unsafe The SourceMap file path does not meet requirements or contains an unsupported link. Check the relative path and directory structure of the uploaded file. Use a valid relative path within the package that does not contain .., backslashes, or absolute paths/symbolic links; check reasonCode=invalid_path.
413 ft.SourceMapUploadTooLarge Single-file or total counted version capacity exceeds the site limit (default 2147483648 bytes) The SourceMap upload or counted version capacity exceeds the limit (see content for the specific number of bytes). Reduce the total number of files for the environment/version, read content.actualBytes/maxBytes, or ask the administrator to check the limit.
500 ft.InternalServerError Database, Redis, storage read/write, queue, or unhandled system exception Internal error Retain the traceId, application/env/version/uploadId, and first check the list/file tree; a failure may already have file publication or processing marks, so do not blindly overwrite/delete again.

Feedback

Is this page helpful?