The "result of step 3" part when I use deep api to translate pdf says empty

Hello
I am doing a pdf translation project and I am using deepL API. I am having trouble in the download part where in the API connection part, the part that calls “Download translated document” it gives the translated pdf result which is exactly what the system should do. When I do it on the workflow, step 1 “upload document” provides document_id and document_key which are the two things that when the system completes the translation it will provide and part 2 “check document status” to check the progress of completion or not to bring to the final part “Download translated document” to provide the file for the user to view and download. My workflow runs according to these and there is no error as shown in figure 2,3,4




The “download the translated document” part has given the correct document_key and document_id used to export the file for users to view and download. But when I go to the next step and see the result of step 3, it says empty and doesn’t give me anything to view and download.

Here is the part in the api connector i used



Here is the part in workflow I used





Please help me

Hey @phannhatvinhh99 :wave:

Hmm. Good question. :thinking: It’s most likely not ready to download yet. You have to see if there is a way to use a webhook, or keep looping until it’s actually ready to download. Does that make sense. :blush:

I tried using postman and it worked. But on bubble.io it didn’t. I also tried looping but the document result still got the correct key and id of step 1 but the next part still continued to be “empty”

:thinking: What does it show in the logs or when you do a step by step?

Their API docs say the status will say “done” not Completed like your condition on step 3. Not sure if that is a mistake on the API docs in your expression

If that is not the issue then I agree with @J805 the document isn’t ready yet, Step 2 runs and probably returns its still translating so step 3’s condition fails because it wasn’t done.

In Postman your steps were probably manually one at a time, so there’s was lots of time between API calls.

The API docs say it provides a seconds_remaining value in the response. You can create a chain of two CEs (custom events) where CE 1 checks the status, if it is done then download, if not schedule CE 2 with a delay of the seconds_remaining inside CE 2 schedule CE 1 again with delay of 0.001.

Essentially polling for status like they recommend in their docs. It does say seconds_remaining can be unreliable so not sure if you will have to fallback to just polling every few seconds

My step by step loop


Here is backend workflow



Here is workflow after backend workflow

Can you make sure ‘Completed’ is the correct condition to look for and not ‘done’? Maybe loop and just save the values to see what it actually says? Like @tylerboodman maybe it’s just incorrect documentation potentially.