本文資訊適用於付費版 Dropbox Fax 方案用戶。
請注意:Dropbox Fax 端點已從 v1 更新為 v3。v1 端點將停止維護。進一步瞭解升級至新版 v3 端點的相關內容及其對開發人員的好處。
本文同時說明如何使用 v1 端點設立 Dropbox Fax API、確認其運作正常,以及在需要時購買額外的傳真線路。
若要開始使用 v1 端點,請按照以下方式操作:
curl -u "[your username]:[your password]" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]"
curl -u "myemail@hellofax.com:fakepassword" "https://api.hellofax.com/v1/Accounts/15da1c48b10c96a903eb1bac3d592fbed24ebc35"
curl "https://myemail%40hellofax.com:fakepassword%40api.hellofax.com/v1/Accounts/15da1c48b10c96a903eb1bac3d592fbed24ebc35"
回應內容將是您帳戶設定的 JSON 表示形式。
curl -u"[your username]:[your password]" \ -d "DefaultInboundFaxCallbackUrl=https://www.example.com/inboundFax" \ -d "DefaultOutboundFaxCallbackUrl=https://www.example.com/outboundFax" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]"
請注意:接收的傳真將以 POST 方式傳送到您的 Callback 網址,因此您不需要分開擷取。
curl -u "[your username]:[your password]" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]/FaxLines"
回應內容將包含您在註冊付費版方案時所選擇的 FaxLine。
curl -u "[your username]:[your password]" \ "https://api.hellofax.com/v1/AreaCodes?StateCode=CA"
curl -u "[your username]:[your password]" \ -d "AreaCode=[area code from step 7]" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]/FaxLines"
curl -u "[your username]:[your password]" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]/Transmissions?To=[destination phone number]" \ -F "file=@myfile.pdf"
此操作將開始傳真傳送流程。收到 200 HTTP 回應並不保證傳真會傳送成功,且可能會發生檔案轉換錯誤。不過,一旦傳真的 StatusCode 變成 E(即錯誤)或 S(即成功),您將在步驟 4 中提供的 Callback 網址收到一個 POST。深入瞭解 Callback 事件。
可能的 StatusCode 值:
可能的 ErrorCode 值(僅在 StatusCode 設為 E 時可供參考):
備註 :
curl -u "[your username]:[your password]" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]/Transmissions?To=[destination phone number]&From=[your fax line phone number]" \ -F file=@myfile.pdf`
針對「來電者」值的格式,請參閱撥號/FaxLines 傳回的「號碼」欄位(請參閱上述步驟 5)。
curl -u "[your username]:[your password]" \ -F file[]="@1.pdf" -F file[]="@2.txt" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]/Transmissions?To=[phone number in all digits]"
curl -X POST https://[your username]:[your password]@api.hellofax.com/v1/Accounts/[Your Account GUID]/Transmissions -F 'file[0]=@file1.pdf' \ -F 'file[1]=@file2.pdf' \ -F 'To[0]=[destination fax number 0]' \ -F 'To[1]=[destination fax number 1]'
Error sending fax. Status: 429; Message: Please wait. You already have at least 200 transmissions that are currently pending or transmitting.
curl -u "[your username]:[your password]" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]/Transmissions/[Transmission GUID]"
curl -u "[your username]:[your password]" \ "https://api.hellofax.com/v1/Accounts/[Your Account GUID]/Transmissions"
若因伺服器或網路問題導致 POST Callback 失敗,Dropbox 會依下列時間間隔重試:
在每個間隔期間,如果未收到 200 回應代碼,Dropbox 可能會多次嘗試該 POST。
curl -u "[your username]:[your password]" \ "https://api.hellofax.com/v1/Accounts/[Account GUID]/FaxLines"
curl -u "[your username]:[your password]" -X DELETE "https://api.hellofax.com/v1/Accounts/[Account GUID]/FaxLines/2132935579"
請注意:Callback 中的 JSON 包含 [交易] 而不是 [傳輸],這是已知的問題。在下一個版本的 API 將會修正此錯誤。
有幫助,感謝!
還好
Let us know how why it didn't help:
Thanks for letting us know!
感謝您的意見。