Recipe APIs

Last Updated on : 2021-08-27 11:07:07download

This topic describes the API operations to enable recipe functions. Before you make API requests, connect your product to the development backend. To use API request methods, call TYSdk.native.apiRequest.

Get the list of recipes (multilingual)

Action

tuya.ia.content.lang.onlinelist

API version

1.0

Parameter

Name Type Description Required
productId String The product ID. Yes
contentType String The query type. Default value: cookbook. Yes
lang String The multilingual identifier. A value of zh-CN to specify Chinese. Yes
pageNo Integer The page number. Yes
pageSize Integer The number of entries returned on each page. Yes
categoryName String The category of a recipe. No
nameSearch String The name by which recipies are searched. No

Sample request

{ "productId": "", "contentType": "cookbook", "lang": "zh-CN", "pageNo": 1, "pageSize": 2000, "categoryName": "" }

Sample response

{ "result" : { "contentList": [] }, "t" : 1527771204905, "success" : true, "status" : "ok" }

Get the list of recipes (Chinese)

Action

tuya.ia.content.onlinelist

Note: Only Chinese data is supported.

API version

1.0

Parameter

Name Type Description Required
productId String The product ID. Yes
contentType String The query type. Default value: cookbook. Yes
nameSearch String The name of the recipe. No
pageNo Integer The page number. Yes
pageSize Integer The number of entries returned on each page. Yes
categoryName String The category of a recipe. No

Sample request

{ "productId": "", "contentType": "cookbook", "pageNo": 1, "pageSize": 2000, "categoryName": "" }

Sample response

{ "result" : { "contentList": [] }, "t" : 1527771204905, "success" : true, "status" : "ok" }

Get details of a recipe

Action

tuya.ia.content.lang.detail

API version

1.0

Parameter

Name Type Description Required
productId String The product ID. Yes
contentId String The ID of the recipe. Yes
lang String The multilingual identifier. A value of zh-CN to specify Chinese. Yes

Sample request

{ "productId": "", "contentId": "", "lang": "zh-CN" }

Sample response

{ "result" : { "contentList": [] }, "t" : 1527771204905, "success" : true, "status" : "ok" }

Get the specified recipes

Action

tuya.ia.content.lang.query

API version

1.0

Parameter

Name Type Description Required
productId String The product ID. Yes
lang String Multilingual identifier. zh-CN indicates Chinese. Yes
pageNo Integer The page number. Yes
pageSize Integer The number of entries returned on each page. Yes
attrKey String The fields that are used to filter recepies. Yes
attrValue String The field values that are used to filter recepies. Yes

Sample request

{ "productId": "", "lang": "zh-CN", "pageNo": 1, "pageSize": 2000, "attrKey": "ishome", "attrValue": "true" }

Sample response

{ "result": { "gmtModified": 1544073110998, "data": "[{\"detailDisplay\":true,\"lang\":\"all\",\"summaryDisplay\":false,\"value\":false,\"key\":\"ishome\"},{\"detailDisplay\":true,\"lang\":\"all\",\"summaryDisplay\":false,\"value\":false,\"key\":\"supdevctrl\"},{\"detailDisplay\":true,\"lang\":\"all\",\"summaryDisplay\":false,\"value\":[{\"value\":\"\"}],\"key\":\"multistepslist\"},{\"detailDisplay\":true,\"lang\":\"all\",\"summaryDisplay\":true,\"value\":[\"hu1h6awyz1zatea6\"],\"key\":\"supdev\"},{\"contentId_dp\":\"112\",\"pinyin\":\"#\",\"contentId_dp_value\":\"\",\"detailDisplay\":true,\"switch_dp\":\"102\",\"lang\":\"zh-CN\",\"summaryDisplay\":true,\"value\":\"MTE=\",\"key\":\"name\"},{\"detailDisplay\":true,\"lang\":\"all\",\"summaryDisplay\":true,\"value\":\"https://images.tuyacn.com/smart/user_res/ay152472768202199f4N/content/Group-A1S.png\",\"key\":\"picture\"},{\"detailDisplay\":true,\"lang\":\"all\",\"summaryDisplay\":false,\"value\":\"https://images.tuyacn.com/smart/user_res/ay152472768202199f4N/content/222.mp4\",\"key\":\"video\"},{\"detailDisplay\":true,\"lang\":\"zh-CN\",\"summaryDisplay\":false,\"value\":\"MTEx\",\"key\":\"introduction\"},{\"detailDisplay\":true,\"lang\":\"en\",\"summaryDisplay\":false,\"value\":\"\",\"key\":\"introduction\"},{\"detailDisplay\":true,\"lang\":\"zh-CN\",\"summaryDisplay\":false,\"value\":\"MTE=\",\"key\":\"ingredients\"},{\"detailDisplay\":true,\"lang\":\"zh-CN\",\"summaryDisplay\":false,\"value\":\"MTEx\",\"key\":\"stepsdsc\"},{\"detailDisplay\":true,\"lang\":\"zh-CN\",\"summaryDisplay\":true,\"value\":\"Chinese\",\"key\":\"categoryName\"},{\"detailDisplay\":true,\"lang\":\"all\",\"summaryDisplay\":false,\"value\":{\"devCtrl\":{\"supCookingStep\":false,\"stepValue\":\"\",\"isdevctrl\":true,\"cookingStepMode\":false,\"items\":[{\"label\":\"Temperature\",\"value\":\"\"}]},\"cooking\":[{\"finishedItem\":\"0\",\"items\":[{\"label\":\"Temperature\",\"value\":\"\"}],\"picture\":\"\"}]},\"key\":\"hmsteps\"}]", "contentId": "1070546336010547200", "name": null, "remark": null, "id": 1158, "gmtCreate": 1544073110998, "categoryName": null, "picture": null, "status": "0" }, "code": "0", "success": true, "errorResult": null, "message": "success" }

