E-commerce express logistics electronic face order picture interface API case code

E-commerce express logistics electronic face order picture interface API case code

1. the single picture interface of the electronic face

Submit and generate an electronic receipt through the electronic receipt account provided by the courier company or outlets, Cainiao and Taobao; through the management background template configuration, the receipt template can be selected and edited, and the image output can be generated and printed in a self-selected way.

1.1 Interface format

Provide a unified format HTTP POST or GET call interface, and return unified format JSON data.

1.2 Request address

https://poll.kuaidi100.com/printapi/printtask.do

Request parameters (header)

nameTypes ofDefaults
Content-Typestringapplication/x-www-form-urlencoded

Request parameters (body)

parameter nameIs it requiredTypes ofDescription
methodYesstringBusiness type (default: getPrintImg)
keyYesstringAuthorization code, please apply for the enterprise version to obtain
signYesstring32-bit uppercase , signature, used to verify identity, MD5 encryption in the order of MD5 (param +t+key+ secret), no need to add "+" sign, secret is viewed in the enterprise management background
tYesstringTimestamp such as: 1576123932000
paramYesstringConcatenated by other fields

param data structure:

parameter nameIs it requiredTypes ofDescription
typeYesstringBusiness type, the default is 10
partnerIdYesstringElectronic face-off customer account or monthly settlement account, you need to apply to the local courier company outlets (refer to the electronic face-off application guide ); whether this attribute is required, please check the parameter dictionary
partnerKeynostringThe password of the electronic bill, you need to apply to the local courier company outlet; if this attribute is required, please check the parameter dictionary
partnerNamenostringBusiness name, required when net is jdalpha
netnostringThe name of the receiving outlet is assigned by the local outlet of the express company. If you use Taobao authorization to fill in (taobao), use Cainiao authorization to fill in (cainiao). Whether this attribute is required, please check the parameter dictionary (if the single number partnerId is obtained through Taobao/Cainiao authorization, the partnerKey parameter is required, and the parameter value can be obtained through the Cainiao Taobao account authorization interface)
tbNetnostringWhen using Cainiao/Taobao/Pinduoduo authorized electronic face-to-face slip, if there are multiple outlets under the monthly account, tbNet=" outlet name, outlet number", note that this is an English comma
kuaidicomYesstringThe code of the courier company, always use lowercase letters, see the parameter dictionary
recManNameYesstringThe recipient's name
recManMobileYesstringThe recipient s mobile phone number, one of the mobile phone number and the phone number is required
recManPrintAddrYesstringThe complete address of the recipient, such as Kingdee Software Park, No. 2, Keji South 12th Road, Nanshan District, Shenzhen, Guangdong
sendManNameYesstringSender name
sendManMobileYesstringThe sender s mobile phone number, one of the mobile phone number and the phone number is required
sendManPrintAddrYesstringThe complete address of the sender, such as B10, Kingdee Software Park, No. 2, Keji South 12th Road, Nanshan District, Shenzhen, Guangdong
tempidYesstringObtain the configuration information of the print template in the management background
cargonostringItem name, example: file
countYesstringThe total number of items. In addition, this attribute is related to sub-orders. If you need a sub-order (referring to printing out multiple electronic face-to-face orders for the same order, that is, the same order returns multiple face-to-face numbers), needChild = 1, count needs to be greater than 1, such as count = 2 One main order and one sub-order, count = 3, one main order and two sub-orders; for the returned sub-order number, see the childNum field of the returned result
weightnostringThe total weight of the article KG, for example: 1.5, the unit kg
payTypenostringPayment method: SHIPPER: sender to pay (default) CONSIGNEE: to pay MONTHLY: monthly settlement THIRDPARTY: third-party payment (please refer to the parameter dictionary for details )
expTypenostringExpress Type: Standard Express (default), SF Express (land transport), EMS economy, etc. (please refer to the parameter dictionary for details )
remarknostringRemarks
Face sheet extended attributes
valinsPaynostringInsured amount
collectionnostringCollection amount
needChildnostringDo you need a child order: 1: Need 0: No need (default) If you need a child order (refers to the same order to print out multiple electronic face orders, that is, the same order returns multiple face order numbers); needChild = 1, count required Greater than 1, such as count = 2 one main order and one sub-order, count = 3 one main order and two sub-orders, the returned sub-order number is shown in the childNum field of the returned result
needBacknostringDo you need a receipt: 1: Need 0: Not required (default) The returned receipt number is shown in the returnNum field of the returned result
orderIdnostringYour internal custom order number needs to be unique
heightnostringThe height of the generated picture, in mm, for example: 100
widthnostringThe width of the generated picture, in mm, for example: 75
saltnostringRandom string for signature
opnostringWhether to enable the subscription function 0: Not enable (default) 1: Enable description When the subscription function is enabled: pollCallBackUrl must be filled in. This function is only for orders with a courier number
pollCallBackUrlnostringIf op is set to 1, pollCallBackUrl must be filled in for tracking callbacks
resultv2nostringAdding this field means opening the administrative area analysis function. For details, please refer to the relevant description of the express information push interface document. 0: Disable (default) 1: Enable administrative area analysis function

