抖音API接口(item_search - 根据关键词取商品列表)

447 阅读7分钟

为了进行电商平台API开发,我们需要做下面几件事情。

1)开发者注册一个账号

2)然后在平台应用注册一个应用程序键(App Key) 。

3)下载平台API的SDK并掌握基本的API基础知识和调用

4)利用SDK接口和对象,传入AppKey或者必要的时候获取并传入SessionKey来进行程序开发。

5)利用平台提供的API文档中心和测试工具,对接口进行测试。从而了解返回信息,方便程序获取。
以上是电商平台的API应用开发的关键流程,其中通过平台文档中心和API测试工具,进行概念了解和接口信息查询很重要。因为这些数据就是我们需要在逐步显示出来的。lazada 的API很多,不过都分为了好几个领域,慢慢就会了解深入了。

企业微信截图_16620252166660.png

抖音根据关键词取商品列表 API 返回值说明

欢迎使用抖音API接接口 API测试工具

公共参数

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

请求参数

请求参数:q=连衣裙&page=1&sort=

参数说明:q:关键词,
filter:搜索类型:filter=video 搜索视频、filter=goods 搜索商品、filter=user 搜索用户,
page:页数
sort:排序(目前只视频可排序):sort=new 最新发布 sort=credit 最多点赞 sort=bid 综合排序\

响应参数

Version: Date:

名称类型必须示例值描述
itemsitems[]0按关键字搜索商品

请求示例

<?php

// 请求示例 url 默认请求参数已经URL编码处理
// 本示例代码未加密secret参数明文传输,若要加密请参考:https://open.onebound.cn/help/demo/sdk/demo-sign.php
$method = "GET";
$url = "https://api-gw.onebound.cn/douyin/item_search/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&q=连衣裙&page=1&sort=";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
var_dump(curl_exec($curl));
?>

