Create file API

The create file API is a savable data page, D_pxNewFile. The API represents the new file as a data page when it is loaded. You can use this API to create a file or overwrite an existing file.

To define a file with this API, define the following parameters:

  • repositoryName – the name of the repository in which to create the file.
  • filePath – the path, including the name of the file, to be created, relative to the root path of the repository. To find out what the path is, run D_pxListFiles against the repository and view the pyPath property.

This API accepts a base-64 string as the file content or a java.io.InputStream object as the source for file content. If both options are specified, preference is given to the string. If neither option is specified, an empty file is created.

Set the file content, pyContents, or the stream, pyStream, on the data page.

Note: For large files, use the java.io.InputStream option.

To create a file, save the savable data page. For information about how to save savable data pages, see step 13 in Creating a data page save plan.