Try   HackMD

URI-G-02 會員買主註冊 API

Tony Fan

tags: URI-G API規格

買主帳號註冊(寫入DB並透過SSO API 新增至SSO)

網址

  • path : ${TT-API網址}/domains/front/buyer-register

Input JSON Path

  • path : ${TT-API網址}/domains/front/buyer-register
  • method : POST
  • query : 無
  • body :
{
    "language" : <languageId>,
    "email": <email>,
    "password": <password>,
    "titleCode": <titleCode>,
    "name": <name>,
    "companyName": <companyName>,
    "individualbuyer": <individualbuyer>,
    "location": <location>,
    "officeStateCode": <officeStateCode>,
    "officeOtherState": <officeOtherState>,
    "officeAddress": <officeAddress>,
    "companyWebsite": <companyWebsite>,
    "telCountry": <telCountry>,
    "tel": <tel>,
    "telExt": <telExt>,
    "mobileCountry": <mobileCountry>,
    "mobile": <mobile>,
    "acceptAgreement": <acceptAgreement>,
    "newShowInfo": <newShowInfo>,
    "newsLetter": <newsLetter>
}

輸入參數說明

買主註冊欄位

欄位名稱 欄位說明 型態 是否必要欄位
languageId 語系代碼 number Y
email 帳號Email String Y
password 密碼 String Y
titleCode 代碼 number Y
name 姓名 String Y
individualbuyer 是否為買主個人 number Y
companyName 姓名 String Y
websiteNotAvaliable 是否有公司網址 number Y
companyWebsite 公司網址 String Y
location 國家代碼 number Y
officeStateCode 一級行政區代碼 number N
officeOtherState 一級行政區其他名稱 String N
officeAddress 地址 String N
telCountry 電話國際區號 String(數字) N
tel 電話號碼 String(數字) N
telExt 電話分機號碼 String(數字) N
mobileCountry 行動電話國際區號 String(數字) N
mobile 行動電話號碼 String(數字) N
acceptAgreement 同意服務條款 number Y
newShowInfo 公開Email給供應商 number Y
newsLetter 接受相關的產品和活動信息 number Y
registerIp 註冊IP String N
  • languageId : 參考 URI054 language
  • titleCode : 參考 URI054 user-title-code
  • individualbuyer : (預設0,此時companyName必填)
    • 1 : 買主個人
    • 0 : 買主公司
  • companyName: 如果individualbuyer=1,這裡會強制改成Individual buyer來儲存
  • websiteNotAvaliable : (預設0,此時companyWebsite必填)
    • 1 : 沒有公司網址
    • 0 : 有公司網址
  • companyWebsite:如果websiteNotAvaliable=1,這裏會強制改成 Not Available來儲存
  • location:參考 URI054 user-country
  • officeStateCode:參考 URI054 user-country-state,用location所選的國家代碼帶入取得國家的第一級行政區。
  • officeOtherState:當location有值,officeStateCode沒值時為必填
  • telCountry:可以參考 URI054 user-country的客製輸出欄位telcode,查出 location對應的區碼。
  • newShowInfo:(預設0)
    • 1 : I'd like to show my email address to the suppliers I contact on Taiwantrade.com.
    • 0 : I don't.
  • registerIp: 如果不是直接從Client端呼叫此API,請想辦法填上Client端的IP,否則會預設抓取 Request Header : X-FORWARDED-FOR CLIENT-IP 作為註冊來源IP。追溯到註冊的來源IP就會只到Server Side。
  • newsLetter:(預設1)
    • 1 : I’d like to receive information on related products and events.
    • 0 : I don't
  • acceptAgreement:(預設1)
    • 1 : 同意服務條款
    • 0 : 不同意
    • 基本上都會是1,因為不同意就不能註冊

Output JSON Path

{ 
    "code" : <code> , // 代碼,0:ok、 < 0: error 使用
    "errorMsg"  : <errorMsg> // 錯誤訊息
}

輸出參數說明

  • 回傳成功或是失敗

標準I/O結果輸出

欄位名稱 欄位說明 型態 是否可為空值
code 代碼 number N
errorMsg 錯誤訊息 String Y
  • code : 0:ok、 < 0: error 使用
    • 在此API, 0: ok 代表 submit成功 / -1 : 代表Email已存在 / -2 : 其他錯誤,看errorMsg描述

API 邏輯

參考 URI-G-02 API邏輯 (需有權限才能瀏覽)

範例

參考 URI-G-02 測試案例