Delete Files

Deletes a file from the Planning repository. See About the EPM Automate Utility. This REST API is version

Specify the filename with path separators in percent-encoding format, for example, using %5C as the encoded value for \ (file separator). For a file named inbox/file1.csv, pass it as inbox%5Cfile1.csv. If you are calling the cURL command to trigger the REST API, you can use a backslash \ for the path separator without URL encoding.

REST Resource

DELETE /interop/rest/{api_version}/applicationsnapshots/{applicationSnapshotName


Supported Media Types: application/json


The following table summarizes the request parameters.

Table 6-13 Parameters

Name Description Type Required Default
api_version Specific API version Path Yes None
applicationSnapshotName Application snapshot name that needs to be deleted Path Yes None


Supported Media Types: application/json

Table 6-14 Parameters

Parameters Description
Details Published if there is an error with the error string
Status See Migration Status Codes
Links Detailed information about the link
Href Links to the API call
Action The HTTP call type
Rel Possible value: self
Data Parameters as key value pair passed in the request

Example of Response Body


Delete Files Sample Code

Example 6-14 Java Sample –

Prerequisites: json.jar

Common Functions: See Common Helper Functions for Java

// BEGIN - Delete a file in PBCS
public void deleteFile(String fileName) throws Exception {
	String urlString = String.format("%s/interop/rest/%s/applicationsnapshots/%s", serverUrl, apiVersion, fileName);
	String response = executeRequest(urlString, "DELETE", null);
	JSONObject json = new JSONObject(response);
	int resStatus = json.getInt("status");
	if (resStatus == 0)
		System.out.println("File deleted successfully");
		System.out.println("Error deleting file : " + json.getString("details"));
// END - Delete a file in PBCS

Example 6-15 cURL Sample –

Prerequisites: jq (

Common Functions: See Common Helper Functions for cURL

funcDeleteFile() {
	encodedFileName=$(echo $1 | sed -f urlencode.sed)
	funcExecuteRequest "DELETE" $url

	output=`cat response.txt`
	status=`echo $output | jq '.status'`
    if [ $status == 0 ]; then
        echo "Deleted successfully"
        error=`echo $output | jq '.details'`
        echo "Error occurred. " $error
	funcRemoveTempFiles "respHeader.txt" "response.txt"

Example 6-16 Groovy Sample – DeleteFile.groovy

Prerequisites: json.jar

Common Functions: CSS Common Helper Functions for Groovy

def deleteFile(filename) {
	def url;
	try {
		String encodedFileName = URLEncoder.encode(filename, "UTF-8");
		url = new URL(serverUrl + "/interop/rest/" + apiVersion + "/applicationsnapshots/" + encodedFileName)
	} catch (MalformedURLException e) {
		println "Malformed URL. Please pass valid URL"
	response = executeRequest(url, "DELETE", null);
	def object = new JsonSlurper().parseText(response)
	def status = object.status
	if (status == 0 )
		println "File deleted successfully"
	else {
		println "Error occurred while deleting file"
		if (object.details != null)
			println "Error details: " + object.details