{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/pt/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Chamada de Modelo via 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":"chamada-de-modelo-via-http","__idx":0},"children":["Chamada de Modelo via HTTP"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-obter-autorização-token-oauth2","__idx":1},"children":["1. Obter Autorização (Token OAuth2)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Antes de chamar qualquer API funcional, você deve trocar suas credenciais por um ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Token de Acesso JWT"]},"."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Endpoint:"]}," ",{"$$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":["Documentação Oficial:"]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://guide.morelogin.com/api-reference/open-api/open-api/authorization/paths/~1oauth2~1token/post"},"children":["Caminho de Autorização"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"requisição-curl","__idx":2},"children":["Requisição (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```### Exemplo de Resposta\n\n\n### Exemplo de Resposta```json\n{\n    \"code\": 0,\n    \"data\": {\n        \"access_token\": \"eyJhbGciOiJIUzI1NiIsIn...\",\n        \"token_type\": \"Bearer\",\n        \"expires_in\": 3600\n    }\n}\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"2-executar-modelo-do-cloud-phone","__idx":3},"children":["2. Executar Modelo do Cloud Phone"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use o access_token obtido na Etapa 1 para acionar um modelo RPA específico."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Endpoint:"]}," ",{"$$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":["Documentação 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":["Caminho de Execução do Agendamento"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"requisição-curl-1","__idx":4},"children":["Requisição (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-detalhamento-dos-parâmetros","__idx":5},"children":["3. Detalhamento dos Parâmetros"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"como-obter-os-ids","__idx":6},"children":["Como obter os IDs?"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Authorization:"]}," Obtido através do 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:"]}," Encontrado no painel do 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:"]}," Encontrado no marketplace de modelos de automação ou na lista de modelos pessoais."]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"entendendo-o-parâmetro-templateparameter","__idx":7},"children":["Entendendo o parâmetro templateParameter"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Este é um objeto JSON em formato de string. Você deve definir as chaves com base nos requisitos do modelo e, em seguida, escapá-las como uma string."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Exemplo de Definição de Modelo:"]}]},{"$$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```**Como mapear isso em sua solicitação:**\n\nPara passar valores para a definição acima, o valor do seu parâmetro de modelo deve ser semelhante a este:\n\n**```json\n{\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-tratamento-de-erros","__idx":8},"children":["4. Tratamento de Erros"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| Status | Possível Motivo |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| ---------------- | ------------------------------------------------------------ |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| 401 Não Autorizado | Token expirado ou credenciais do cliente inválidas. |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| 400 Requisição Inválida | cloudPhoneId inválido ou JSON malformado no parâmetro do modelo. |"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["| 404 Não Encontrado | O templateId não existe. |"]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"início-rápido-em-python","__idx":9},"children":["Início Rápido em 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":"Chamada de Modelo via HTTP","id":"chamada-de-modelo-via-http","depth":1},{"value":"1. Obter Autorização (Token OAuth2)","id":"1-obter-autorização-token-oauth2","depth":2},{"value":"Requisição (cURL)","id":"requisição-curl","depth":3},{"value":"2. Executar Modelo do Cloud Phone","id":"2-executar-modelo-do-cloud-phone","depth":2},{"value":"Requisição (cURL)","id":"requisição-curl-1","depth":3},{"value":"3. Detalhamento dos Parâmetros","id":"3-detalhamento-dos-parâmetros","depth":2},{"value":"Como obter os IDs?","id":"como-obter-os-ids","depth":3},{"value":"Entendendo o parâmetro templateParameter","id":"entendendo-o-parâmetro-templateparameter","depth":3},{"value":"4. Tratamento de Erros","id":"4-tratamento-de-erros","depth":2},{"value":"Início Rápido em Python","id":"início-rápido-em-python","depth":2}],"frontmatter":{"seo":{"title":"Chamada de Modelo via HTTP"}},"lastModified":"2026-06-10T11:47:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/pt/rparobotic-process-automation/04-integration/call-template-via-http","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}