Skip to main content
deleted 1 character in body
Source Link

I have an SSJS code script that can create a File Transfer Activity but by default, it's made File Action is "Manage File" so how can I change it to "Move a File From Safehouse". Here is my code:

Thank in advance!

function execute_Create_FileTransfer(accessToken) {
 var restEndpoint = 'https://xxxx.rest.marketingcloudapis.com';
 var url = restEndpoint + 'automation/v1/filetransfers';
 var payload = {
        Name: 'xxxxx',
        CustomerKey: 'xxxxx',
        FileTransferLocationId: "yyyy",
        Description: "FileTransferTest",
        FileSpec: 'testing.csv'
    }
 var req = new Script.Util.HttpRequest(url);
 req.emptyContentHandling = 0;
 req.retries = 2;
 req.continueOnError = true;
 req.contentType = "application/json";
 req.setHeader("Authorization", "Bearer " + accessToken);
 req.method = "UTF-8";"POST";
 req.postData = Stringify(payload);

 var resp = req.send();
}

I have an SSJS code script that can create a File Transfer Activity but by default, it's made File Action is "Manage File" so how can I change it to "Move a File From Safehouse". Here is my code:

Thank in advance!

function execute_Create_FileTransfer(accessToken) {
 var restEndpoint = 'https://xxxx.rest.marketingcloudapis.com';
 var url = restEndpoint + 'automation/v1/filetransfers';
 var payload = {
        Name: 'xxxxx',
        CustomerKey: 'xxxxx',
        FileTransferLocationId: "yyyy",
        Description: "FileTransferTest",
        FileSpec: 'testing.csv'
    }
 var req = new Script.Util.HttpRequest(url);
 req.emptyContentHandling = 0;
 req.retries = 2;
 req.continueOnError = true;
 req.contentType = "application/json";
 req.setHeader("Authorization", "Bearer " + accessToken);
 req.method = "UTF-8";
 req.postData = Stringify(payload);

 var resp = req.send();
}

I have an SSJS code script that can create a File Transfer Activity but by default, it's made File Action is "Manage File" so how can I change it to "Move a File From Safehouse". Here is my code:

Thank in advance!

function execute_Create_FileTransfer(accessToken) {
 var restEndpoint = 'https://xxxx.rest.marketingcloudapis.com';
 var url = restEndpoint + 'automation/v1/filetransfers';
 var payload = {
        Name: 'xxxxx',
        CustomerKey: 'xxxxx',
        FileTransferLocationId: "yyyy",
        Description: "FileTransferTest",
        FileSpec: 'testing.csv'
    }
 var req = new Script.Util.HttpRequest(url);
 req.emptyContentHandling = 0;
 req.retries = 2;
 req.continueOnError = true;
 req.contentType = "application/json";
 req.setHeader("Authorization", "Bearer " + accessToken);
 req.method = "POST";
 req.postData = Stringify(payload);

 var resp = req.send();
}
Source Link

How can I create a File Transfer Activity in Automation with File Action is "Move a File From Safehouse" by API/SSJS in Marketing Cloud?

I have an SSJS code script that can create a File Transfer Activity but by default, it's made File Action is "Manage File" so how can I change it to "Move a File From Safehouse". Here is my code:

Thank in advance!

function execute_Create_FileTransfer(accessToken) {
 var restEndpoint = 'https://xxxx.rest.marketingcloudapis.com';
 var url = restEndpoint + 'automation/v1/filetransfers';
 var payload = {
        Name: 'xxxxx',
        CustomerKey: 'xxxxx',
        FileTransferLocationId: "yyyy",
        Description: "FileTransferTest",
        FileSpec: 'testing.csv'
    }
 var req = new Script.Util.HttpRequest(url);
 req.emptyContentHandling = 0;
 req.retries = 2;
 req.continueOnError = true;
 req.contentType = "application/json";
 req.setHeader("Authorization", "Bearer " + accessToken);
 req.method = "UTF-8";
 req.postData = Stringify(payload);

 var resp = req.send();
}