Get a list of favorite recipes

Action

tuya.industry.cookbook.starlist

API version

1.0

Parameter

Name Type Description Required
pid String The product ID. Yes
lang String The multilingual identifier. A value of zh-CN to specify Chinese. Yes

Sample request

{ "lang": "zh-CN", "pid": "" }

Sample response

{ "result" : { "contentList": [] }, "t" : 1527771204905, "success" : true, "status" : "ok" }

Get the details of a favorite recipe

Action

tuya.industry.cookbook.starinfo

API version

1.0

Parameter

Name Type Description Required
pid String The product ID. Yes
contentId String The ID of the recipe. Yes

Sample request

{ "contentId": "", "pid": "" }

Sample response

{ "result" : true, "t" : 1527771204905, "success" : true, "status" : "ok" }

Add a recipe to the list of favorite recipes

Action

tuya.industry.cookbook.star

API version

1.0

Parameter

Name Type Description Required
pid String The product ID. Yes
contentId String The ID of the recipe. Yes

Sample request

{ "contentId": "", "pid": "" }

Sample response

{ "result": true, "t":1527767595606, "success":true, "status":"ok" }

Remove a recipe from a list of favorite recipes

Action

tuya.industry.cookbook.unStar

API version

1.0

Parameter

Name Type Description Required
pid String The product ID. Yes
contentId String The ID of the recipe. Yes

Sample request

{ "contentId": "", "pid": "" }

Sample response

{ "result":true, "t":1527767595606, "success":true, "status":"ok" }

Get the recipe category by PID

Action

tuya.industry.cookbook.category.search

API version

1.0

Parameter

Name Type Description Required
pid String The product ID. No
lang String The multilingual identifier. A value of zh-CN to specify Chinese. No
uid String User ID. No

Sample request

{ "productId": "", "lang": "zh-CN", "uid": "" }

Sample response

{ "result" : { "categoryList": [] }, "t" : 1527771204905, "success" : true, "status" : "ok" }

Send recipe instructions

Action

tuya.ia.content.dispatchMultiDps

API version

1.0

Parameter

Name Type Description Required
productId String The product ID. Yes
contentId String The ID of the recipe. Yes
deviceId String Device ID. Yes

Sample request

{ "productId": "", "contentId": "", "deviceId": "" }

Sample response

{ "result" : {}, "t" : 1527771204905, "success" : true, "status" : "ok" }

Get the list of recipes (new)

Action

tuya.ia.content.public.online.list

API version

1.0

Parameter

Name Type Description Required
productId String The product ID. Yes
contentType String The query type. Default value: cookbook. Yes
nameSearch String The name of the recipe. No
pageNo Integer The page number. Yes
pageSize Integer The number of entries returned on each page. Yes
categoryName String The category of a recipe. No

Sample request

{ "productId": "", "contentType": "cookbook", "pageNo": 1, "pageSize": 2000, "categoryName": "" }

Sample response

{ "result" : { "contentList": [] }, "t" : 1527771204905, "success" : true, "status" : "ok" }

Get the details of a recipe by recipeID in the background

Action

tuya.ia.content.id.detail

API version

1.0

Parameter

Name Type Description Required
productId String The product ID. Yes
id String ID. Yes

Sample request

{ "productId": "", "id": "", }

Sample response

{ "result" : {}, "t" : 1527771204905, "success" : true, "status" : "ok" }

Get the list of categories by language

Action

tuya.ia.content.langCategoryNames

API version

1.0

Parameter

Name Type Description Required
lang String Support multilingual recipes. Yes

Sample request

{ "lang": "", }

Sample response

{ "result" : {}, "t" : 1527771204905, "success" : true, "status" : "ok" }

Get the list of categories

Action

tuya.ia.content.CategoryNames

API version

1.0

Parameter

None.

Sample response

{ "result" : {}, "t" : 1527771204905, "success" : true, "status" : "ok" }