Uploads a file from the local machine to the repository. Files on the repository cannot be accessed directly. Use this command to upload data, metadata, and backup snapshots to a service instance. See About the EPM Automate Utility.

If a -1 status is returned and it is the last chunk to be uploaded, this means that an LCM artifact snapshot has been uploaded and zip extraction is in progress. The client pings the URL until the status is a positive integer. This job is done asynchronously.

This REST API is version

REST Resource

POST /interop/rest/{applicationSnapshotName}/contents

Note: For Data Management uploads, use the following JSON format for the query parameter:



Supported Media Types: aapplication/octet-stream


The following table summarizes the client request.

Table 6-6 Parameters

Name Description Type Required Default
api_version Version of the API you are developing with Path Yes None


Table 6-7 Parameters

Name Description Type Required Default
applicationSnapshotName Name of the application snapshot or file name to be uploaded (for example, “Artifact Snapshot.zip” or s112.csv). A file with this name is created in the repository. If a file or folder with this name exists in the repository, an error indicates that a file or folder exists Path Yes None

Used to support upload of Data Management files.

Example: "extDirPath=inbox" where inbox is the folder where the Data Management file is to be uploaded

Example of query parameters in JSON format for Data Management Upload: /interop/rest/{applicationSnapshotName}/contents?extDirPath=inbox

Query No None

Response Body

Supported Media Types: application/json

Table 6-8 Parameters

Name Description
details In case of errors, details are published with the error string
status See Migration Status Codes
links Detailed information about the link
href Links to API call
action The HTTP call type
rel Possible values: self, recreate service
data Parameters as key value pairs passed in the request

Example of Response Body:

The following shows an example of the response body in JSON format.


REST API Examples with Postman

See REST API Examples with Postman.

Upload Sample Code

Example 6-7 Java Sample –

Prerequisites: json.jar

 * Simple Implementation class to execute Upload functionality for API version
public class UploadFile

	private final static String userName ; // User name
	private final static String password ; // Password
	private final static String serverUrl; // Server URL
	private String filePath ; //zip File to be Uploaded
	private String extDirPath = "inbox"; // keep it null for uploading to root directory
	private String details = null;
    public void uploadFile() {		
		boolean status = true;		

		try {			
			status = sendFileContents(filePath, extDirPath);			
				System.out.println("Uploaded contents to " + new File(filePath).getName());
		} catch (Exception e) {

	private boolean sendFileContents(String filePath, String extDirPath)
			throws Exception {
		HttpURLConnection connection = null;
		FileInputStream content = null;
		File file = new File(filePath);
		try {
			String restURL = String.format(
					serverUrl, URLEncoder.encode(file.getName(), "UTF-8"));
			if(null != extDirPath)
				restURL = restURL + "?extDirPath="+extDirPath;
			URL url = new URL(restURL);
			connection = (HttpURLConnection) url.openConnection();
			String creds = null;
			creds = userName + ":" + password;
					"Basic " + new sun.misc.BASE64Encoder().encode(creds.getBytes()));
			connection.setRequestProperty("Content-Type", "application/octet-stream");
			content = new FileInputStream(file);
			OutputStream paramOutputStream = connection.getOutputStream();
			if (content != null) {
	            byte[] arrayOfByte = new byte[4096];	            
	            boolean hasMore = true;
	            while (hasMore) {
	                int j = content.read(arrayOfByte);
	                if (j < 0) {
	                	hasMore = false;
	                paramOutputStream.write(arrayOfByte, 0, j);	             
			int statusCode = connection.getResponseCode();
			String responseBody = getStringFromInputStream(connection.getInputStream());
			if (statusCode == 200 && responseBody != null) {
				int commandStatus = getCommandStatus(responseBody);
				if (commandStatus == -1) {
					getJobStatus(fetchPingUrlFromResponse(responseBody, "Job Status"), "GET");
				if (commandStatus == 0) {					
					return true;
					details = getDetails(responseBody);

			return false;
		} finally {
			if(null != content)
			if (connection != null)

 * Method to retrieve the error message
 * @param response
 * @return String details
 * @throws Exception
	private String getDetails(String response) throws Exception {
		JSONObject json = new JSONObject(response);
		if (!JSONObject.NULL.equals(json.get("details")))
			return json.getString("details");
			return "NA";