product.get( 获取一个产品的信息 )

94 阅读2分钟

product.get( 获取一个产品的信息 )

API接口是应用程序接口(Application Programming Interface)的简称,是软件系统之间进行相互通信的一种方式。通俗地说,API接口就像是两个人之间的对话,一方提出请求,另一方则进行响应。

在计算机领域,API接口通常指的是应用程序或者软件库提供的一组方法或函数,这些方法或函数可以被外部程序调用,以实现特定的功能。API接口可以是开放的,也可以是受限制的。开放的API接口可以被任何人调用,用于实现自己的应用程序或者服务;而受限制的API接口通常需要进行认证和授权,只有获得授权的用户才能调用。

API接口可以基于不同的协议进行通信,例如HTTP、SOAP、REST等。在使用API接口时,通常需要提供一些参数,以指定需要执行的操作和所需的数据。API接口的响应结果通常是以特定的数据格式进行返回,例如JSON、XML等。

请求示例

$c->appkey = $appkey;
$c->secretKey = $secret;
$req = new ProductGetRequest;
$req->setFields("product_id,outer_id");
$req->setProductId("86126527");
$req->setCid("50012286");
$req->setProps("10005:10027;10006:29729");
$resp = $c->execute($req);

响应示例

    <product>
        <product_id>3433222</product_id>
        <outer_id>123456</outer_id>
        <tsc>hkjki</tsc>
        <cid>50012286</cid>
        <cat_name>日用品</cat_name>
        <props>pid:vid;pid:vid</props>
        <props_str>品牌:诺基亚;型号:N73</props_str>
        <name>惠普笔记本</name>
        <binds>pid:vid;pid:vid</binds>
        <binds_str>品牌:诺基亚;型号:N73</binds_str>
        <sale_props>pid:vid;pid:vid</sale_props>
        <sale_props_str>品牌:诺基亚;型号:N73</sale_props_str>
        <price>200.07</price>
        <desc>这是一款产品</desc>
        <pic_url>http://host/image_path</pic_url>
        <created>2000-01-01 00:00:00</created>
        <modified>2000-01-01 00:00:00</modified>
        <status>1</status>
        <vertical_market>3</vertical_market>
        <property_alias>1627207:3232483:深深绿色</property_alias>
        <customer_props>20000:优衣库</customer_props>
        <sell_pt>明星同款</sell_pt>
        <product_imgs>
            <product_img>
                <id>9684</id>
                <product_id>96899</product_id>
                <url>http://host/image_path</url>
                <position>2355</position>
            </product_img>
        </product_imgs>
        <product_prop_imgs>
            <product_prop_img>
                <id>674443</id>
                <product_id>96899</product_id>
                <props>颜色:红色表示为 1627207:28326</props>
                <url>http://host/image_path</url>
                <position>2355</position>
            </product_prop_img>
        </product_prop_imgs>
    </product>
</product_get_response>

异常示例

    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

点击测试