> For the complete documentation index, see [llms.txt](https://docs.docbits.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docbits.com/chinese/gai-shu-yu-ji-chu/faq/infor-m3-m3-integration/m3-api-export-diagnostic-guide.md).

# M3 API 导出诊断指南

### 1. 初始设置

开始排查问题前，请确保您了解所使用的 M3 端点所需的输入。

#### 1.1 查看 M3 API 文档

* 登录 **M3**。
* 前往 **API Section → API Documentation**。
* 找到并选择相关端点（例如，用于发票相关导出的 `APS450MI`）。
* 选择相应的功能（例如 `Add`）。

#### 1.2 了解 API 要求

* 查看 API 文档中的所有**必填字段**。
* 留意以下重要字段：
  * `DIVI`
  * `ACDT`（会计日期）
  * `CUCD`（货币代码）
  * `SINO`（供应商发票编号）
* 确认字段的**数据类型**、**大小写**和**格式规则**（例如，日期格式为 `YYYY-MM-DD`）。

### 2. 在 M3 中直接测试 API 调用

此步骤通过手动输入验证 M3 API 是否按预期运行。

#### 2.1 在 M3 中生成测试请求

* 在 M3 API Documentation 工具中：
  * 为必填字段填写测试数据。
  * 点击 **Run** 执行请求。
  * 复制生成的 **cURL** 和 **JSON 正文**。

#### 2.2 使用 Postman 调试

* 打开 **Postman** 并创建新的 **POST** 请求。
* 粘贴 JSON 正文或 cURL。
* 添加必要的请求头（例如授权信息）。
* 点击 **Send** 并查看结果：
  * `200 OK`：请求成功。
  * 错误：查看错误消息，了解具体问题。

### 3. 对比 M3 API 与 DocBits 映射

确认 API 使用测试数据正常运行后，请将其与 DocBits 实际发送的内容进行对比。

#### 3.1 从 DocBits 导出示例数据

* 打开 **DocBits API 文档**：

  使用 **/export/get\_infor\_export\_api\_json** 端点。
* 输入有问题的文档的 **Document ID**。
* 运行导出，以查看 DocBits 将发送到 M3 的 **JSON 负载**。

#### 3.2 对比 API 负载

* 将 **M3 测试 JSON** 与 **DocBits 导出 JSON** 并排放置。
* 检查以下内容：
  * **字段名称**：确保名称完全匹配，包括大小写（`DIVI` ≠ `divi`）。
  * **数据类型**：确认字符串、数字和日期的格式正确。
  * **缺失字段**：找出 M3 请求中存在、但 DocBits 中缺失的字段。

### 4. 常见问题排查

| 问题                    | 可能原因             | 修复方法                           |
| --------------------- | ---------------- | ------------------------------ |
| 缺少字段错误                | DocBits 中未映射必填字段 | 在 DocBits 导出配置中添加缺失字段。         |
| 字段大小写不匹配（`DIVI`）      | M3 区分大小写         | 在字段映射中使用正确的大小写。                |
| `accountingDate` 格式无效 | 日期错误或缺失          | 调整为 M3 要求的格式（例如 `YYYY-MM-DD`）。 |
| 出现意外的 API 错误          | 存在多余或无法识别的字段     | 与已知可用的负载进行对比，并清理不必要的数据。        |

### 5. 如果问题仍未解决

如果按照上述步骤操作后问题仍未解决：

1. **记录**问题：
   * 错误消息和状态码
   * M3 请求示例和 DocBits 导出 JSON
2. **总结**排查过程：
   * 已尝试的操作
   * 测试负载与失败负载之间发现的关键差异
3. **升级处理**，联系开发人员：
   * 提供所有数据和发现
   * 指出疑似问题区域


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.docbits.com/chinese/gai-shu-yu-ji-chu/faq/infor-m3-m3-integration/m3-api-export-diagnostic-guide.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
