JDBC Driver for Xero

Build 24.0.9060

UploadFile

Uploads a file to the Xero Files service

Procedure-Specific Information

There are a few different ways to upload a file:

1. Provide the full path to a local file. This will create a file with the same name and content in Xero:

EXECUTE UploadFile @Filename = 'c:/my/xero/files/form.docx

2. Provide the full path to a local file as well as a Name. This will still upload the content in the file, but lets you change the name of the file in Xero:

EXECUTE UploadFile @Filename = 'c:/my/xero/files/form.docx', @Name = 'legal-form.docx'

3. Provide the file's content in base64 and the name the file should receive in Xero:

EXECUTE UploadFile @Name = hello.txt', @FileData = 'SGVsbG8sIFdvcmxkIQo=' 

In addition, you can provide a ContentType to override what type Xero should use when classifying the file. Please note however that Xero only supports a limited number of MIME types, which are listed in the Xero Central article on managing the file library.

Input

Name Type Required Accepts Input Streams Description
Name String False False The name the file will receive when uploaded. If not given, it will be determined from Filename.
ContentType String False False This parameter explicitly sets the MIME type for the document. If left empty, it will be determined automatically.
FileData String False False Base-64 encoded data for the file. Required if Filename and FileStream are not defined.
FileStream String False True Stream of input data. Required if Filename and FileData are not defined.
Filename String False False The full path (including filename) of the file to be uploaded. Required if FileData and FileStream are not defined.
TenantId String False False The ID of the tenant to query instead of the connection tenant

Result Set Columns

Name Type Description
Success String Whether the operation was successful or not.
FileId String The unique Xero-generated ID of the file
Name String The name of the uploaded file
FolderId String The FolderId the file was uploaded to
MimeType String What type of data the uploaded file contains
Size Int The size of the uploaded file in bytes
User_Id String The unique ID of the user who uploaded the file
User_Name String The username of the user who uploaded the file
User_FirstName String The first name of the user who uploaded the file
User_LastName String The last name of the user who uploaded the file
User_FullName String The full name of the user who uploaded the file
Created Datetime When the file was first uploaded
Updated Datetime When the file was last changed

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060