- HTTP request
- Path parameters
- Request body
- Response body
- Authorization Scopes
- IAM Permissions
- PredictionResult
Makes a recommendation prediction.
HTTP request
POST https://retail.googleapis.com/v2beta/{placement=projects/*/locations/*/catalogs/*/placements/*}:predict
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
placement |
Required. Full resource name of the format: {name=projects/*/locations/global/catalogs/default_catalog/placements/*} The id of the recommendation engine placement. This id is used to identify the set of models that will be used to make the prediction. We currently support three placements with the following IDs by default:
The full list of available placements can be seen at https://console.cloud.google.com/recommendation/catalogs/default_catalog/placements |
Request body
The request body contains data with the following structure:
JSON representation | |
---|---|
{
"userEvent": {
object ( |
Fields | |
---|---|
userEvent |
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. |
pageSize |
Maximum number of results to return per page. 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 |
The previous PredictResponse.next_page_token. |
filter |
Filter for restricting prediction results with a length limit of 5,000 characters. Accepts values for tags and the
Examples:
If your filter blocks all prediction results, nothing will be returned. If you want generic (unfiltered) popular products to be returned instead, set |
validateOnly |
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 for the predict request.
See https://goo.gl/xmQnxf for more information on and examples of labels. |
Response body
If successful, the response body contains data with the following structure:
Response message for predict method.
JSON representation | |
---|---|
{
"results": [
{
object ( |
Fields | |
---|---|
results[] |
A list of recommended products. The order represents the ranking (from the most relevant product to the least). |
attributionToken |
A unique attribution token. This should be included in the |
missingIds[] |
IDs of products in the request that were missing from the inventory. |
validateOnly |
True if the validateOnly property was set in the request. |
Authorization Scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the placement
resource:
retail.placements.predict
For more information, see the IAM documentation.
PredictionResult
PredictionResult represents the recommendation prediction results.
JSON representation | |
---|---|
{ "id": string, "metadata": { string: value, ... } } |
Fields | |
---|---|
id |
ID of the recommended product |
metadata |
Additional product metadata / annotations. Possible values:
|