{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/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```### 回答例\n\n```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-クラウド電話テンプレートの実行","__idx":3},"children":["2. クラウド電話テンプレートの実行"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ステップ1で取得したaccess_tokenを使用して、特定の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","__idx":4},"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":5},"children":["3. パラメータの詳細"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"idの取得方法","__idx":6},"children":["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":["Authorization:"]}," ",{"$$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:"]}," MoreLogin Cloud Phoneダッシュボード（数値ID）に表示されます。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["templateId:"]}," オートメーションテンプレートマーケットまたは個人テンプレートリストに表示されます。"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"templateparameterの理解","__idx":7},"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":["上記の定義に値を渡すには、テンプレートパラメータの値を以下のように記述してください。"]},{"$$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```---\n\n## 4. エラー処理\n\n| ステータス | 考えられる原因 |\n\n| ---------------- | ------------------------------------------------------------ |\n\n| 401 Unauthorized | トークンの有効期限切れ、またはクライアント認証情報が無効です。 |\n\n| 400 Bad Request | cloudPhoneId が無効、または templateParameter の JSON 形式が不正です。 |\n\n| 404 Not Found | templateId が存在しません。 |\n\n---\n\n## Python クイックスタート\n\n\n```python\nimport 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":"json"},"children":[]}]},"headings":[{"value":"HTTP経由でテンプレートを呼び出す","id":"http経由でテンプレートを呼び出す","depth":1},{"value":"1. 認証（OAuth2トークン）の取得","id":"1-認証oauth2トークンの取得","depth":2},{"value":"リクエスト（cURL）","id":"リクエストcurl","depth":3},{"value":"2. クラウド電話テンプレートの実行","id":"2-クラウド電話テンプレートの実行","depth":2},{"value":"リクエスト (cURL)","id":"リクエスト-curl","depth":3},{"value":"3. パラメータの詳細","id":"3-パラメータの詳細","depth":2},{"value":"IDの取得方法","id":"idの取得方法","depth":3},{"value":"templateParameterの理解","id":"templateparameterの理解","depth":3}],"frontmatter":{"seo":{"title":"HTTP経由でテンプレートを呼び出す"}},"lastModified":"2026-06-10T11:47:34.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/rparobotic-process-automation/04-integration/call-template-via-http","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}