{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/es/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Plantilla de llamada vía HTTP","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"plantilla-de-llamada-vía-http","__idx":0},"children":["Plantilla de llamada vía HTTP"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-obtener-autorización-token-oauth2","__idx":1},"children":["1. Obtener autorización (Token OAuth2)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Antes de llamar a cualquier API funcional, debe intercambiar sus credenciales por un ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Token de acceso JWT"]},"."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Punto final:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST https://api.morelogin.com/oauth2/token"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Documentación oficial:"]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://guide.morelogin.com/api-reference/open-api/open-api/authorization/paths/~1oauth2~1token/post"},"children":["Ruta de autorización"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"solicitud-curl","__idx":2},"children":["Solicitud (cURL)"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -i -X POST \\\n  https://api.morelogin.com/oauth2/token \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"client_id\": 1672940217990530,\n    \"client_secret\": \"your_client_secret\",\n    \"grant_type\": \"client_credentials\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"ejemplo-de-respuesta","__idx":3},"children":["Ejemplo de respuesta"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"code\": 0,\n    \"data\": {\n        \"access_token\": \"eyJhbGciOiJIUzI1NiIsIn...\",\n        \"token_type\": \"Bearer\",\n        \"expires_in\": 3600\n    }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-ejecutar-plantilla-de-cloud-phone","__idx":4},"children":["2. Ejecutar plantilla de Cloud Phone"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Utilice el token de acceso obtenido en el paso 1 para activar una plantilla RPA específica."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Punto final:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST https://api.morelogin.com/cloudphone/rpa/onceTask/save"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Documentación oficial:"]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://guide.morelogin.com/api-reference/open-api/open-api/cloud-phoneschedules-management/paths/~1cloudphone~1rpa~1oncetask~1save/post"},"children":["Ruta de ejecución programada"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"solicitud-curl-1","__idx":5},"children":["Solicitud (cURL)"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"curl -i -X POST \\\n  https://api.morelogin.com/cloudphone/rpa/onceTask/save \\\n  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n    \"cloudPhoneId\": 16783319661123,\n    \"scheduleName\": \"test_automation\",\n    \"templateId\": 1678347487160256,\n    \"templateParameter\": \"{\\\"Video Caption\\\": \\\"Hello World\\\", \\\"AI Label\\\": true}\",\n    \"description\": \"schedule description\"\n  }'\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"3-desglose-de-parámetros","__idx":6},"children":["3. Desglose de parámetros"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"cómo-obtener-los-id","__idx":7},"children":["¿Cómo obtener los ID?"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Autorización:"]}," Se obtiene mediante el endpoint ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/oauth2/token"]},"."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["cloudPhoneId:"]}," Se encuentra en el panel de control de MoreLogin Cloud Phone (ID numérico)."]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["templateId:"]}," Se encuentra en el mercado de plantillas de automatización o en la lista de plantillas personales."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"comprensión-de-templateparameter","__idx":8},"children":["Comprensión de templateParameter"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Este es un objeto JSON en formato de cadena. Debe definir las claves según los requisitos de la plantilla y luego convertirlas a cadena."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Ejemplo de definición de plantilla:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"Video Caption\": \"string\",\n    \"AI Label\": \"boolean\",\n    \"Product Id\": \"number\",\n    \"Get Leads\": \"boolean\",\n    \"Comment\": \"string\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Cómo mapearlo en tu solicitud:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Para pasar valores a la definición anterior, el valor de tu templateParameter debe tener este aspecto:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"templateParameter\": \"{\\\"Video Caption\\\": \\\"My Title\\\", \\\"AI Label\\\": true, \\\"Product Id\\\": 12345}\"\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"4-manejo-de-errores","__idx":9},"children":["4. Manejo de errores"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| Estado | Posible motivo |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| ---------------- | ------------------------------------------------------------ |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| 401 No autorizado | Token caducado o credenciales de cliente no válidas. |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| 400 Solicitud incorrecta | CloudPhoneId no válido o JSON mal formado en templateParameter. |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| 404 No encontrado | El templateId no existe. |"]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"inicio-rápido-de-python","__idx":10},"children":["Inicio rápido de Python"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"import requests\nimport json\n\ndef run_morelogin_task():\n    # 1. Auth\n    auth_res = requests.post(\n        \"https://api.morelogin.com/oauth2/token\",\n        json={\n            \"client_id\": 1672940217990530,\n            \"client_secret\": \"your_secret\",\n            \"grant_type\": \"client_credentials\"\n        }\n    )\n    token = auth_res.json()['data']['access_token']\n\n    # 2. Execute\n    task_payload = {\n        \"cloudPhoneId\": 16783319661123,\n        \"templateId\": 1678347487160256,\n        \"templateParameter\": json.dumps({\n            \"Video Caption\": \"My Post\",\n            \"AI Label\": True\n        })\n    }\n    \n    headers = {\"Authorization\": f\"Bearer {token}\"}\n    response = requests.post(\n        \"https://api.morelogin.com/cloudphone/rpa/onceTask/save\",\n        json=task_payload,\n        headers=headers\n    )\n    return response.json()\n\nprint(run_morelogin_task())\n","lang":"python"},"children":[]}]},"headings":[{"value":"Plantilla de llamada vía HTTP","id":"plantilla-de-llamada-vía-http","depth":1},{"value":"1. Obtener autorización (Token OAuth2)","id":"1-obtener-autorización-token-oauth2","depth":2},{"value":"Solicitud (cURL)","id":"solicitud-curl","depth":3},{"value":"Ejemplo de respuesta","id":"ejemplo-de-respuesta","depth":3},{"value":"2. Ejecutar plantilla de Cloud Phone","id":"2-ejecutar-plantilla-de-cloud-phone","depth":2},{"value":"Solicitud (cURL)","id":"solicitud-curl-1","depth":3},{"value":"3. Desglose de parámetros","id":"3-desglose-de-parámetros","depth":2},{"value":"¿Cómo obtener los ID?","id":"cómo-obtener-los-id","depth":3},{"value":"Comprensión de templateParameter","id":"comprensión-de-templateparameter","depth":3},{"value":"4. Manejo de errores","id":"4-manejo-de-errores","depth":2},{"value":"Inicio rápido de Python","id":"inicio-rápido-de-python","depth":2}],"frontmatter":{"seo":{"title":"Plantilla de llamada vía HTTP"}},"lastModified":"2026-06-10T11:47:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/es/rparobotic-process-automation/04-integration/call-template-via-http","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}