API接口应用示例

api就是应用程序编程接口,简称API(Application Programming Interface),就是软件系统不同组成部分衔接的约定。 

随着软件规模的日益庞大,我们需要把复杂系统划分成小的组成部分,编程接口的设计十分重要。程序设计的实践中,编程接口的设计首先要使系统的职责得到合理划分。良好的接口设计可以降低系统各部分的相互依赖,提高组成单元的内聚性,降低组成单元间的耦合程度,从而提高系统的维护性和扩展性。

API测试工具

名称 类型 必须 描述
key String 调用key(必须以GET方式拼接在URL中)
secret String 调用密钥
api_name String API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]
cache String [yes,no]默认yes,将调用缓存的数据,速度比较快
result_type String [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读
lang String [cn,en,ru]翻译语言,默认cn简体中文
version String API版本

 API 返回结果

{
    "item": {
        "num_iid": "3514453298386183303",
        "title": "【古蒂歌品牌】精致磨毛纹理 叠穿衬衣女春装新款 高档磨毛衬衫 ",
        "desc_short": "",
        "price": 82,
        "total_price": "",
        "suggestive_price": "",
        "orginal_price": 82,
        "nick": "",
        "num": "",
        "detail_url": "",
        "pic_url": "",
        "brand": "",
        "brandId": null,
        "rootCatId": null,
        "cid": 0,
        "desc": "",
        "item_imgs": [
            {
                "url": "https://p6-aio.ecombdimg.com/obj/temai/e9ed9a7b06bbbf03b769075a4cf12045www876-876"
            },
            {
                "url": "https://p6-aio.ecombdimg.com/obj/temai/f6543c94a2c3c724fd57a8c61d6e79ec7bb846f5www800-800"
            },
            {
                "url": "https://p6-aio.ecombdimg.com/obj/temai/d312afa85676443c7a807688d4aab85cwww800-800"
            },
            {
                "url": "https://p3-aio.ecombdimg.com/obj/temai/104f75934f295b6395ec792ad755eed8b10f543dwww800-800"
            },
            {
                "url": "https://p9-aio.ecombdimg.com/obj/temai/3d65927c478ab58d06ecc31e6f541d2099e2429cwww800-800"
            }
        ],
        "item_weight": "",
        "post_fee": null,
        "freight": null,
        "express_fee": "",
        "ems_fee": "",
        "shipping_to": "",
        "video": [],
        "sample_id": "",
        "props_name": "",
        "prop_imgs": {
            "prop_img": []
        },
        "props_imgs": {
            "prop_img": []
        },
        "property_alias": "",
        "props": [],
        "total_sold": "",
        "skus": [],
        "seller_id": "",
        "sales": 0,
        "shop_id": "sXahcZg",
        "props_list": [],
        "seller_info": {
            "nick": "",
            "item_score": null,
            "score_p": null,
            "delivery_score": null,
            "shop_type": null,
            "shop_logo": "https://p3-aio.ecombdimg.com/obj/temai/1611656872ab5f2645a9f6cf20810db68844e3e3f5cf248f0f",
            "sid": 0,
            "title": "古蒂歌精品女装店",
            "shop_name": "古蒂歌精品女装店"
        },
        "tmall": "",
        "error": "",
        "location": null,
        "data_from": "app",
        "format_check": "ok",
        "desc_img": [],
        "shop_item": [],
        "relate_items": []
    },
    "error": "",
    "secache": "13dfb7af3b9afe151343f76cf8040cc2",
    "secache_time": 1658713748,
    "secache_date": "2022-07-25 09:49:08",
    "translate_status": "",
    "translate_time": 0,
    "language": {
        "default_lang": "cn",
        "current_lang": "cn"
    },
    "reason": "",
    "error_code": "0000",
    "cache": 0,
    "api_info": "today:14 max:10100 all[55=14+10+31];expires:2030-12-31",
    "execution_time": "0.814",
    "server_time": "Beijing/2022-07-25 09:49:08",
    "client_ip": "106.6.34.78",
    "call_args": {
        "num_iid": "3514453298386183303"
    },
    "api_type": "douyin",
    "translate_language": "zh-CN",
    "translate_engine": "google_new",
    "server_memory": "3.14MB",
    "request_id": "gw-1.62ddf69419086",
    "last_id": "1100119666"
}

猜你喜欢

转载自blog.csdn.net/ocean_hhn/article/details/125968669