File Service

The FileService methods allow you to create and modify files inside the Infusionsoft System.


FileService.getFile

This method retrieves the file data for the given ID number.

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
FileId int The ID of the file you would like to return.

Sample Request

<?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>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>fileData</value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$fileId = 64;
$myUrl = $app->getFile($fileId);

FileService.getDownloadUrl

This method will return a string of the download URL for the given file.

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
FileId int The ID of the file url to be returned.

Sample Request

<?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>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        https://d1yoaun8syyxxt.cloudfront.net/vuurr24-oyyiqfanmyqasnemdveoikolqesnxkxp-v2
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$fileId = 64;
$myUrl = $app->getDownloadUrl($fileId);

FileService.uploadFile

This method uploads the file to Infusionsoft. The optional contactId parameter is used to place the file in a specific contact's filebox.

Required Parameters

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.

Sample Request

<?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>

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
  <params>
    <param>
      <value><i4>482</i4></value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

					

FileService.replaceFile

This method will return a string of the download URL for the given file.

Required Parameters

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.

Sample Request

<?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>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value><boolean>1</boolean></value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$fileId = 64;
$myUrl = $app->getDownloadUrl($fileId);

FileService.renameFile

This method will return a string of the download URL for the given file.

Required Parameters

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.

Sample Request

<?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>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <boolean>
          1
        </boolean>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$app->renameFile(1, "new_name.pdf");