更新时间:2024-11-04 GMT+08:00
分享

编辑应用

操作场景

本章节指导用户通过调用API编辑工业数字模型驱动引擎(Industrial Digital Model Engine,简称iDME)的应用。

前提条件

  • 已开通工业数字模型驱动引擎(Industrial Digital Model Engine,简称iDME),并根据开通区域确定调用API的Endpoint,详细信息请参见地区与终端节点
  • 当您使用Token认证方式完成认证鉴权时,需要获取用户Token并在调用接口时增加“X-Auth-Token”到业务接口请求消息头中。Token认证,具体操作请参考认证鉴权

    通过IAM服务获取到的Token有效期为24小时,需要使用同一个Token鉴权时,可以先将Token缓存,避免频繁调用。

涉及接口

编辑应用涉及以下接口:

操作步骤

  1. 获取待编辑的应用ID。

    1. 接口相关信息

      URI格式:GET /v1/{project_id}/apps

      详情请参见获取租户下的应用清单

    2. 请求示例
      GET https://{iDME Endpoint}/v1/{project_id}/apps

      {project_id}请从获取项目ID获取。

    3. 响应示例
      {
          "result": [
              {
                  "id": "44145d41ae294e111111eafd4da32ea8",
                  "project_id": "cf49a20d85294c93b1111111ca9454bc",
                  "mark_for_delete": 0,
                  "create_by": "59779076d1dc********c91c2c54bd7a",
                  "create_time": 1690427901000,
                  "update_by": "59779076d1dc********c91c2c54bd7a",
                  "update_time": 1690427901000,
                  "name_cn": "TestApp",
                  "name_en": "TestApp",
                  "desc_cn": "",
                  "desc_en": "",
                  "database_type": "mysql",
                  "environment": "beta",
                  "owners": [
                      "user_1",
                      "idme_container1"
                  ]
              },
              {
                  "id": "c787dcd484944ad11111dd18693e4eb2",
                  "project_id": "cf49a20d85294c93b1111111ca9454bc",
                  "mark_for_delete": 0,
                  "create_by": "59779076d1dc********c91c2c54bd7a",
                  "create_time": 1689622165000,
                  "update_by": "59779076d1dc********c91c2c54bd7a",
                  "update_time": 1689622165000,
                  "name_cn": "工业产品问卷调查",
                  "name_en": "Questionnaire_Survey",
                  "desc_cn": "",
                  "desc_en": "",
                  "database_type": "mysql",
                  "environment": "dev",
                  "owners": [
                      "dme-console"
                  ]
              }
          ],
          "page_num": 1,
          "page_size": 500,
          "total_size": 2,
          "total_pages": 1
      }

  2. 编辑应用。

    1. 接口相关信息

      URI格式:PUT /v1/{project_id}/apps/{app_id}

      详情请参见编辑应用

    2. 请求示例
      PUT https://{iDME Endpoint}/v1/cf49a20d85294c93b1111111ca9454bc/apps/c787dcd484944ad11111dd18693e4eb2

      Body:

      {
          "id": "c787dcd484944ad11111dd18693e4eb2",
          "desc_cn": "编辑",
          "desc_en": "",
          "app_user_list": [
              {
                "id": "285651a4737d4fa0afcafc6b47e6c15f",
                "name": "developer"
              }  
          ]
      }
    3. 响应示例
      {
          "id": "c787dcd484944ad11111dd18693e4eb2",
          "project_id": "cf49a20d85294c93b1111111ca9454bc",
          "mark_for_delete": 0,
          "create_by": "59779076d1dc********c91c2c54bd7a",
          "create_time": 1690427901000,
          "update_by": "59779076d1dc********c91c2c54bd7a",
          "update_time": 1691026385000,
          "name_cn": "工业产品问卷调查",
          "name_en": "Questionnaire_Survey",
          "desc_cn": "编辑",
          "desc_en": "",
          "database_type": "mysql",
          "environment": "dev",
          "versions": null
      }

      请求异常时,错误码请参见错误码

相关文档