Webhooks
Submissions

A webhook message is an HTTP POST request sent from Sphere Engine to the client's webhook endpoint. Enclosed within the request body is valid JSON data structured uniformly across all Sphere Engine components.

Webhook message specification

Message core

Name Type Description
origin string

The identifier of the system that can take the following values:

  • sec - Compilers API
  • sep - Problems API
  • secw - Compilers Widget
  • sepw - Problems Wiget
timestamp integer The Unix timestamp generated when the message is created
submission object Information about the submission
widget (present only for origin values: secw, sepw) object Additional context related to execution within a widget

The structure of the submission object (see Message core above) for Compilers API (origin=sec) and Compilers Widget (origin=secw)

Name Type Description
id integer submission id
executing boolean indicates whether a submission is being executed
date string date and time of submission creation [yyyy-mm-­dd hh:mm:ss TZD] note that server time is used
compiler object
compiler.id integer compiler id
compiler.name string compiler name
compiler.version.id integer compiler version id
compiler.version.name string compiler version name
result object
result.status.code integer status code (see section "Submission status")
result.status.name string status name
result.time float execution time [seconds]
result.memory integer memory consumed by the program [kilobytes]
result.signal.code integer signal raised by the program
result.signal.name string description of the raised signal

The structure of the widget object (see Message core above) for Compilers Widget (origin=secw)

Name Type Description
hash string widget identifier
submission.id integer submission id in the widget context; note that it's not the same id as for submission object
custom_data string custom data provided during widget initialization in data-custom-data parameter

The structure of the submission object (see Message core above) for Problems API (origin=sep) and Problems Widget (origin=sepw)

Name Type Description
id integer submission id
executing boolean indicates whether a submission is being executed
date string date and time of submission creation [yyyy-mm-­dd hh:mm:ss TZD] note that server time is used
compiler object
compiler.id integer compiler id
compiler.name string compiler name
compiler.version.id integer compiler version id
compiler.version.name string compiler version name
problem object
problem.id integer problem id
problem.code string [deprecated] problem code
problem.name string problem name
result object
result.status.code integer status code (see section "Submission status")
result.status.name string status name
result.score float final score
result.time float execution time [seconds]
result.memory integer memory consumed by the program [kilobytes]
result.signal.code integer signal raised by the program
result.signal.name string description of the raised signal
result.testcases[].number integer test case number
result.testcases[].status.code integer test case status code (see section "Submission status")
result.testcases[].status.name string test case status name
result.testcases[].score float test case score
result.testcases[].time float test case execution time [seconds]
result.testcases[].memory integer test case memory consumed by the program [kilobytes]
result.testcases[].signal integer test case signal raised by the program
result.testcases[].signal_desc string description of the raised test case signal

The structure of the widget object (see Message core above) for Problems Widget (origin=sepw)

Name Type Description
hash string widget identifier
submission.id integer submission id in the widget context
submission.grade float submission grade
custom_data string custom data provided during widget initialization in data-custom-data parameter
user object
user.name string user name provided on the welcome page
user.email string user email address provided on the welcome page
user.uuid string user identifier generated by the Sphere Engine system
user.id string user identifier provided during widget initialization (user-id parameter)

Examples

{
  "origin": "sec",
  "timestamp": 1610636162,
  "submission": {
    "id": 167124381,
    "executing": false,
    "date": "2021-01-14 14:55:56 +00:00",
    "compiler": {
      "id": 29,
      "name": "PHP",
      "version": {
        "id": 5,
        "name": "php 7.4.3"
      }
    },
    "result": {
      "status": {
        "code": 15,
        "name": "accepted"
      },
      "time": 0.01,
      "memory": 51824,
      "signal": {
        "code": 0,
        "name": ""
      }
    }
  }
}
Compilers API
{
  "origin": "sep",
  "timestamp": 1610636162,
  "submission": {
    "id": 15778763,
    "executing": false,
    "date": "2021-01-14 14:55:56 +00:00",
    "compiler": {
      "id": 29,
      "name": "PHP",
      "version": {
        "id": 5,
        "name": "php 7.4.3"
      }
    },
    "problem": {
      "id": 170,
      "code": "SETEST",
      "name": "Life, the Universe, and Everything"
    },
    "result": {
      "status": {
        "code": 15,
        "name": "accepted"
      },
      "score": 100,
      "time": 0.01,
      "memory": 52488,
      "signal": 0,
      "signal_desc": "",
      "testcases": [
        {
          "number": 0,
          "status": {
            "code": 15,
            "name": "accepted"
          },
          "score": 0,
          "time": 0.01,
          "memory": 52488,
          "signal": 0,
          "signal_desc": ""
        }
      ]
    }
  }
}
Problems API
{
  "origin": "secw",
  "timestamp": 1610636162,
  "submission": {
    "id": 167137007,
    "executing": false,
    "date": "2021-01-14 14:55:56 +00:00",
    "compiler": {
      "id": 29,
      "name": "PHP",
      "version": {
        "id": 5,
        "name": "php 7.4.3"
      }
    },
    "result": {
      "status": {
        "code": 15,
        "name": "accepted"
      },
      "time": 0.01,
      "memory": 82560,
      "signal": {
        "code": 0,
        "name": ""
      }
    }
  },
  "widget": {
    "hash": "a532aa0f61da800f8288c77588a29cd5",
    "submission": {
      "id": 1151666
    },
    "custom_data": null
  }
}
Compilers Widget
{
  "origin": "sepw",
  "timestamp": 1610636162,
  "submission": {
    "id": 15780466,
    "executing": false,
    "date": "2021-01-14 14:55:56 +00:00",
    "compiler": {
      "id": 29,
      "name": "PHP",
      "version": {
        "id": 5,
        "name": "php 7.4.3"
      }
    },
    "problem": {
      "id": 170,
      "code": "SETEST",
      "name": "Life, the Universe, and Everything"
    },
    "result": {
      "status": {
        "code": 15,
        "name": "accepted"
      },
      "score": 100,
      "time": 0.01,
      "memory": 52488,
      "signal": 0,
      "signal_desc": "",
      "testcases": [
        {
          "number": 0,
          "status": {
            "code": 15,
            "name": "accepted"
          },
          "score": 0,
          "time": 0.01,
          "memory": 52488,
          "signal": 0,
          "signal_desc": ""
        }
      ]
    }
  },
  "widget": {
    "hash": null,
    "submission": {
      "id": 4458436,
      "grade": 0
    },
    "user": {
      "name": null,
      "email": null,
      "uuid": null,
      "id": null
    },
    "custom_data": null
  }
}
Problems Wiget