JDBC Driver for eBay

Build 22.0.8462

UploadFile

Uploads a file to the EBay account.

Stored Procedure Specific Information

This procedure associates the specified file with the specified task ID and uploads the input file. After the file has been uploaded, the processing of the file begins.

The inputs required to upload a file are the following: TaskID and FilePath.

Upload a file

You can follow the procedure below to submit a successful upload file procedure:

  1. Use the Tasks table to create a new Task. You can use the following query:
    INSERT INTO [Tasks] (FeedType, MarketplaceID, SchemaVersion) VALUES ('LMS_ADD_ITEM', 'EBAY_US', '1149')
  2. You can get newly generated TaskID either from the generated keys, or by using the Tasks table again to select.
        Statement stat = conn.createStatement();
        stat.executeUpdate("INSERT INTO [Tasks] (FeedType, MarketplaceID, SchemaVersion) VALUES ('LMS_ADD_ITEM', 'EBAY_US', '1149')", Statement.RETURN_GENERATED_KEYS);
        ResultSet rs = stat.getGeneratedKeys();
        while (rs.next()) {
          for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
            System.out.println(rs.getMetaData().getColumnName(i) + "=" + rs.getString(i));
          }
        }
    or
    SELECT * FROM [Tasks] WHERE FeedType = 'LMS_ADD_ITEM' AND CreationDate > '2021-11-16 09:19:00'
  3. Use this task id as input together with the FilePath of the file to be uploade, in the UploadFile stored procedure.
        CallableStatement callableStatement = conn.prepareCall("UploadFile");
        callableStatement.setString("TaskID", "task-5-1XXXXX");
        callableStatement.setString("FilePath", "C:\\Users\\User\\Documents\\upload.csv");
    
        boolean ret = callableStatement.execute();
        if (!ret) {
          int count = callableStatement.getUpdateCount();
          if (count != -1) {
            System.out.println("Affected rows: " + count);
          }
        } else {
          ResultSet rs = callableStatement.getResultSet();
          while (rs.next()) {
            for (int i = 1; i <= rs.getMetaData().getColumnCount(); i++) {
              System.out.println(rs.getMetaData().getColumnName(i) + "=" + rs.getString(i));
            }
          }
        }
  4. Then your file should be processing. To track the status you can execute a SELECT query in the Tasks table with the TaskID, and check the Status column.
    SELECT Status FROM [Tasks] WHERE TaskID = '{Generated Task ID}'

Input

Name Type Required Accepts Input Streams Description
TaskID String True False The task_id associated with the file that will be uploaded. This ID was generated when the specified task was created.
FilePath String False False The absolute path of the file to be uploaded.
Content String False True The file's content that you wish to upload should be a stream of input and the FilePath field should be kept blank.
FileName String False False The name of the uploaded file. It should be specified only when uploading the content as InputStream. (With extension)

Result Set Columns

Name Type Description
Success String This parameter sets whether the operation was successful or not.
Description String Description message of the upload operation. It might be an error message or a successful message.

Copyright (c) 2023 CData Software, Inc. - All rights reserved.
Build 22.0.8462