XeroAPI/Xero-Java

Wrong Files API base path

AmzDevelopmentTeam opened this issue · 2 comments

Files API is setting the base path "https://api.xero.com/api.xro/2.0", but the correct base path for Files API is "https://api.xero.com/files.xro/1.0".

Here's where the default base path is set

private static final String defaultBasePath = "https://api.xero.com/api.xro/2.0";

And where the incorrect Files path is set

UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Files");

Hi @AmzDevelopmentTeam, thanks for digging into this. You are correct that the default ApiClient will result in the incorrect base path for the Files API. We'll take a look at this to see if something should be changed but in the meantime you could implement the following:

        // Init Files client
        ApiClient defaultFilesClient = new ApiClient("https://api.xero.com/files.xro/1.0",null,null,null,null);
        // Get Singleton - instance of files client
        filesApi = FilesApi.getInstance(defaultFilesClient);

An example of this approach can be found here in our Java sample app.

Closing this issue because the SDK is working as designed. An example of how to instantiate the client with the proper url can be found in our sample app here.

If you are still experiencing issues please re-open this ticket.