Skip to main content

applyRecommendations

This method applies recommendations by ID and returns success and failure details for each one requested.

Parameters

Name

Description

Included in request

Type

Values

recommendationIds

The IDs of the recommendations you want to apply.

Mandatory

Array of strings

Must be valid recommendation IDs and must belong to the same company.

These are common parameters, available across all public API methods.

Parameter

Description

Included in request

Type

Values

id

This parameter adds an identifier to the request, linking it to its corresponding response.

The target replies with the same value in the response, allowing easy call tracking.

Mandatory

String

No additional requirements

method

The name of the method you are using to send the request.

Mandatory

String

Must be a valid method name.

jsonrpc

The version of JSON-RPC used by the request and the response.

Mandatory

Integer

Possible values:

  • 2.0

params

An object containing the configuration of the request.

Mandatory

Object

No additional requirements.

Under the params object

page

The results page number.

Optional

Integer

Default value: 1

perPage

The number of results displayed per page.

Optional

Integer

The upper limit is 100 items per page.

Default value: 30

Return value

Attribute

Type

Description

appliedRecommendations

Array of strings

The ID of the recommendations that were successfully applies.

failedRecommendations

Array of objects

Each object contains information on a recommendation that failed to apply.

Objects

failedRecommendations

Attribute

Type

Description

recommendationId

String

The Id of the recommendation.

error

String

A description of the error that occurred when trying to apply the recommendation.

errorCode

Integer

The code of the error.

Example

Request:

{
  "params": {
    "recommendationIds": [
      "68480f4e11e8dc005bb0f9e7",
      "6853e32b4783f7a2f15582c4",
      "6853e32b4783f7a2f15582cf"
    ],
    "companyId": "67fe8595d4db0d536908ec92"
  },
  "jsonrpc": "2.0",
  "method": "applyRecommendations",
  "id": "b7e2c1d4-9f8a-4c2e-8b1a-ef1234567890"
}

Response:

{
  "id": "b7e2c1d4-9f8a-4c2e-8b1a-ef1234567890",
  "jsonrpc": "2.0",
  "result": {
    "appliedRecommendations": [],
    "failedRecommendations": [
      {
        "recommendationId": "68480f4e11e8dc005bb0f9e7",
        "error": "Recommendation already applied.",
        "errorCode": 3432
      },
      {
        "recommendationId": "6853e32b4783f7a2f15582c4",
        "error": "Recommendation already applied.",
        "errorCode": 3432
      },
      {
        "recommendationId": "6853e32b4783f7a2f15582cf",
        "error": "Recommendation not found.",
        "errorCode": 3432
      }
    ]
  }
}