Skip to content

Webhook Usage

Kyle Fu edited this page Sep 30, 2020 · 3 revisions

JudgeLite's webhook feature makes it easy to integrate JudgeLite with already existing systems, and it allows you much more flexibility when choosing how to use JudgeLite. Webhooks are also really simple to setup and use (this Wiki page explains how to do this).

What is a webhook?

A 'webhook' is really a fancy word for when an application sends an HTTP request to another server, to let that server know when the application does something. In JudgeLite's case, whenever the judge finishes processing a submission, it will send a POST request to the webhook URL that you specify (the request will contain the submission results). You can do whatever you'd like with that POST request (this could include updating a leaderboard, recording the submission results on your own system, or pretty much anything else).

JudgeLite Webhook Setup

Setting up JudgeLite's webhook is simple; just set the WEBHOOK_URL environment variable to the URL that you want JudgeLite to send the POST requests to (use the -e flag when running the Docker container).

The POST requests that JudgeLite sends will have the following fields:

  • secret_key - The secret key that is defined in the SECRET_KEY environment variable. This field can be used to verify that JudgeLite sent the POST request (and not a malicious user).
  • problem_id - The problem ID that the submission was for.
  • username - The username of the person who made this submission.
  • verdict - The verdict that the submission received. Will be one of "AC*" (accepted + got some bonus), "AC", "WA", "RE", "TLE", or "MLE".
  • score - The score that the submission received.
  • job_id - The job ID of the submission (can be used to get more detailed submission info, see the API Reference).
Clone this wiki locally