Api-订单批量查询

该api为通过接口批量获取产品订单查询

准备工作

登录获取access-token,并将access-token设置为请求头参数,如何获取access-token,请参考“获取token文档

API说明:

URL: https://dpapi.quarkscm.com/v1/myorder/get-orders

格式:JSON
方式:POST

请求参数说明:

请求头参数:

参数名称 是否必须 类型 描述
access-token 必须 string 登录后获取的token,此接口access-token必填

Body Form-Data:

参数名称 是否必须 类型 描述
page 选填 int 页码,默认为1
pageSize 选填 int 每页条数,默认为20,最大值为50
platform 选填 string 订单所属平台
startDate 选填 string 订单开始创建时间
endDate 选填 string 订单结束创建时间
status 选填 int 订单状态:1.待付款,2.已付款,3.已取消,4.处理中,5.已搁置,6.已发货,7.已完成,10.待采购,不传则查所有状态订单
shippingStatus 选填 int 物流状态:0.待发货,1.部分发货,2.已发货,3.部分签收,4.已签收,不传则查所有物流状态订单

请求参数示例如下:

{
    "page": 1,
    "pageSize": 20,
    "platform": "shopee",
    "startDate": "1900-01-01",
    "endDate": "1900-02-01",
}

返回参数说明 :

格式:json

参数名称 是否必须 类型 描述
code 必须 integer 状态码
data 不必须 array 请求成功为data数组数据,请求失败则无此参数
message 不必须 string 请求失败返回错误信息,请求成功则无此参数

返回数据data参数说明:

参数名称 类型 描述
increment_id string 订单ID,唯一标识
total int 总订单数
orginal_order_no string 原始订单号
origin_amount string 原始订单金额
origin_order_platforms string 订单所属平台
created_at string 订单创建时间
items_count string 商品数量
total_weight string 商品总重量
order_currency_code string 订单支付币种
order_to_base_rate string 订单支付币种汇率
handle_fee string 仓库处理费
package_fee string 打包费
insurance_fee string 运费险
shipping_cost string 物流费
grand_total string 总价
subtotal string 商品价格
status int 订单状态:1.待付款,2.已付款,3.已取消,4.处理中,5.已搁置,6.已发货,7.已完成,10.待采购
shipping_status int 物流状态:0.待发货,1.部分发货,2.已发货,3.部分签收,4.已签收
customer_firstname String 订单客户的firstname
customer_lastname String 订单客户的lastname
customer_telephone String 订单客户的电话
customer_email String 订单客户的下单邮箱
customer_address_country String 订单客户的收货地址:国家
customer_address_state String 订单客户的收货地址:省/州
customer_address_city String 订单客户的收货地址:城市
customer_address_street1 String 订单客户的收货地址:详细地址1
customer_address_street2 String 订单客户的收货地址:详细地址2
remark String 备注:(买家留言.不能超过1000个字符)
customer_address_zip String 订单客户的收货地址:邮编
shipping_method string 运输方式简码
shipping_method_en_name string 运输方式英文名称
shipping_method_ch_name string 运输方式中文名称
sku array Sku集合
sku_info array Sku信息集合
shipping array 发货物流集合,没有物流信息集合为空
shipping.track_number string 追踪号
shipping.track_updated string 追踪号更新时间
shipping.ship_confirm_date string 发货时间
shipping.order_status string 订单状态
shipping.is_register string 物流代码

返回参数示例:

返回参数详细:

1.成功:返回参数

