Skip to content

TaskResponse object returned after waiting for a job request does not have the url string to download the file #51

@DanielAlmeidaJoao

Description

@DanielAlmeidaJoao

Hello!

I am trying to use your code to convert an image to a pdf. The upload seems to work, I can see on the dashboard/tasks import/upload SUCCESS, but the TaskResponse object does not include the url to download the file. The following code is not working because exportUrl is null.

// Wait for an export/url task to be finished
final TaskResponse waitUrlExportTaskResponse = asyncCloudConvertClient.tasks().wait(exportUrlTaskId).get().getBody();

// Get a url of export/url task
final String exportUrl = waitUrlExportTaskResponse.getResult().getFiles().get(0).get("url");
final String filename = waitUrlExportTaskResponse.getResult().getFiles().get(0).get("filename");

// Get file as input stream using url of export/url task
final InputStream inputStream = asyncCloudConvertClient.files().download(exportUrl).get().getBody();

// Save to local file
OutputStream outputStream = new FileOutputStream(new File(filename));
IOUtils.copy(inputStream, outputStream);

One more thing, include working examples, instead of just snippets of codes that do not work. I was also trying to use your API to upload files with node.js, and it was a pain in the ass, I did not succeed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions