{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/zh-CN/develop/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"常见问题","description":"YouCam API documentation by Perfect Corp. Learn how to use Skin analysis API, Virtual try-on API, Image editing API, and Video generative AI APIs.","siteUrl":"https://docs.perfectcorp.com","keywords":"AI Skin Analysis, AI Clothes, AI Hairstyle, AI Outfits","image":"/assets/favicon.cd6fa4d833b2a573b3c6dae68386b293da205b203402cb0c97b80bd2acc07ea2.8351e24f.png"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"常见问题","__idx":0},"children":["常见问题"]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：「点数（Unit）」是什么意思，怎么用？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," 请注意，点数是 YouCam API 各项操作的计价单位，不同的 AI 功能扣除的点数不一样。在本文档里，点数的代号写作 \"Credit\"。"," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：为什么会报 InvalidTaskId 错误？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," 一旦您去查询一个已经超时的任务的状态，就会收到 ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["InvalidTaskId"]}]}," 错误。所以，跑起一个 AI 任务之后，您需要",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["轮询"]},"——在 ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["polling_interval"]}]}," 之内持续查状态，直到状态变成 ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["success"]}," 或 ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["error"]}," 为止。"," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：怎么做鉴权？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," 您的 API 密钥就是完成鉴权所用的 ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Bearer Token"]}]},"。用 ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Bearer Token"]}," 把 API 密钥放进请求头："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"Authorization: Bearer YOUR_API_KEY\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["想了解更多、有疑问，可以看我们的",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://www.makeupar.com/consumer/blog"},"children":["博客"]},"和 ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://yce.makeupar.com/api-console/en/api-playground/ai-skin-analysis/"},"children":["API 在线调试台"]},"，也可以发信到 ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"mailto:YouCamOnlineEditor_API@perfectcorp.com"},"children":["YouCamOnlineEditor_API@perfectcorp.com"]},"。我们的客户成功团队很乐意帮您。;)"," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：用 curl 怎么上传图片？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," curl --location --request PUT '{url_api_response}' --header '{headers_in_api_response}' --data-binary @'{local_file_path}'"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"curl --location --request PUT 'https://example.com/sample-result-url' --header 'Content-Type: image/jpg' --header 'Content-Length: 50000'  --data-binary @'./test.jpg'\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：AI API 支持哪些平台？能用在移动设备上吗？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," AI API 在各个平台上都能顺畅工作。它基于标准 RESTful API，所以服务器对服务器的调用、移动设备上的调用、浏览器里的调用都可以，怎么顺手怎么来。"," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：Android 和 iOS 上能用 Flutter 接 AI API 吗？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," ","完全可以。AI API 就是标准的 RESTful API，用 Flutter 自带的 HTTP 接口发请求即可。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["下面是几篇官方的 Flutter 网络请求文档。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["https://docs.flutter.dev/cookbook/networking/fetch-data"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["https://pub.dev/packages/http"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["用 Flutter 的 http 包发一个带 Bearer 鉴权的 GET，写法很简洁："]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"dart","header":{"controls":{"copy":{}}},"source":"import 'dart:convert';\nimport 'package:http/http.dart' as http;\n\nFuture<void> fetchData() async {\n    String token = \"your_bearer_token_here\"; // Replace with your actual token\n\n    final response = await http.get(\n        Uri.parse(\"https://yce-api-01.makeupar.com/s2s/v2.0/task/ai-task\"), // Replace the `ai-task` with the AI feature you intend to use.\n        headers: {\n        \"Content-Type\": \"application/json\",\n        \"Authorization\": \"Bearer $token\",\n        },\n    );\n\n    if (response.statusCode == 200) {\n        print(\"Data fetched successfully: ${response.body}\");\n    } else {\n        print(\"Failed to fetch data: ${response.statusCode}\");\n    }\n}\n","lang":"dart"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["鉴权要点："]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["拿到 Token——用 SharedPreferences 或其他安全存储方式保存和读取 Token。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["把 Token 放进请求头——在请求头里写 \"Authorization\": \"Bearer $token\"。"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["处理好 Token 过期——API 返回 401 InvalidAccessToken 时，按需刷新 Token。"," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：API key 就是 API key，那 secret key 在哪里找？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," secret key 只在您第一次生成时创建一次。所以一定要当场存好，之后再也看不到了。"," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：能用 Wix 把 AI API 接到我的网站上吗？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," 我们目前没有关于在 Wix 上使用 AI API 的官方集成指南。不过 RESTful API 本身对平台没有任何限制，只要平台支持标准的网络请求就行。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["我们建议您先读 Wix 的官方文档：https://dev.wix.com/docs/develop-websites/articles/get-started/integrate-with-3rd-parties"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Wix 提供了几种对接第三方 API 的方式，主要靠它的 Velo 开发平台："]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Fetch API："," ","这是最常用的方式，是标准 JavaScript Fetch API 的实现。您可以从 Wix 站点的前端或后端代码向外部 API 发 HTTP 请求。"," ","后端调用：出于安全考虑推荐这种（尤其是需要密钥的 API），也能避开 CORS 问题。用 Secrets Manager 安全存放 API 密钥。"," ","前端调用：可以做，但安全性差一些，还可能遇到 CORS 限制。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["npm 套件："," ","Velo 支持使用经审核的 npm 套件，您可以借助大量现成的 JavaScript 模块，为站点扩展第三方功能。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Service Plugins（原名 SPI/Custom Extensions）："," ","这类方式能把自定义逻辑或直接第三方服务接进 Wix 的业务方案里（例如 Wix Stores、Wix Bookings）。Service plugin 可以定制现有应用流程中的某些环节，或为自定义运费、动态定价、备用支付渠道等功能接入外部服务。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["HTTP Functions："," ","您可以把站点功能对外发布成 API，让第三方服务调用您 Wix 站点的后端函数，与您站点的数据或逻辑互动。"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["集成步骤（以 Fetch API 为例）："]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["存放 API 密钥：如果第三方 API 需要鉴权，把 API 密钥这类敏感凭据安全地存进 Wix 的 Secrets Manager。"," ","引入 wix-fetch：在 Velo 的后端或前端代码里引入 wixFetch 模块。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JavaScript","header":{"controls":{"copy":{}}},"source":"import { fetch } from 'wix-fetch';\n","lang":"JavaScript"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["发起 API 调用：用 fetch 函数向第三方 API 发请求，把需要的请求头和请求体带上。"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"JavaScript","header":{"controls":{"copy":{}}},"source":"export async function getWeatherData() {\n    const apiKey = await getSecret(\"yourApiKeyName\"); // Retrieve from Secrets Manager\n    const response = await fetch(`https://api.weatherapi.com/v1/current.json?key=${apiKey}&q=London`, {\n        method: 'GET',\n        headers: {\n            'Content-Type': 'application/json'\n        }\n    });\n    const data = await response.json();\n    return data;\n}\n","lang":"JavaScript"},"children":[]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["处理响应：把 API 返回的数据做加工，接进站点的设计与功能里。"," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]}]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["问：能把 AI API 接到 WooCommerce 吗？"]}," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["答："]}," 我们目前没有关于在 WooCommerce 上使用 AI API 的官方集成指南。不过 RESTful API 本身对平台没有任何限制，只要平台支持标准的网络请求就行。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["我们建议您先读 WooCommerce 的官方文档：https://woocommerce.com/document/woocommerce-rest-api/"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["把第三方 API 接进 WooCommerce，能让店铺功能更强、运营更顺。常见做法有这几种："]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["用 WooCommerce REST API："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["WooCommerce 提供了一套功能完备的 REST API，外部应用可以通过它读写您的店铺数据。"," ","您可以在 WooCommerce > Settings > Advanced > REST API 里创建带特定权限（Read、Write 或 Read/Write）的 API 密钥。"," ","有了它，自建集成或用第三方服务调用这套 API，就能自动完成库存同步、订单处理、客户数据同步等工作。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["用插件："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["很多 WordPress 和 WooCommerce 插件就是为对接主流第三方服务而生的，比如支付网关、物流承运商、CRM 系统、财务软件。"," ","插件通常自带现成的集成方案，省掉配置功夫，也少写不少自定义代码。"," ","常见的有对接特定支付渠道的插件（如 Stripe、PayPal）、物流方案插件（如 FedEx、USPS），以及 WPGet API 这类通用 API 集成工具。"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["自定义代码与 Webhook："]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["需求比较特殊，或者找不到合适的插件时，您可以在 WordPress 主题里或自建插件里写自定义代码。"," ","具体做法是借助 WordPress/WooCommerce 的 hooks 和 filters，在特定事件上触发 API 调用（例如用 woocommerce_payment_complete 做购后动作）。"," ","也可以用 webhook，在特定事件发生时（例如新订单、商品更新）把实时数据从 WooCommerce 推给第三方服务。"," ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}]}]}]}]}]}]},"headings":[{"value":"常见问题","id":"常见问题","depth":1}],"frontmatter":{"seo":{"title":"常见问题"}},"lastModified":"2026-10-30T07:26:32.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/zh-cn/develop/faq","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}