{
    "code": 200,
    "data": {
        "total": 2,
        "orders": [
            {
                "increment_id": "QSCM1100124130",
                "orginal_order_no": "XXX-123456",
                "origin_amount": null,
                "origin_order_platforms": "others",
                "created_at": "1625043817",
                "items_count": "1",
                "total_weight": "193.00",
                "order_currency_code": "USD",
                "order_to_base_rate": "1.0000",
                "handle_fee": "0.28",
                "package_fee": "0.08",
                "insurance_fee": "0.0000",
                "shipping_total": "7.37",
                "subtotal": "3.66",
                "grand_total": "13.90",
                "status": 1,
                "shipping_status": 0,
                "customer_firstname": "心",
                "customer_lastname": "似月",
                "customer_email": "Your Quarkscm Account",
                "customer_telephone": "18686688866",
                "customer_address_country": "US",
                "customer_address_state": "California",
                "customer_address_city": "Los Angeles",
                "customer_address_zip": "10051",
                "customer_address_street1": "1 Main Street",
                "customer_address_street2": "",
                "remark": "",
                "shipping_method": "ZPTU1",
                "shipping_method_en_name": "yiyuntong US tracking",
                "shipping_method_ch_name": "YYT美国专线(0-3KG)",
                "sku": [
                    "G0832BE-S"
                ],
                "sku_info": [
                    {
                        "qty": "1",
                        "sku": "G0832BE-S",
                        "item_price": "3.6600",
                        "tax_refund_income": 0
                    }
                ],
                "shipping": [
                    {
                        "item_id": "QSCM1100124130",
                        "ship_confirm_date": "2020-06-15 14:04:50",
                        "order_no": "No.qks20200615-135075073-TX1",
                        "track_number": "000000000",
                        "track_updated": "2020-06-17 01:40:30",
                        "sale_status": "140",
                        "order_status": "140",
                        "sku": [
                            "G0832BE-S"
                        ],
                        "is_register": "H2"
                    },
                ]
            },
            {
                "increment_id": "QSCM1100124129",
                "orginal_order_no": "XXX-1234567",
                "origin_amount": null,
                "origin_order_platforms": "others",
                "created_at": "1625034793",
                "items_count": "1",
                "total_weight": "193.00",
                "order_currency_code": "USD",
                "order_to_base_rate": "1.0000",
                "handle_fee": "0.28",
                "package_fee": "0.08",
                "insurance_fee": "0.0000",
                "shipping_total": "14.40",
                "subtotal": "3.66",
                "grand_total": "18.42",
                "status": 1,
                "shipping_status": 0,
                "customer_firstname": "心",
                "customer_lastname": "似月",
                "customer_email": "Your Quarkscm Account",
                "customer_telephone": "18686688866",
                "customer_address_country": "US",
                "customer_address_state": "California",
                "customer_address_city": "Los Angeles",
                "customer_address_zip": "10051",
                "customer_address_street1": "1 Main Street",
                "customer_address_street2": "",
                "remark": "",
                "shipping_method": "PTSH",
                "shipping_method_en_name": "Holland Shun Feng registration",
                "shipping_method_ch_name": "荷兰小包挂号",
                "sku": [
                    "G0832BE-S"
                ],
                "sku_info": [
                    {
                        "qty": "1",
                        "sku": "G0832BE-S",
                        "item_price": "3.6600",
                        "tax_refund_income": 0
                    }
                ],
                "shipping": []
            }
        ]
    }
}

php 代码示例:

<?php
function getCurlData($url,$type="get",$data=array(),$timeout = 10) {
    //对空格进行转义
    $http_header = array();
    if(isset($data['access-token'])){
        $http_header[] = 'access-token: ' . $data['access-token'];
        unset($data['access-token']);
    }
    $url = str_replace(' ','+',$url);
    if (strtolower($type) == "get") {
        if (!empty($data) && is_array($data)) {
            $arr = [];
            foreach ($data as $k=>$v) {
                $arr[] = $k."=".$v;
            }
            $str = implode("&",$arr);
            if (strstr($url,"?")) {
                $url .= "&".$str;
            } else {
                $url .= "?".$str;
            }
        }
    }
    
    $ch   = curl_init();
    curl_setopt($ch, CURLOPT_URL, "$url");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch,CURLOPT_TIMEOUT,$timeout);  //定义超时3秒钟
    if(strtolower($type) == "post"){
        $data = json_encode($data);
        // POST数据
        curl_setopt($ch, CURLOPT_POST, 1);
        $http_header[] = 'Accept: application/json';
        $http_header[] = 'Content-Type: application/json';
        $http_header[] = 'Content-Length: ' . strlen($data);

        // 把post的变量加上
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    }
    curl_setopt($ch, CURLOPT_HTTPHEADER,$http_header);
    //执行并获取url地址的内容
    $output = curl_exec($ch);
    //echo $output ;
    //释放curl句柄
    curl_close($ch);
    //var_dump($output);exit;
    return $output;
}
$url = 'https://dpapi.quarkscm.com/v1/myorder/get-orders';
$data['access-token'] = "c_xyXeQgyKcWHM9kS0yukwlC5bgMVJST";
$res = getCurlData($url,'post',$data);
echo $res;
?>