Personalize API Premium plan

Personalize API enables you to get personalized recommendations for app users.

Request format

Use GET request in the following format:

https://mlapi.tracker.my.com/v1/recommendation/method_name
  • v1 — Personalize API version;
  • method_name — name of method: item, set.

You can send a request using Swagger UI

Methods

item

Use the item method to get recommendations for an offer, including a single item.

End-point: https://mlapi.tracker.my.com/v1/recommendation/item

Parameters:

Name Description Type Example
sdk_key* App key, embedded in SDK, is issued after adding the application String 00001234567890123456
custom_user_id* User identifier sent via SDK. It defines individual user. String 1234
flat A flag changing the answer format. Possible values:
0 — the data field is a dictionary
1 — the data field is an array

Default value: 0
Boolean 0
reset A sign of resetting recommendations on subsequent requests. Possible values:
0 — do not reset
1 — reset

Default value: 1
Boolean 1
placement_ids Offer placement identifiers. If the parameter is not specified, the recommendation will be generated for all offer placement String array A, B, C

* — required parameter.

Examples of queries

Example query:

curl --location --request GET 'https://mlapi.tracker.my.com/api/v1/recommendation/item?sdk_key=00001234567890123456&custom_user_id=1234&placement_ids=A&placement_ids=B&placement_ids=C'

Response format:

{
  "data": {
    "A":{
      "test_id": 0,
      "group_id": 0,
      "placement_id": "string",
      "offer": {
        "offer_id": "string",
        "subitems": [
          {
            "sku": "string",
            "payload": "string",
            "price": 0,
            "value": 0,
            "discount_price": 0,
            "discount_value": 0
          }
        ]
      },
    },
    "B":{}
    "C":{}
  }
}

The response includes the following data:

  • test_id: A/B test identifier
  • group_id: group identifier to which the user belongs: group for recommendations or control group
  • placement_id: offer placement identifier
  • offer_id: offer identifier
  • price: default price of the offer (not required to use)
  • value: default value of the offer (not required to use)
  • discount_price: recommended offer price
  • discount_value: recommended offer value

Example query with flat=1:

curl --location --request GET 'https://mlapi.tracker.my.com/api/v1/recommendation/set?sdk_key=00001234567890123456&custom_user_id=1234&placement_ids=A&placement_ids=B&placement_ids=C&flat=1'

Response format with flat=1:

{
  "data": [
    {
      "test_id": 0,
      "group_id": 0,
      "placement_id": "string",
      "offer": {
        "offer_id": "string",
        "subitems": [
          {
            "sku": "string",
            "payload": "string",
            "price": 0,
            "value": 0,
            "discount_price": 0,
            "discount_value": 0
          }
        ]
      },
    },
    {}
    {}
  ]
}

The response includes the following data:

  • test_id: A/B test identifier
  • group_id: group identifier to which the user belongs: group for recommendations or control group
  • placement_id: offer placement identifier
  • offer_id: identifier of the offer, including several items
  • sku: name of the bundle in the store (it may not be unique for the store item)
  • payload: a unique item name within the application
  • price: default price of the offer (not required to use)
  • value: default value of the offer (not required to use)
  • discount_price: recommended offer price
  • discount_value: recommended offer value

set

Use the set method to get recommendations for an offer, including a set of items.

End-point: https://mlapi.tracker.my.com/v1/recommendation/set

Parameters:

Name Description Type Example
sdk_key* App key, embedded in SDK, is issued after adding the application String 00001234567890123456
custom_user_id* User identifier sent via SDK. It defines individual user. String 1234
flat A flag changing the answer format. Possible values:
0 — the data field is a dictionary
1 — the data field is an array

Default value: 0
Boolean 0
reset A sign of resetting recommendations on subsequent requests. Possible values:
0 — do not reset
1 — reset

Default value: 1
Boolean 1
placement_ids Offer placement identifiers. If the parameter is not specified, the recommendation will be generated for all offer placement String array A, B, C

* — required parameter.

Examples of queries

Example query:

curl --location --request GET 'https://mlapi.tracker.my.com/api/v1/recommendation/set?sdk_key=00001234567890123456&custom_user_id=1234&placement_ids=A&placement_ids=B&placement_ids=C'

Response format:

{
  "data": {
    "A":{
      "test_id": 0,
      "group_id": 0,
      "placement_id": "string",
      "offer": {
        "offer_id": "string",
        "subitems": [
          {
            "sku": "string",
            "payload": "string",
            "price": 0,
            "value": 0,
            "discount_price": 0,
            "discount_value": 0
          }
        ]
      },
    },
    "B":{}
    "C":{}
  }
}

Example query with flat=1:

curl --location --request GET 'https://mlapi.tracker.my.com/api/v1/recommendation/set?sdk_key=00001234567890123456&custom_user_id=1234&placement_ids=A&placement_ids=B&placement_ids=C&flat=1'

Response format with flat=1:

{
  "data": [
    {
      "test_id": 0,
      "group_id": 0,
      "placement_id": "string",
      "offer": {
        "offer_id": "string",
        "subitems": [
          {
            "sku": "string",
            "payload": "string",
            "price": 0,
            "value": 0,
            "discount_price": 0,
            "discount_value": 0
          }
        ]
      },
    },
    {}
    {}
  ]
}

Both responses include the following data:

  • test_id: A/B test identifier
  • group_id: group identifier to which the user belongs: group for recommendations or control group
  • placement_id: offer placement identifier
  • offer_id: identifier of the offer, including several items
  • sku: name of the bundle in the store (it may not be unique for the store item)
  • payload: a unique item name within the application
  • price: default price of the offer (not required to use)
  • value: default value of the offer (not required to use)
  • discount_price: recommended offer price
  • discount_value: recommended offer value

Status codes

Code Description
200 The request was successfully processed
400 Request error, parameters not validated
Was this article helpful?