{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/es/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Operaciones asíncronas"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"operaciones-asíncronas","__idx":0},"children":["Operaciones asíncronas"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Algunas operaciones de MoreLogin aceptan el trabajo antes de que el navegador, Cloud Phone, archivo, aplicación o ejecución de RPA subyacente alcance su estado final. Una respuesta de envío correcta significa que la petición se aceptó; no siempre significa que el estado solicitado ya se haya alcanzado."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"modelo-de-estados-del-cliente","__idx":1},"children":["Modelo de estados del cliente"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Estado"},"children":["Estado"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Significado"},"children":["Significado"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Acción del cliente"},"children":["Acción del cliente"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Enviado"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["La API aceptó el comando o creó una tarea"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Guarda los ID devueltos y ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requestId"]},"; no reenvíes de inmediato la misma escritura"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Pendiente o en curso"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["La operación posterior sigue avanzando"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Consulta el endpoint documentado de estado/resultado con intervalos crecientes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Correcto"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["El recurso o la tarea alcanzó su estado terminal de éxito"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Deja de consultar y continúa el flujo"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Fallido"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["El endpoint de estado/resultado informa un fallo o un error de negocio terminal"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Detén los reintentos automáticos; conserva los ID, los detalles del fallo y ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requestId"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Resultado desconocido"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["La escritura expiró o la conexión se cerró sin una respuesta utilizable"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Consulta el estado actual del recurso o la tarea antes de decidir si reintentas"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"reglas-de-consulta-periódica","__idx":2},"children":["Reglas de consulta periódica"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Empieza sobre 1 segundo y aumenta el intervalo a 2, 4 y 8 segundos, con un tope de 15–30 segundos."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Aplica jitter para que varios clientes no consulten en el mismo instante."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Detente en un estado terminal documentado; no consultes indefinidamente."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Interpreta ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data: null"]}," como pendiente solo cuando el endpoint documente ese comportamiento explícitamente."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Un tiempo de espera de transporte en una escritura no es prueba de fallo."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"flujos-documentados","__idx":3},"children":["Flujos documentados"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Flujo"},"children":["Flujo"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Operación de envío"},"children":["Operación de envío"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Operación de observación"},"children":["Operación de observación"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Estado terminal"},"children":["Estado terminal"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Inicio/parada del cloud browser"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudbrowser/start"]}," o ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/cloudbrowser/stop"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudbrowser/page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["El runtime alcanza el estado previsto o desaparece tras la parada"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Encendido del Cloud Phone"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/powerOn"]}," o ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/cloudphone/powerOff"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/page"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["envStatus=4"]}," encendido o ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["envStatus=2"]}," apagado; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]}," es fallo de creación"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Subida de archivos al Cloud Phone"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Sube a la URL firmada y luego ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/uploadFile"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/uploadFileResult"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status=1"]}," correcto o ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status=2"]}," fallido; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["data: null"]}," y ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status=0"]}," son pendientes"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Descarga del Cloud Phone"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/download"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/download/result"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["status=20"]}," correcto, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["30"]}," fallido o ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["40"]}," cancelado; ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["10"]}," es en curso"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Instalación de aplicaciones"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/app/install"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/app/installedList"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["El paquete solicitado aparece en la lista de aplicaciones instaladas"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Programación/ejecución de RPA"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/rpa/task/save"]}," o ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/onceTask/save"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/rpa/task/page"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/subTask/page"]}," y ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/subTask/detail/{id}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["taskState=2"]}," completado o ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["3"]}," cancelado; revisa ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["handleResult"]}," (",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]}," fallido, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]}," correcto)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Transmisión en directo"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/live/start"]}," o ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/live/end"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudphone/live/status"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["El estado confirma que la transmisión empezó o se detuvo"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Subida a cloud storage"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudstorage/upload/init"]},", seguido del ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT"]}," al almacén de objetos"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /cloudstorage/upload/complete"]}," después de que cada PUT necesario tenga éxito"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["La respuesta de finalización es correcta; nunca llames a complete antes de que la subida del objeto tenga éxito"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Los equivalentes de la Local API usan el prefijo ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/api"]}," donde está documentado. Consulta la ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/es/api-reference/getting-started/endpoint-behavior"},"children":["Matriz de reintentos y finalización de endpoints"]}," para la guía operación por operación."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"ejemplo-de-recuperación-tras-un-tiempo-de-espera","__idx":4},"children":["Ejemplo de recuperación tras un tiempo de espera"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"try:\n    submit_operation()\nexcept TimeoutError:\n    # The write may already have succeeded.\n    current = query_current_state()\n    if current.is_terminal_success:\n        pass\n    elif current.is_pending:\n        poll_until_terminal()\n    else:\n        decide_whether_retry_is_safe(current)\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["La API pública no define actualmente una cabecera general de clave de idempotencia. Por eso los ID de recurso, los ID de tarea, las consultas de estado y ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["requestId"]}," son esenciales para una recuperación segura."]}]},"headings":[{"value":"Operaciones asíncronas","id":"operaciones-asíncronas","depth":1},{"value":"Modelo de estados del cliente","id":"modelo-de-estados-del-cliente","depth":2},{"value":"Reglas de consulta periódica","id":"reglas-de-consulta-periódica","depth":2},{"value":"Flujos documentados","id":"flujos-documentados","depth":2},{"value":"Ejemplo de recuperación tras un tiempo de espera","id":"ejemplo-de-recuperación-tras-un-tiempo-de-espera","depth":2}],"frontmatter":{"seo":{"title":"Operaciones asíncronas"}},"lastModified":"2026-09-03T05:46:01.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/es/api-reference/getting-started/async-operations","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}