> ## Documentation Index
> Fetch the complete documentation index at: https://developer.hct.com.tw/llms.txt
> Use this file to discover all available pages before exploring further.

# 7、上傳逆物流託運資料 - R_TransData

> **版本**：v1.0.1 \
>
> **狀態**：最終版 \
>
> **最後更新日期**：2026-11-24

## 文件概述

### 文件目的

* 上傳要收退貨的託運資料

## 前置需求

* [ ] 請向營業所申請此功能權限，須提供客戶代號
* [ ] 公司帳號 (company)、公司密碼 (password)：向營業所申請
* [ ] 客戶代號 (escsno)：：請洽詢營業所
* [ ] 每個客戶代號對應的資訊：請洽詢營業所，有客戶代號對應的重量...等資訊

## 身分驗證

本 API 目前不提供身份驗證機制，使用者可直接依 API Specification 進行呼叫。

## API 規格總覽

* SOAP Envelope、HTTP Request Header 及 Namespace 定義請參考 **[SOAP規格](https://developer.hct.com.tw/files/logistics-share-docs/protocol-specifications/zh/soap-specification.md)**

### 支援格式

| 環境 | 網址 |
| - | - |
| 測試環境 | [https://hctrt.hct.com.tw/edi\_webservice2\_test/service1.asmx](https://hctrt.hct.com.tw/edi_webservice2_test/service1.asmx) |
| 正式環境 | [https://hctrt.hct.com.tw/edi\_webservice2/service1.asmx](https://hctrt.hct.com.tw/edi_webservice2/service1.asmx) |

| 規範項目 | 設定值 | 備註 |
| - | - | - |
| 回應逾時時間 | 60s | 伺服器處理並回傳資料的最大等待時間 |

### 資料格式

* 傳送一批資料請不要超過20筆
* 欄位禁止輸入：`&"><'`（雙引號、單引號）
* 文字請使用utf-8

### API 端點

| 請求方法 | 端點 | SOAP 動作 | 驗證方式 | 說明 |
| - | - | - | - | - |
| POST | `/service1.asmx` | R\_TransData\_Json | X | 支援JSON格式 |

## API 規格

### 請求格式

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | Body | SOAP Body | Y | SOAP Request Body | `<soap12:Body> </soap12:Body>` |
| 2 | R\_TransData\_Json | Object | Y | SOAPAction:R\_TransData\_Json Request 物件 | `<R_TransData_Json  xmlns="http://tempuri.org/"></R_TransData_Json >` |

* R\_TransData\_Json 定義

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | company | String | Y | 公司帳號 | |
| 2 | password | String | Y | 公司密碼 | |
| 3 | json | Object | Y | 逆物流資料 | |

* json Object 定義

| 序號 | 參數 | 資料型態 | 是否必填 | 說明 | 範例 |
| - | - | - | - | - | - |
| 1 | epino | String(30) | Y | 訂單編號 規則： 1.最長30字元 2.僅接受英文跟數字 3.90天內不可有重複的訂單編號 | 20260812000000000002 |
| 2 | ercsig | String(40) | Y | 退貨人名稱，僅可輸入中文 | 王小明 |
| 3 | ertel1 | String(20) | Y | 退貨人電話1，[請參考【電話輸入規則-規則】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) | [請參考【電話輸入規則-範例】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) |
| 4 | ertel2 | String(12) | N | 退貨人電話2，[請參考【電話輸入規則-規則】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) | [請參考【電話輸入規則-範例】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) |
| 5 | eraddr | String(100) | Y | 退貨人地址  [請參考【送貨地址輸入規則-規則](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eraddr.md) | [請參考【送貨地址輸入規則-範例】說明](../../logistics-share-docs/fields/zh/eraddr.md) |
| 6 | ejamt | String(4) | Y | 外箱件數，請填整數  [ 請參考【商品重量-件數】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/package-weight.md) | 1 |
| 7 | eqamt | String(5) | N | 重量，請填整數  [請參考【商品重量-重量單位】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/package-weight.md) | 5 |
| 8 | esdate | String(8) | N | 出貨日期(時區：UTC+8) 格式：yyyymmdd。若未帶入值，預設為當天日期（UTC+8） | 20260806 |
| 9 | escsno | String(11) | N | 客戶代號，依簽約時約定內容設定 | 11234567890 |
| 10 | edelno | String(10) | N | 新竹貨號 若未帶入值，系統將自行配號 若需要自行上傳貨號請向開立帳號站協助申請 規則：物流單號(9碼)+檢查碼(1碼) 檢查碼規則：前9碼除 以7的餘數=MOD(9位數,7) | |
| 11 | etcsig | String(40) | N | 收貨人名稱，僅可輸入中文 | 王大明 |
| 12 | ettel1 | String(15) | N | 收貨人電話1，[請參考【電話輸入規則-規則】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) | [請參考【電話輸入規則-範例】](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/ertel.md) |
| 13 | etaddr | String(100) | N | 收貨地址，[請參考【送貨地址輸入規則-規則】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eraddr.md) | [請參考【送貨地址輸入規則-範例】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eraddr.md) |
| 14 | emark | String(48) | N | 備註 | 易碎品 |
| 15 | eprdcl2 | String(3) | N | 商品種類  [請參考【商品種類-列舉值】說明](https://developer.hct.com.tw/files/logistics-share-docs/fields/zh/eprdcl2.md) | 100 |
| 16 | edelno2 | String(10) | N | 原新竹貨號(TransData API 裡面 edelno欄位) | 1585730311 |

### 回應規格

| 序號 | 參數 | 資料型態 | 是否必填 |
| - | - | - | - |
| 1 | Num | String(2) | 序號 |
| 2 | success | String(1) | 結果(Y:新增成功/N：新增失敗) |
| 3 | edelno | String(10) | 新竹貨號 |
| 4 | epino | String(30) | 訂單編號 |
| 5 | erstno | String(4) | 到著站號碼，退貨人到著站號碼(逆物流跟誰收的站所代號) |
| 6 | eqamt | String(5) | 重量 |
| 7 | ErrMsg | String(200) | 異常錯誤訊息 |

#### HTTP 狀態碼

| 狀態碼 | 說明 |
| - | - |
| 200 | 成功 |

#### 業務錯誤代碼

| 錯誤代碼 | 說明 |
| - | - |
| 公司名稱或密碼錯誤 | |
| 資料錯誤請確認 | |
| 貨號重複 | |
| 貨號錯誤 | |
| 貨號檢查碼錯誤 | |
| 貨號錯誤必須是2開頭 | |
| 原貨號檢查碼錯誤 | |
| 訂單編號錯誤 | |
| 客代錯誤 | |
| 件數錯誤 | |
| 重量錯誤 | |
| 退貨人名稱錯誤 | |
| 退貨人電話錯誤 | |
| 退貨人地址錯誤 | |
| 地址無法比對 | |
| 收貨人名稱錯誤 | |
| 收貨人電話錯誤 | |
| 收貨人地址錯誤 | |
| 代收貨款錯誤 | |
| 總長請輸入重量60、90、120、150、151\~999 | |
| 總長件數只能為1件 | |
| 未建收退貨權限(WEB\_COMPANY\_NEW\_R) | |

## SDK 與範例程式碼

### 範例

#### Request

```bash theme={null}
curl --location 'https://hctrt.hct.com.tw/edi_webservice2_test/service1.asmx' \
--header 'Content-Type: application/soap+xml; charset=utf-8' \
--data '<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
    <soap12:Body>
        <R_TransData_Json xmlns="http://tempuri.org/">
            <company>company</company>
            <password>password</password>
            <json>
            [
                {
                    "epino"  : "20260821000000000001",
                    "ercsig" : "王小明",
                    "ertel1" : "0912345678",
                    "ertel2" : "0223456789",
                    "eraddr" : "台北市信義區松仁路100號",
                    "ejamt"  : "1",
                    "eqamt"  : "10",
                    "esdate" : "",
                    "escsno" : "",
                    "edelno" : "",
                    "etcsig" : "王大明",
                    "ettel1" : "0912345678",
                    "etaddr" : "台北市信義區松仁路100號",
                    "emark"  : "易碎",
                    "eprdcl2": "001",
                    "edelno2"  : ""
                }
            ]
            </json>
        </R_TransData_Json >
    </soap12:Body>
</soap12:Envelope>'
```

#### Response

```xml theme={null}
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <R_TransData_JsonResponse xmlns="http://tempuri.org/">
            <R_TransData_JsonResult>[
  {
    "Num": "1",
    "success": "Y",
    "edelno": "2250457613",
    "epino": "20260821000000000001",
    "erstno": "1881",
    "eqamt": "10",
    "ErrMsg": "成功，測試資料"
  }
]</R_TransData_JsonResult>
        </R_TransData_JsonResponse>
    </soap:Body>
</soap:Envelope>
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.