API 返回结果

	"items": {
		"page": "1",
		"real_total_results": 500,
		"total_results": 500,
		"page_size": 20,
		"pagecount": 25,
		"item": [
			{
				"title": "Amyway 卡戴珊吊带裙 鱼尾中长款包臀裙纯欲连衣裙",
				"pic_url": "https://p6-aio.ecombdimg.com/obj/ecom-shop-material/v1_MxdibazK_71168422993930979920707_e9bf3d4e2557c59181c37dfc92d2b62b_sx_555456_www2048-2048",
				"promotion_price": 52.9,
				"price": 52.9,
				"sales": 46348,
				"num_iid": "3554323589534755803",
				"shop_name": "Amyway潮人馆",
				"shop_id": 14812707,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3554323589534755803&pick_source=jEpAgQL"
			},
			{
				"title": "MIIOW猫人睡衣睡裙女夏季纯棉短袖网红ins风薄款连衣裙夏天家居服",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/v1_iscOoISC_71075987008678955600192_60ba316a1c706b6e6b3dae54ca577461_sx_217877_www800-800",
				"promotion_price": 49.9,
				"price": 49.9,
				"sales": 69410,
				"num_iid": "3553719603333075663",
				"shop_name": "MiiOW猫人果涵家居服专卖店",
				"shop_id": 45923192,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3553719603333075663&pick_source=jEpQBvF"
			},
			{
				"title": "TUCANO/啄木鳥连衣裙女中长款2022夏季新款女装减龄气质显瘦裙子",
				"pic_url": "https://p6-aio.ecombdimg.com/obj/ecom-shop-material/aPEoJVLw_m_b90041016f3ca2eb1b96cf5a5eb77074_sx_517627_www800-800",
				"promotion_price": 59.9,
				"price": 59.9,
				"sales": 23018,
				"num_iid": "3562822049862920710",
				"shop_name": "TUCANO啄木鳥配饰旗舰店",
				"shop_id": 42679560,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3562822049862920710&pick_source=jEpaJ6N"
			},
			{
				"title": "TUCANO/啄木鳥连衣裙女中长款2022夏新款休闲宽松显瘦短袖裙子潮",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/NFccABaL_m_eda5b6d220f09a9eca5e4485a0fa6c57_sx_98346_www600-600",
				"promotion_price": 59.9,
				"price": 59.9,
				"sales": 42430,
				"num_iid": "3558942768938260328",
				"shop_name": "啄木鳥配饰旗舰店",
				"shop_id": 20217229,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3558942768938260328&pick_source=jEpbXmY"
			},
			{
				"title": "TUCANO/啄木鳥连衣裙女中长款2022夏季新款减龄气质显瘦裙子潮",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/aPEoJVLw_m_ed7b0c800559f20957a0670deb937ed5_sx_298052_www800-800",
				"promotion_price": 59.9,
				"price": 59.9,
				"sales": 23167,
				"num_iid": "3563979217383344968",
				"shop_name": "TUCANO啄木鳥配饰旗舰店",
				"shop_id": 42679560,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3563979217383344968&pick_source=jEpyv3X"
			},
			{
				"title": "2337 #夏季新品冰凉棉麻长款大摆连衣裙2022新款",
				"pic_url": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/vnbgZESf_m_c598235479aae9cc4525a65c27bb8756_sx_108319_www1080-1080",
				"promotion_price": 59.9,
				"price": 59.9,
				"sales": 14691,
				"num_iid": "3563623591910208127",
				"shop_name": "小奇林原创女装",
				"shop_id": 19448923,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3563623591910208127&pick_source=jEp4aYV"
			},
			{
				"title": "甜美清纯白色连衣裙女夏季2022年新款高级感泡泡袖长裙子女装8249",
				"pic_url": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/fQoQGNH_m_6d94c467d452e6ddc2092d03dbf78b88_sx_255943_www800-800",
				"promotion_price": 399,
				"price": 399,
				"sales": 16864,
				"num_iid": "3564691419597767299",
				"shop_name": "胜佳严选",
				"shop_id": 434984,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3564691419597767299&pick_source=jEpHYH4"
			},
			{
				"title": "TUCANO/啄木鳥连帽卫衣裙女中长款2022秋装新款气质显瘦连衣裙潮",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/aPEoJVLw_m_4c6d79cc5d6fb10d8b0376fd79b17cab_sx_526672_www800-800",
				"promotion_price": 79.9,
				"price": 79.9,
				"sales": 26799,
				"num_iid": "3567507339760278521",
				"shop_name": "TUCANO啄木鳥配饰旗舰店",
				"shop_id": 42679560,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3567507339760278521&pick_source=jEpsGnq"
			},
			{
				"title": "TUCANO/啄木鳥条纹圆领短袖连衣裙女2022夏季新款直筒宽松裙子女",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/v1_NFccABaL_70844935418539379600229_ec5d5d45416df718da7ed083a389ad51_sx_249532_www800-800",
				"promotion_price": 39.9,
				"price": 39.9,
				"sales": 27295,
				"num_iid": "3561400849613898917",
				"shop_name": "啄木鳥配饰旗舰店",
				"shop_id": 20217229,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3561400849613898917&pick_source=jEpUkMD"
			},
			{
				"title": "大码女装2022夏季新款赫本风翻领黑色连衣裙学院风纽扣显瘦A字裙",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/v1_RcTbnsUm_71049044562228513590694_10cfc182010ee623769bb3652aaab884_sx_133866_www800-800",
				"promotion_price": 22.9,
				"price": 22.9,
				"sales": 42706,
				"num_iid": "3552452255028481111",
				"shop_name": "大菀女装个体店",
				"shop_id": 50202694,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3552452255028481111&pick_source=jEpC3uy"
			},
			{
				"title": "儿童连衣裙夏季女童碎花公主裙沙滩裙2022夏季新款棉绸吊带背心裙",
				"pic_url": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/v1_AoMQNiYD_70711481913197365800428_d4da002be233923eecc3606016a42999_sx_772102_www800-800",
				"promotion_price": 21.9,
				"price": 21.9,
				"sales": 271809,
				"num_iid": "3535583652819900622",
				"shop_name": "开心小熊婴童店",
				"shop_id": 26923428,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3535583652819900622&pick_source=jEpmQcU"
			},
			{
				"title": "【鑫雨女装】长款欧潮简约纯色连帽毛衣裙慵懒风针织连衣裙",
				"pic_url": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/wwsSoGhu_m_8201c02ab3e0cfbdbca82992997207a9_sx_210537_www1080-1080",
				"promotion_price": 39.9,
				"price": 39.9,
				"sales": 14774,
				"num_iid": "3566182904897902571",
				"shop_name": "温州市鹿城区缇禾百货商行的小店",
				"shop_id": 29934732,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3566182904897902571&pick_source=jEppjFf"
			},
			{
				"title": "时尚圆领百搭拼接撞色显瘦连衣裙JX777777",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/cyunIYM_m_45f44e71eaa0fcdc8f13ed3b808c1f88_sx_220373_www1200-1200",
				"promotion_price": 999,
				"price": 999,
				"sales": 8637,
				"num_iid": "3564860377160356079",
				"shop_name": "珂曼雅原创女装",
				"shop_id": 3789087,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3564860377160356079&pick_source=jEpPP9c"
			},
			{
				"title": "JuSahy欧美纯色低胸吊带连衣裙不规则设计短裙K22D19304+C1738120",
				"pic_url": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/VZqosueS_m_e140e40e24e8a60412a6df5b0792167f_sx_408772_www800-800",
				"promotion_price": 58,
				"price": 58,
				"sales": 13087,
				"num_iid": "3564727613270430954",
				"shop_name": "JuSahy潮人馆",
				"shop_id": 24585879,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3564727613270430954&pick_source=jEpqeWT"
			},
			{
				"title": "【牙牙心选】2022年秋款新款上新吊带背心高级洋气针织连衣裙",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/LUrZKrBe_m_df7cc38430feefe6cd473fd40749c614_sx_162958_www1122-1122",
				"promotion_price": 99999,
				"price": 99999,
				"sales": 11233,
				"num_iid": "3562799952256209962",
				"shop_name": "杭州余杭耿耿服装店个体店",
				"shop_id": 48722146,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3562799952256209962&pick_source=jEp9s23"
			},
			{
				"title": "TUCANO/啄木鳥休闲长袖连衣裙女中长款2022年秋季新款圆领T恤裙子",
				"pic_url": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/NFccABaL_m_b8c18d961793ba577cfb488dc560275f_sx_111785_www600-600",
				"promotion_price": 69.9,
				"price": 69.9,
				"sales": 21035,
				"num_iid": "3551368761548351107",
				"shop_name": "啄木鳥配饰旗舰店",
				"shop_id": 20217229,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3551368761548351107&pick_source=jEptA5w"
			},
			{
				"title": "2336夏季新品原创冰凉棉麻长款碎花大摆连衣裙",
				"pic_url": "https://p3-aio.ecombdimg.com/obj/ecom-shop-material/vnbgZESf_m_9db89aa49e9bd97ee3432edbefa2bf73_sx_285868_www1284-1284",
				"promotion_price": 199,
				"price": 199,
				"sales": 8557,
				"num_iid": "3563622629795596210",
				"shop_name": "小奇林原创女装",
				"shop_id": 19448923,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3563622629795596210&pick_source=jEpDmTM"
			},
			{
				"title": "拉夏贝尔Homme/2022秋季新款赫本风高级感凡尔赛森女系连衣裙 ML",
				"pic_url": "https://p6-aio.ecombdimg.com/obj/ecom-shop-material/azvvTxEv_m_7275e428285d1b92a2e5f14e4ad7964e_sx_104884_www600-600",
				"promotion_price": 179.99,
				"price": 179.99,
				"sales": 8725,
				"num_iid": "3564024819190206659",
				"shop_name": "LACHAPELLEHOMME抖时尚服饰专卖店",
				"shop_id": 10826828,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3564024819190206659&pick_source=jEpCL2h"
			},
			{
				"title": "【梦婷家】开衫+吊带显瘦连衣裙",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/pstLrRaB_m_1a8d3aa9cce83ceadb99735d0480d2c6_sx_679546_www700-700",
				"promotion_price": 129.9,
				"price": 129.9,
				"sales": 8781,
				"num_iid": "3565787033551119083",
				"shop_name": "A梦婷服饰",
				"shop_id": 14286630,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3565787033551119083&pick_source=jEpan9r"
			},
			{
				"title": "女童连衣裙儿童冰丝裙子宝宝韩版背心裙休闲童装",
				"pic_url": "https://p9-aio.ecombdimg.com/obj/ecom-shop-material/v1_EINTFuDN_70983113781763607160633_d95804a1d4b8b0f6c71c6cb9f580f8c2_sx_151050_www1080-1080",
				"promotion_price": 7.9,
				"price": 7.9,
				"sales": 18231,
				"num_iid": "3555617212209477800",
				"shop_name": "多乐家童装个体店",
				"shop_id": 48371633,
				"detail_url": "https://haohuo.jinritemai.com/views/product/item2?id=3555617212209477800&pick_source=jEpgyWk"
			}
		],
		"_ddf": "xpgj"
	},
	"error_code": "0000",
	"reason": "ok",
	"secache": "9fd1f6906c8b8bc9080fe69807fc5a1f",
	"secache_time": 1662025152,
	"secache_date": "2022-09-01 17:39:12",
	"translate_status": "",
	"translate_time": 0,
	"language": {
		"default_lang": "cn",
		"current_lang": "cn"
	},
	"error": "",
	"cache": 1,
	"api_info": "today:180 max:10100 all[298=180+82+36];expires:2030-12-31",
	"execution_time": "0.056",
	"server_time": "Beijing/2022-09-01 17:39:27",
	"client_ip": "106.6.35.69",
	"call_args": {
		"q": "连衣裙",
		"start_price": "1"
	},
	"api_type": "douyin",
	"translate_language": "zh-CN",
	"translate_engine": "google_new",
	"server_memory": "3.15MB",
	"request_id": "gw-1.63107dcf71806",
	"last_id": "1189089479"
}