The FileService methods allow you to create and modify files inside the Infusionsoft System.
This method retrieves the file data for the given ID number.
Parameter Name | Type | Definition |
---|---|---|
privateKey | string | Your Infusionsoft API key |
FileId | int | The ID of the file you would like to return. |
<?xml version='1.0' encoding='UTF-8'?> <methodCall> <methodName>FileService.getFile</methodName> <params> <param> <value><string>privateKey</string></value> </param> <param> <value><int>fileUID</int></value> </param> </params> </methodCall>
<?xml version='1.0' encoding='UTF-8'?> <methodResponse> <params> <param> <value>fileData</value> </param> </params> </methodResponse>
$fileId = 64; $myUrl = $app->getFile($fileId);
This method will return a string of the download URL for the given file.
Parameter Name | Type | Definition |
---|---|---|
privateKey | string | Your Infusionsoft API key |
FileId | int | The ID of the file url to be returned. |
<?xml version='1.0' encoding='UTF-8'?> <methodCall> <methodName>FileService.getDownloadUrl</methodName> <params> <param> <value><string>privateKey</string></value> </param> <param> <value><int>fileUID</int></value> </param> </params> </methodCall>
<?xml version='1.0' encoding='UTF-8'?> <methodResponse> <params> <param> <value> https://d1yoaun8syyxxt.cloudfront.net/vuurr24-oyyiqfanmyqasnemdveoikolqesnxkxp-v2 </value> </param> </params> </methodResponse>
$fileId = 64; $myUrl = $app->getDownloadUrl($fileId);
This method uploads the file to Infusionsoft. The optional contactId parameter is used to place the file in a specific contact's filebox.
Parameter Name | Type | Definition |
---|---|---|
privateKey | string | Your Infusionsoft API key |
FileName | string | The name of the file to be uploaded |
Base64EncodedData | string | A string that is 64 base encoded. |
ContactId (optional) | int | ID of the contact record to add the file to. |
<?xml version='1.0' encoding='UTF-8'?> <methodCall> <methodName>FileService.uploadFile</methodName> <params> <param> <value><string>privateKey</string></value> </param> <param> <value><int>contactID</int></value> </param> <param> <value><string>fileName</string></value> </param> <param> <value><string>RGVycE15RGVycA==.......base64EncodedFile</string></value> </param> </params> </methodCall>
<?xml version="1.0" encoding="UTF-8"?> <methodResponse> <params> <param> <value><i4>482</i4></value> </param> </params> </methodResponse>
This method will return a string of the download URL for the given file.
Parameter Name | Type | Definition |
---|---|---|
privateKey | string | Your Infusionsoft API key |
FileId | int | ID of the file to be replaced. |
Base64EncodedData | string | New string of data. |
<?xml version='1.0' encoding='UTF-8'?> <methodCall> <methodName>FileService.replaceFile</methodName> <params> <param> <value><string>privateKey</string></value> </param> <param> <value><int>fileID</int></value> </param> <param> <value><string>base64EncodedFile</string></value> </param> </params> </methodCall>
<?xml version='1.0' encoding='UTF-8'?> <methodResponse> <params> <param> <value><boolean>1</boolean></value> </param> </params> </methodResponse>
$fileId = 64; $myUrl = $app->getDownloadUrl($fileId);
This method will return a string of the download URL for the given file.
Parameter Name | Type | Definition |
---|---|---|
privateKey | string | Your Infusionsoft API key |
FileId | int | Id of the file to be renamed. |
fileName | string | New string of data. |
<?xml version="1.0"?> <methodCall> <methodName>FileService.renameFile</methodName> <params> <param> <value><string>privateKey</string></value> </param> <param> <value><int>fileUID</int></value> </param> <param> <value><string>fileName</string></value> </param> </params> </methodCall>
<?xml version='1.0' encoding='UTF-8'?> <methodResponse> <params> <param> <value> <boolean> 1 </boolean> </value> </param> </params> </methodResponse>
$app->renameFile(1, "new_name.pdf");