- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- Try it!
Makes a recommendation prediction.
HTTP request
POST https://retail.googleapis.com/v2/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
placement |
Required. Full resource name of the format: The full list of available serving configs can be seen at https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{
"userEvent": {
object ( |
Fields | |
---|---|
user |
Required. Context about the user, what they are looking at and what action they took to trigger the predict request. Note that this user event detail won't be ingested to userEvent logs. Thus, a separate userEvent write request is required for event logging. Don't set |
page |
Maximum number of results to return. Set this property to the number of prediction results needed. If zero, the service will choose a reasonable default. The maximum allowed value is 100. Values above 100 will be coerced to 100. |
pageToken |
This field is not used; leave it unset. |
filter |
Filter for restricting prediction results with a length limit of 5,000 characters. Accepts values for tags and the
Note: "Recently viewed" models don't support tag filtering at the moment.
Examples:
If your filter blocks all prediction results, the API will return no results. If instead you want empty result sets to return generic (unfiltered) popular products, set If
For more information, see Filter recommendations. |
validate |
Use validate only mode for this prediction query. If set to true, a dummy model will be used that returns arbitrary products. Note that the validate only mode should only be used for testing the API, or if the model is not ready. |
params |
Additional domain specific parameters for the predictions. Allowed values:
|
labels |
The labels applied to a resource must meet the following requirements:
See Google Cloud Document for more details. |
Response body
If successful, the response body contains an instance of PredictResponse
.
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
IAM Permissions
Requires one of the following IAM permissions on the placement
resource, depending on the resource type:
retail.placements.predict
retail.servingConfigs.predict
For more information, see the IAM documentation.