0

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();
}

1 Answer 1

1

You just need to specify the property isUpload = true in your payload, then the file transfer action will be "Move A file From Safehouse"

Try your payload like this:

 var payload = {
        name: 'xxxxx',
        customerKey: 'xxxxx',
        fileTransferLocationId: "yyyy",
        isUpload: true,
        description: "FileTransferTest",
        fileSpec: 'testing.csv'
    }
4
  • It's worked, thanks a lot for your help
    – Tung Dang
    Commented Feb 10, 2023 at 1:54
  • @TungDang I am glad to know it is helpful for you. As it worked, please mark the answer as an accepted answer. Thanks.
    – Duc Le
    Commented Feb 10, 2023 at 2:07
  • btw Do you know how to update a File Transfer Activity by API/SSJS? I tried then it return success but it was not applied on UI :(
    – Tung Dang
    Commented Feb 10, 2023 at 4:05
  • @TungDang you would want to post a new question with related information there, then everyone can take a look at it
    – Duc Le
    Commented Feb 10, 2023 at 8:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .