{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/uk/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Шаблон виклику через 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":"шаблон-виклику-через-http","__idx":0},"children":["Шаблон виклику через HTTP"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"1-отримання-авторизації-токен-oauth2","__idx":1},"children":["1. Отримання авторизації (токен OAuth2)"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Перш ніж викликати будь-які функціональні API, необхідно обміняти свої облікові дані на ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["токен доступу JWT"]},"."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Кінцева точка:"]}," ",{"$$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":["Офіційна документація:"]}," ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://guide.morelogin.com/api-reference/open-api/open-api/authorization/paths/~1oauth2~1token/post"},"children":["Шлях авторизації"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"запит-curl","__idx":2},"children":["Запит (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":"приклад-відповіді","__idx":3},"children":["Приклад відповіді"]},{"$$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-виконання-шаблону-хмарного-телефону","__idx":4},"children":["2. Виконання шаблону хмарного телефону"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Використовуйте access_token, отриманий на кроці 1, для запуску певного шаблону RPA."]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Кінцева точка:"]}," ",{"$$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":["Офіційна документація:"]}," ",{"$$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":["Шлях виконання розкладу"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"запит-curl-1","__idx":5},"children":["Запит (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-розподіл-параметрів","__idx":6},"children":["3. Розподіл параметрів"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"як-отримати-ідентифікатори","__idx":7},"children":["Як отримати ідентифікатори?"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Авторизація:"]}," Отримано через кінцеву точку ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/oauth2/token"]},"."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["cloudPhoneId:"]}," Знаходиться на інформаційній панелі MoreLogin Cloud Phone (числовий ідентифікатор)."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["templateId:"]}," Знаходиться на ринку шаблонів автоматизації або у списку особистих шаблонів."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"розуміння-templateparameter","__idx":8},"children":["Розуміння templateParameter"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Це рядковий об'єкт JSON. Ви повинні визначити ключі на основі вимог шаблону, а потім екранувати їх як рядок."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Приклад визначення шаблону:"]}]},{"$$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":["Як відобразити це у вашому запиті:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Щоб передати значення для вищезазначеного визначення, значення вашого templateParameter має виглядати так:"]},{"$$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-обробка-помилок","__idx":9},"children":["4. Обробка помилок"]},{"$$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":"Стан"},"children":["Стан"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Можлива причина"},"children":["Можлива причина"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["401 Неавторизовано"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Термін дії токена минув або недійсні облікові дані клієнта."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["400 Неправильний запит"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Недійсний cloudPhoneId або неправильно сформований JSON у templateParameter."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["404 Не знайдено"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["TemplateId не існує."]}]}]}]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"швидкий-старт-python","__idx":10},"children":["Швидкий старт 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":"Шаблон виклику через HTTP","id":"шаблон-виклику-через-http","depth":1},{"value":"1. Отримання авторизації (токен OAuth2)","id":"1-отримання-авторизації-токен-oauth2","depth":2},{"value":"Запит (cURL)","id":"запит-curl","depth":3},{"value":"Приклад відповіді","id":"приклад-відповіді","depth":3},{"value":"2. Виконання шаблону хмарного телефону","id":"2-виконання-шаблону-хмарного-телефону","depth":2},{"value":"Запит (cURL)","id":"запит-curl-1","depth":3},{"value":"3. Розподіл параметрів","id":"3-розподіл-параметрів","depth":2},{"value":"Як отримати ідентифікатори?","id":"як-отримати-ідентифікатори","depth":3},{"value":"Розуміння templateParameter","id":"розуміння-templateparameter","depth":3},{"value":"4. Обробка помилок","id":"4-обробка-помилок","depth":2},{"value":"Швидкий старт Python","id":"швидкий-старт-python","depth":2}],"frontmatter":{"seo":{"title":"Шаблон виклику через HTTP"}},"lastModified":"2026-06-10T11:47:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/uk/rparobotic-process-automation/04-integration/call-template-via-http","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}