Skip to main content
POST
/
api
/
game
/
validate
Validate Answer
curl --request POST \
  --url https://api.example.com/api/game/validate \
  --header 'Content-Type: application/json' \
  --data '
{
  "targetItemId": "<string>",
  "selectedComponentIds": [
    "<string>"
  ]
}
'
{
  "correct": true,
  "correctComponentIds": [
    "<string>"
  ],
  "correctComponentNames": [
    "<string>"
  ],
  "correctComponents": [
    {
      "itemId": "<string>",
      "name": "<string>",
      "imageUrl": "<string>",
      "cost": 123
    }
  ],
  "incorrectComponentIds": [
    "<string>"
  ],
  "message": "<string>",
  "scorePoints": 123
}

Request Body

targetItemId
string
required
The unique identifier of the target item the player is trying to craft. Cannot be null.
selectedComponentIds
List<String>
required
List of item IDs that the player selected as components. Cannot be empty.

Response

correct
boolean
required
Whether the player’s answer is correct or not
correctComponentIds
List<String>
required
List of item IDs that are the correct components for crafting the target item
correctComponentNames
List<String>
required
List of display names of the correct components
correctComponents
List<ItemOption>
required
List of ItemOption objects with full details of the correct components
incorrectComponentIds
List<String>
required
List of item IDs that the player selected incorrectly (empty if answer is correct)
message
string
required
Feedback message describing the result (e.g., “Correct!”, “Incorrect. Try again!”)
scorePoints
integer
required
Points awarded for this answer (typically positive if correct, 0 if incorrect)

Example Request

curl -X POST "https://api.crafterlol.com/api/game/validate" \
  -H "Content-Type: application/json" \
  -d '{
    "targetItemId": "3078",
    "selectedComponentIds": ["3044", "3051", "3057"]
  }'

Example Response (Correct Answer)

{
  "correct": true,
  "correctComponentIds": ["3044", "3051", "3057"],
  "correctComponentNames": ["Phage", "Hearthbound Axe", "Sheen"],
  "correctComponents": [
    {
      "itemId": "3044",
      "name": "Phage",
      "imageUrl": "https://ddragon.leagueoflegends.com/cdn/16.3.1/img/item/3044.png",
      "cost": 1100
    },
    {
      "itemId": "3051",
      "name": "Hearthbound Axe",
      "imageUrl": "https://ddragon.leagueoflegends.com/cdn/16.3.1/img/item/3051.png",
      "cost": 1100
    },
    {
      "itemId": "3057",
      "name": "Sheen",
      "imageUrl": "https://ddragon.leagueoflegends.com/cdn/16.3.1/img/item/3057.png",
      "cost": 700
    }
  ],
  "incorrectComponentIds": [],
  "message": "Correct! You've successfully crafted Trinity Force.",
  "scorePoints": 100
}

Example Response (Incorrect Answer)

{
  "correct": false,
  "correctComponentIds": ["3044", "3051", "3057"],
  "correctComponentNames": ["Phage", "Hearthbound Axe", "Sheen"],
  "correctComponents": [
    {
      "itemId": "3044",
      "name": "Phage",
      "imageUrl": "https://ddragon.leagueoflegends.com/cdn/16.3.1/img/item/3044.png",
      "cost": 1100
    },
    {
      "itemId": "3051",
      "name": "Hearthbound Axe",
      "imageUrl": "https://ddragon.leagueoflegends.com/cdn/16.3.1/img/item/3051.png",
      "cost": 1100
    },
    {
      "itemId": "3057",
      "name": "Sheen",
      "imageUrl": "https://ddragon.leagueoflegends.com/cdn/16.3.1/img/item/3057.png",
      "cost": 700
    }
  ],
  "incorrectComponentIds": ["1001", "1036"],
  "message": "Incorrect. The correct components are: Phage, Hearthbound Axe, Sheen.",
  "scorePoints": 0
}

Validation Rules

  • The targetItemId field is required and cannot be null
  • The selectedComponentIds field is required and cannot be empty
  • The answer is considered correct only if the selected components exactly match the correct components for the target item

Build docs developers (and LLMs) love