api
Tebak Gambar

Documentation

Endpoint List

GET https://api.i-as.dev/api/tebakgambar

Response Format

The API returns a JSON array containing a list of images with their corresponding answers.

[
  {
    "id": "slug",
    "image": "url_img",
    "jawaban": "string"
  },
  // More data
]

Fields in Response:

  • id: A unique identifier for the image (slug).
  • image: The URL of the image for the guessing game.
  • jawaban: The correct answer for the image.

Endpoint Play

POST https://api.i-as.dev/api/tebakgambar/play/{id}

Body Request

The request body should contain a JSON object with the following structure:

{
  "jawaban_pemain": "string"
}
  • jawaban_pemain: The answer provided by the player.

Response Format

  • If Correct Answer:
{
  "id": "slug",
  "jawaban": "string",
  "jawaban_pemain": "string",
  "status": true,
  "pesan": "string"
}
  • If Wrong Answer:
{
  "id": "slug",
  "jawaban": "string",
  "jawaban_pemain": "string",
  "status": false,
  "pesan": "string"
}

Fields in Response:

  • id: A unique identifier for the image (slug).
  • jawaban: The correct answer for the image.
  • jawaban_pemain: The player's answer.
  • status: Indicates whether the player's answer was correct (true) or incorrect (false).
  • pesan: A message providing additional information about the answer's correctness.

Example Request (Correct Answer):

POST https://api.i-as.dev/api/tebakgambar/play/slug

Body:
{
  "jawaban_pemain": "correct answer"
}

Example Response (Correct Answer):

{
  "id": "slug",
  "jawaban": "cat",
  "jawaban_pemain": "cat",
  "status": true,
  "pesan": "Correct answer!"
}

Example Request (Incorrect Answer):

POST https://api.i-as.dev/api/tebakgambar/play/slug

Body:
{
  "jawaban_pemain": "wrong answer"
}

Example Response (Incorrect Answer):

{
  "id": "slug",
  "jawaban": "cat",
  "jawaban_pemain": "dog",
  "status": false,
  "pesan": "Incorrect answer, try again!"
}

This API allows users to guess answers for image-based puzzles. You can retrieve a list of puzzles, submit answers, and get feedback on whether the answer was correct or incorrect.