Skip to main content

 –

Create file API

Suggest edit Updated on August 16, 2021

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 save plan for a data page in Dev Studio.

Did you find this content helpful? YesNo

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us