【问题标题】:API Connect developer portal how to post file to one fileAPI Connect 开发人员门户如何将文件发布到一个文件
【发布时间】:2023-03-13 00:41:01
【问题描述】:

curl -X POST -F "images_file=@prez.jpg" "https://gateway-a.watsonplatform.net/visual-recognition/api/v3/detect_faces?api_key={api-key}&version=2016-05-20"

这是一个示例 curl post 命令,用于将一个图像文件发布到 api connect。

我将此 api 发布到 api connect 开发者门户。但不知道如何使用 api connect 的格式将图像文件发布到我的 api。

api 连接示例: 卷曲——请求发布\ --网址https://api.us.apiconnect.ibmcloud.com/wlwwucnibmcom-dev/ibmtesting/vision5/classify\ --header '接受:应用程序/json' \ --header '内容类型:应用程序/json' \ --header 'x-ibm-client-id: REPLACE_THIS_KEY' \ --header 'x-ibm-client-secret: REPLACE_THIS_KEY'

我应该使用哪种格式来发布我的请求???

【问题讨论】:

  • 在您的第一个 cURL 命令中,您正在发送 images_file,但在第二个命令中,我没有看到任何实际数据正在发送。

标签: curl visual-recognition apiconnect


【解决方案1】:

使用 API Designer,您可以测试您的 API。设计器还提供了每个 API 调用的示例,包括您正在寻找的 cURL 语法:

文档中提供了一个示例:

curl --request POST \
  --url https://localhost:4002/api/notes \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --header 'x-ibm-client-id: default' \
  --header 'x-ibm-client-secret: SECRET' \
  --data '{"title":"Buy eggs and milk"}' -k

有关更多信息,请遵循Getting Stated: Run Your API 文档中的探索您的 REST API 部分。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-07-21
    • 1970-01-01
    • 1970-01-01
    • 2019-03-23
    • 2020-12-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多