Last active
October 29, 2024 16:04
-
-
Save tonytonyjan/fe0848997a038ca84081d4664a1f519f to your computer and use it in GitHub Desktop.
中華郵政包裹查詢 API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
test $# != 1 && cat <<USAGE && exit 1 | |
Usage: $0 MAIL_ID | |
== Output Example == | |
[ | |
{ | |
"datime": "20190520195647", | |
"status": "運輸途中 ", | |
"station": "台北中心掛號函件股 " | |
}, | |
{ | |
"datime": "20190520172500", | |
"status": "交寄郵件 ", | |
"station": "臺北螢橋郵局 " | |
} | |
] | |
USAGE | |
jq -n -c --arg mailNO "$1" '{ | |
header: { | |
InputVOClass: "com.systex.jbranch.app.server.post.vo.EB500100InputVO", | |
TxnCode: "EB500100", | |
BizCode: "query2", | |
StampTime: true, | |
SupvPwd: "", | |
TXN_DATA: {}, | |
SupvID: "", | |
CustID: "", | |
REQUEST_ID: "", | |
ClientTransaction: true, | |
DevMode: false, | |
SectionID: "esoaf" | |
}, | |
body: { MAILNO: $mailNO, pageCount: 10 } | |
}' | | |
curl -sSL 'https://postserv.post.gov.tw/pstmail/EsoafDispatcher' --data @- | | |
jq '.[0].body.host_rs.ITEM | map({datetime: .DATIME, status: .STATUS, station: .BRHNC})' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@tzuChueh
抱歉你說的建立i郵箱託運單 API 我並沒有研究
另外感謝使用,我沒想到 2019 的腳本到今天還可以運作哈哈