【问题标题】:Watson Data API - Creating a project failsWatson Data API - 创建项目失败
【发布时间】:2020-07-01 23:43:48
【问题描述】:

利用Watson Studio GUI,我可以毫无问题地创建Studio 项目并将其与git 存储库集成。我需要script这个过程。使用Watson Data API (2.23.1) 时,我确实可以使用.../transactional/v2/projects REST 调用创建项目,但该调用在其payload 中似乎没有任何git 相关信息。

创建项目后(尚未与git 集成),然后我尝试发出此REST 调用: .../v2/asset_files/git_transactions/remote 传递新创建的项目。

它的有效载荷包含git 信息,所以我认为它是用来将项目与GIT 集成的:

{"repo_url": "https://github.ibm.com/orgn/xxxx.git","access_token":{"git_host":"GitHub Enterprise","token_value":"xxxxxxxxxxxxx" }}

但是这个调用总是失败:

{"code":400,"error":"Bad Request","reason":"Invalid request body, access_token format is not valid","message":"The server cannot or will not process the request due to an apparent client error (e.g. malformed request syntax)."}

消息中提到 access_token 格式无效,但我遵循 api 文档 wrt 格式。

任何指导将不胜感激。

【问题讨论】:

    标签: git rest watson-studio


    【解决方案1】:

    您是否在 https://api.dataplatform.cloud.ibm.com/v2/projects/docs/swagger/#/ 看到过用于 Watson Studio 项目的 Swagger 文档

    如果是这样,您将看到您可以在项目创建步骤中包含 GH 集成。

    您可以使用GetProject API 从您的工作项目中获取 JSON,而 GH 集成已经在确认所需的架构。

    【讨论】:

    • 不幸的是,虽然 Swagger 文档建议它将支持“github”作为帖子中的元素,但当我包含它时,我会收到“Extraneous properties: github”消息。
    • 注意:我刚刚与 watson studio 开发人员确认 REST API 目前不支持项目 GIT 集成。
    【解决方案2】:

    抱歉,您是正确的,/transactional/v2/projects api 端点不支持包括 GitHub 集成,而 /v2/projects api 端点支持,但不建议以编程方式使用。

    也就是说,假设您已经将 GitHub 访问令牌添加到 Watson工作室设置根据Enable access to GitHub from your account

    你可以简单地传递身体:

    {
    "github": {
            "repository": "https://github.ibm.com/orgn/xxxx.git"
             }
    }
    

    您的项目也会相应更新。

    【讨论】:

      【解决方案3】:

      我已尝试更新通过 transaction/v2/projects api 创建并已添加 GitHub 访问令牌的项目。

      之后我可以看到它已应用它(/v2/projects/{projects id}),但它未应用项目设置页面中的集成部分。 我认为它没有更新到后端 pod。

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-25
      • 2018-10-18
      • 1970-01-01
      • 2016-04-09
      • 2016-11-23
      相关资源
      最近更新 更多