Schedule to 2 SFTP Servers Via the API

Knowledge Drop

Last tested: Jan 20, 2020

You can send a single schedule to 2 SFTP servers using the API! In order to get this working, you must add an additional JSON dictionary object to the “scheduled_plan_destination” section of the JSON body like so:

“scheduled_plan_destination”: [
{
“id”: 12804,
“scheduled_plan_id”: 5175,
“format”: “wysiwyg_pdf”,
“apply_formatting”: true,
“apply_vis”: true,
“address”: “sftp://myserver.com/files/”,
“type”: “sftp”,
“parameters”: “{"username":"sftpuser"}”,
“secret_parameters”: “{"password":"mypassword/"}”,
“message”: null,
“looker_recipient”: false
},
{
“id”: 12804,
“scheduled_plan_id”: 5175,
“format”: “wysiwyg_pdf”,
“apply_formatting”: true,
“apply_vis”: true,
“address”: “sftp://otherserver.com/file_path_sftp/”,
“type”: “sftp”,
“parameters”: “{"username":"otheruser"}”,
“secret_parameters”: “{"password":"otherpassword/"}”,
“message”: null,
“looker_recipient”: false
}
],

In Looker SFTP we only allow username/password auth, and here in the JSON body the ‘username’ is included with the ‘parameters’ key-value-pair, and the password is included in the ‘secret_parameters’ KVP.

If you are modifying an existing plan, Looker will look up the secret_parameter associated with that SFTP server’s username. However, since in the UI it’s not possible to directly send to 2 SFTP servers, you’ll have to include the second SFTP server’s secret_parameter, unless you are sending to the same server twice.