About receipts : The outlets that support receipts include SF Express, SF Express, Debon Express, Debon Logistics, JD, Leapfrog, Huisen Express, Jiayunmei Logistics, and Shunxin Jetta; the rookies that support receipts include Shentong Express, Zhongtong Express, Yunda Express, Debon Express;

About sub-list : The outlets that support sub-orders include SF Express, SF Express, Debon Express, Debon Logistics, JD, Pinjun, Quanyi Express, Suer Express, Xinfeng Logistics, U-Speed Express, Home Express, YTO Commitment Express, Longbang Express, D Express, Huisen Express, Jiayunmei Logistics, Beijing-Guangzhou Express, Shunxin Jetta, One Meter Tick; The rookie noodles that support sub-orders include Shentong Express, Zhongtong Express, Yunda Express, and Germany State Express, An Neng Express, Best Express;

1.3 Example of request parameters

method = getPrintImg key = kytRsteof sign = 4BBDE07660E5EFF90873642CFAE9A8DD t = 1470304729724 param = { "type": "10", "partnerId": "******", "partnerKey": "******", "net": "taobao", "kuaidicom": "ems", "recManName": "Zhang San", "recManMobile": "13842569988", "recManPrintAddr": "Kingdee Software Park, No. 2, Keji South 12th Road, Nanshan District, Shenzhen, Guangdong", "sendManName": " ", "sendManMobile": "13842569988", "sendManPrintAddr": "B10, Kingdee Software Park, No. 2, Keji South 12th Road, Nanshan District, Shenzhen, Guangdong", "tempid": "e41bbe3a3c764409a8562b2715f656b2", "cargo": "Invoice", "count": "1", "weight": "0.5", "payType": "SHIPPER", "expType": "Standard Express", "remark": "", "remark": "", "collection": "", "needChild": "", "needBack": "", "orderId": "", "height": "100", "width": "75", "salt": "123456789", "op": "0", "pollCallBackUrl": "", "resultv2": "0" } Copy code

1.4 Return results

FieldTypes ofDescriptionRemarks
resultbooleanSubmit resulttrue submitted successfully, false failed
returnCodestringReturn code
messagestringReturn message description
datadata

data structure

FieldTypes ofDescriptionRemarks
taskIdstringTask ID
kuaidicomstringCourier company code
kuaidinumstringtracking number
imgBase64stringSingle BASE64 encoded pictureThis attribute is a JsonArray structure, if there is only one face sheet size is 1, if there is a parent-child bill, the face sheet size>1
*****stringAttached attributes of express delivery bills, return attributes according to each express company

1.5 Example of returned message

{ "result" : true , "returnCode" : "200" , "message" : "Submitted successfully" , "data" : { "taskId" : "****" , //Task ID "kuaidicom" : "* ***" , //Courier company code "kuaidinum" : "****" , //Courier number "imgBase64" : "****" , //BASE64 coded picture ****** } } Copy code

1.6 Meaning of the returned information code

Information codeInformation content descriptionReasons and suggested ways to deal with it
200Submitted successfullySubmitted successfully
400Parameter errorPlease pay attention to the parameter type and whether it is required according to the technical document request.
500Server ErrorCourier 100's server is out of order or temporarily abnormal. Sometimes if the request is not submitted according to the specifications, such as the wrong courier company parameters, this error will also be reported
501repeated submitRepeat print request
502The submitted content contains sensitive keywords and is blocked by security protectionCheck the submitted content, you can find the express 100 staff to investigate
503Failed to verify signatureCheck the encryption method, MD5 encryption is performed in the order of param +t+key+ secret, and the encrypted string is converted to 32-bit uppercase without adding a "+" sign
600You are not a legitimate customer (that is, the authorization key is wrong)There is no single amount available for the account, and it needs to be recharged
601KEY has expiredThere is no single amount available for the account, and it needs to be recharged
601E-mail account verification failed, please confirm whether the account information is correctThe incoming e-mail account information is incorrect, please contact your local branch to obtain the correct account information.
602Insufficient balance of the number of electronic face orders, please contact the customer service of the cooperative outlets to rechargeThe number of electronic bills for the electronic billing account of the courier company's branch account is insufficient, and the number of bills needs to be recharged at the branch.
603Unable to obtain administrative informationPlease fill in the detailed provincial and municipal information
604The courier company does not support sub-order numbersPlease check 1.2 Courier companies that support sub-orders
605The courier company does not support receiptPlease check 1.2 Courier companies that support receipts
606Business type errorSelect the appropriate business type from the parameter dictionary
607The recipient's mobile phone number or phone number cannot be blank at the same timeIncoming recipient's mobile phone number or phone number
610Cainiao electronic face bill authentication information expired, please re-authorizeThe rookie authorization is valid for one year, and the authorization will be reauthorized when it expires
697Electronic face slip request failed, please reprintPlease pay attention to the parameter type and whether it is required according to the technical document request.

Official document resource: api.kuaidi100.com/document/5f...