Scene Recommendation and Query API Reference

Image Background Query

POST /ai/image/background/generation/scene/query

We have many different styles of scenes, and users can choose their desired scenes freely. Through this API, users can get automatically recommended scenes by providing product information. Additionally, users can query pre-set scenes, and this API can return information including scene ID, name, cover image, tags, etc.

Request Parameters

ParameterTypeRequiredDescription

productTitle

String

No

Recommended scenes based on the provided product title. Only product titles in Chinese or English are supported.

imageUrl

String

No

Recommended scenes based on the provided product image.

categoryType

String

No

Query scenes based on a specified product category. Currently, 11 product categories are supported. If not set, the default is to query scenes for all categories.

Value range:

1=General Purpose; 2=Consumer Electronics; 3=Home & Garden; 4=Automobiles, Parts & Accessories; 5=Computer & Office; 6=Sports & Entertainment; 7=Clothing; 8=Beauty & Health; 9=Tools; 10=Toys & Hobbies; 11=Phones & Telecommunications

sceneType

String

No

Query scenes based on a specified scene type. Currently, 4 types of scenes are supported. If not set, the default is to query scenes of all types.

Value range:

1=Indoor; 2=Outdoor; 3=Atmosphere; 4=Promotion

count

Number

No

The maximum number of scenes to return. If not set, the default is to return all queried amounts.

Value range: 1-100.

Sample Request

IopClient client = new IopClient(url, appkey, appSecret);
IopRequest request = new IopRequest();
request.setApiName("/ai/image/background/generation/scene/query");
request.addApiParameter("productTitle", "Twin XL Mattress Pad Pillow Top Quilted Fitted Mattress Cover/ Protector Extra Long Cotton Top 8-21" Deep Pocket Cooling Mattress Topper");
request.addApiParameter("sceneType", "Indoor");
request.addApiParameter("count", "1");
request.addApiParameter("imageUrl", "https://ae01.alicdn.com/kf/S2d0d88e656384da894b7cfe9c59b0c0du.jpg");
request.addApiParameter("categoryType", "Beauty & Health");
IopResponse response = client.execute(request);
System.out.println(response.getBody());
Thread.sleep(10);

Response Parameters

ParameterTypeDescription

resCode

Number

The returned result code, where 200 indicates success. For detailed error codes, please refer to the error code list.

requestId

String

A unique request ID used for troubleshooting.

data

Object

The returned JSON result data.

modelNum

String

The unique ID code of the scene.

coverUrl

String

The cover image corresponding to the scene.

name

String

The name of the scene.

categoryNameList

list

Scene applicable category tags. A single scene may correspond to multiple category tags.

sceneNameList

list

Scene type tags. A single scene may correspond to multiple type tags.

success

Boolean

The status of the returned request, indicating whether the request was successful.

resMessage

String

The returned request information.

Sample Response

{
  "data": [],
  "success": true,
  "code": "0",
  "request_id": "2101725817192325338225104",
  "_trace_id_": "2140d3ff17192325338207538e8d37"
}

Errors

Error CodeError MessageDescription

500

system error

System error.

501

rate limit exceed

The current interface has reached the current limit. Please contact us via navigation bar or email us (aidge_support@service.alibaba.com) to increase the current limit value.

700

invalid input

The format of the input parameters does not meet the requirements, and resMessage will return detailed fields that do not meet the requirements.

801

model failed

Internal call exception, please contact us contact us via navigation bar or email us (aidge_support@service.alibaba.com) for troubleshooting.

1000

content has sensitive data, please try other input

Content has sensitive data and cannot be handled now. Please try other input.

1001

content control failed, please retry

Content risk failed, please try other input.

1002

content risk filter failed, please contact us

Content risk failed, please try other input. If an error persists,please contact us via navigation bar or email us (aidge_support@service.alibaba.com) for troubleshooting.

Last updated