Skip to main content
GET
/
v1
/
homeworks
Get Homework Assignments
curl --request GET \
  --url https://api.example.com/v1/homeworks \
  --header 'x-tenant-api-secret: <x-tenant-api-secret>'
{
  "data": [
    {
      "id": "3fe84441-06c8-4e3a-95dc-fb009e4aaac6",
      "tenantId": "fe3a8563-435f-4535-95b5-7dc723536d46",
      "teacherId": "f9809200-e31f-4225-b9f3-73e7fb406d9a",
      "assignmentId": "3",
      "courseId": "fa8c410e-65ce-4f89-90da-e752747a8609",
      "createdAt": "2025-05-07T18:33:16.098Z",
      "updatedAt": "2025-05-07T18:33:16.098Z",
      "files": [
        {
          "id": "bc84333d-2c5d-48aa-9391-48dca92c436d",
          "homeworkId": "3fe84441-06c8-4e3a-95dc-fb009e4aaac6",
          "fileType": "restriction",
          "fileName": "restrictions_01(1).md",
          "filePath": "fe3a8563-435f-4535-95b5-7dc723536d46/3fe84441-06c8-4e3a-95dc-fb009e4aaac6/restrictions_01(1).md",
          "content": "1. Задание должно быть решено при помощи итератора.",
          "createdAt": "2025-05-07T18:33:16.106Z",
          "updatedAt": "2025-05-07T18:33:16.106Z"
        },
        {
          "id": "ea06e25e-7a75-4ef2-8caf-4a5733ccdba5",
          "homeworkId": "3fe84441-06c8-4e3a-95dc-fb009e4aaac6",
          "fileType": "solution",
          "fileName": "Task1.java",
          "filePath": "fe3a8563-435f-4535-95b5-7dc723536d46/3fe84441-06c8-4e3a-95dc-fb009e4aaac6/Task1.java",
          "content": "import java.util.ArrayList;\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\n\r\npublic class Task1 {\r\n\r\n    public static void main(String[] args) {\r\n\r\n        List<Integer> numbers = new ArrayList<>(List.of(4, 8, 7, 10, 2, 9, 11, 5, 8, 0, 5));\r\n\r\n        System.out.println(\"Исходный список:\");\r\n        System.out.println(numbers);\r\n\r\n        Iterator<Integer> iterator = numbers.iterator();\r\n        while (iterator.hasNext()) {\r\n            if (iterator.next() % 5 == 0) {\r\n                iterator.remove();\r\n            }\r\n        }\r\n\r\n        System.out.println(\"Список после удаления:\");\r\n        System.out.println(numbers);\r\n    }\r\n}\r\n",
          "createdAt": "2025-05-07T18:33:16.106Z",
          "updatedAt": "2025-05-07T18:33:16.106Z"
        },
        {
          "id": "d046aef0-5811-4b17-852c-8d32a40a0d4e",
          "homeworkId": "3fe84441-06c8-4e3a-95dc-fb009e4aaac6",
          "fileType": "task",
          "fileName": "homework.md",
          "filePath": "fe3a8563-435f-4535-95b5-7dc723536d46/3fe84441-06c8-4e3a-95dc-fb009e4aaac6/homework.md",
          "content": "1. Задача 1:\r\n   - Создайте список чисел - 4, 8, 7, 10, 2, 9, 11, 5, 8, 0, 5. Выведите его в консоль.\r\n   - Удалите из списка все числа, которые делятся нацело на 5. Снова выведите список в консоль.\r\n2. Задача 2:\r\n   - Создайте список чисел - 4, 8, 7, 10, 2, 9, 11, 5, 8, 0, 5. Выведите его в консоль.\r\n   - Двигаясь по списку, найдите число, которое больше 10.\r\n   - Удалите из списка все чётные числа перед этим числом. Снова выведите список в консоль.",
          "createdAt": "2025-05-07T18:33:16.106Z",
          "updatedAt": "2025-05-07T18:33:16.106Z"
        }
      ],
      "course": {
        "id": "fa8c410e-65ce-4f89-90da-e752747a8609",
        "tenantId": "fe3a8563-435f-4535-95b5-7dc723536d46",
        "teacherId": "f9809200-e31f-4225-b9f3-73e7fb406d9a",
        "name": "Java",
        "createdAt": "2025-05-07T18:33:12.682Z",
        "updatedAt": "2025-05-07T18:33:12.682Z"
      }
    }
  ],
  "nextPage": false,
  "prevPage": false,
  "total": 4
}

Overview

This endpoint retrieves a paginated list of homework assignments. It supports filtering by teacher, course, and search terms.

Authentication

x-tenant-api-secret
string
required
Authentication header with your tenant’s API key

Query Parameters

limit
integer
default:"10"
The maximum number of assignments to return per page
offset
integer
default:"0"
The number of items to skip before starting to collect results
teacherId
string
Filter assignments by teacher UUID
courseId
string | string[]
Filter assignments by course ID(s)
Search term to filter assignments

Response

prevPage
boolean
Indicates if there’s a previous page of results
nextPage
boolean
Indicates if there’s a next page of results
data
array
Array of homework assignment objects
total
integer
Total number of assignments matching the query

Homework Assignment Object

id
string
Unique identifier for the homework assignment
tenantId
string
Tenant identifier
teacherId
string
ID of the teacher who created the assignment
assignmentId
string
Unique assignment identifier
subject
string
The subject of the homework assignment (if available)
courseId
string
ID of the course this homework belongs to
createdAt
string
Timestamp when the assignment was created
updatedAt
string
Timestamp when the assignment was last updated
files
array
Array of files associated with the homework assignment
course
object
Course information related to this homework

File Object

id
string
Unique identifier for the file
homeworkId
string
ID of the homework this file belongs to
fileType
string
Type of the file (e.g., “task”, “solution”, “restriction”)
fileName
string
Name of the file
filePath
string
Path to the file in storage
content
string
Content of the file
createdAt
string
Timestamp when the file was created
updatedAt
string
Timestamp when the file was last updated

Course Object

id
string
Unique identifier for the course
tenantId
string
Tenant identifier
teacherId
string
ID of the teacher who created the course
name
string
Name of the course
createdAt
string
Timestamp when the course was created
updatedAt
string
Timestamp when the course was last updated
{
  "data": [
    {
      "id": "3fe84441-06c8-4e3a-95dc-fb009e4aaac6",
      "tenantId": "fe3a8563-435f-4535-95b5-7dc723536d46",
      "teacherId": "f9809200-e31f-4225-b9f3-73e7fb406d9a",
      "assignmentId": "3",
      "courseId": "fa8c410e-65ce-4f89-90da-e752747a8609",
      "createdAt": "2025-05-07T18:33:16.098Z",
      "updatedAt": "2025-05-07T18:33:16.098Z",
      "files": [
        {
          "id": "bc84333d-2c5d-48aa-9391-48dca92c436d",
          "homeworkId": "3fe84441-06c8-4e3a-95dc-fb009e4aaac6",
          "fileType": "restriction",
          "fileName": "restrictions_01(1).md",
          "filePath": "fe3a8563-435f-4535-95b5-7dc723536d46/3fe84441-06c8-4e3a-95dc-fb009e4aaac6/restrictions_01(1).md",
          "content": "1. Задание должно быть решено при помощи итератора.",
          "createdAt": "2025-05-07T18:33:16.106Z",
          "updatedAt": "2025-05-07T18:33:16.106Z"
        },
        {
          "id": "ea06e25e-7a75-4ef2-8caf-4a5733ccdba5",
          "homeworkId": "3fe84441-06c8-4e3a-95dc-fb009e4aaac6",
          "fileType": "solution",
          "fileName": "Task1.java",
          "filePath": "fe3a8563-435f-4535-95b5-7dc723536d46/3fe84441-06c8-4e3a-95dc-fb009e4aaac6/Task1.java",
          "content": "import java.util.ArrayList;\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\n\r\npublic class Task1 {\r\n\r\n    public static void main(String[] args) {\r\n\r\n        List<Integer> numbers = new ArrayList<>(List.of(4, 8, 7, 10, 2, 9, 11, 5, 8, 0, 5));\r\n\r\n        System.out.println(\"Исходный список:\");\r\n        System.out.println(numbers);\r\n\r\n        Iterator<Integer> iterator = numbers.iterator();\r\n        while (iterator.hasNext()) {\r\n            if (iterator.next() % 5 == 0) {\r\n                iterator.remove();\r\n            }\r\n        }\r\n\r\n        System.out.println(\"Список после удаления:\");\r\n        System.out.println(numbers);\r\n    }\r\n}\r\n",
          "createdAt": "2025-05-07T18:33:16.106Z",
          "updatedAt": "2025-05-07T18:33:16.106Z"
        },
        {
          "id": "d046aef0-5811-4b17-852c-8d32a40a0d4e",
          "homeworkId": "3fe84441-06c8-4e3a-95dc-fb009e4aaac6",
          "fileType": "task",
          "fileName": "homework.md",
          "filePath": "fe3a8563-435f-4535-95b5-7dc723536d46/3fe84441-06c8-4e3a-95dc-fb009e4aaac6/homework.md",
          "content": "1. Задача 1:\r\n   - Создайте список чисел - 4, 8, 7, 10, 2, 9, 11, 5, 8, 0, 5. Выведите его в консоль.\r\n   - Удалите из списка все числа, которые делятся нацело на 5. Снова выведите список в консоль.\r\n2. Задача 2:\r\n   - Создайте список чисел - 4, 8, 7, 10, 2, 9, 11, 5, 8, 0, 5. Выведите его в консоль.\r\n   - Двигаясь по списку, найдите число, которое больше 10.\r\n   - Удалите из списка все чётные числа перед этим числом. Снова выведите список в консоль.",
          "createdAt": "2025-05-07T18:33:16.106Z",
          "updatedAt": "2025-05-07T18:33:16.106Z"
        }
      ],
      "course": {
        "id": "fa8c410e-65ce-4f89-90da-e752747a8609",
        "tenantId": "fe3a8563-435f-4535-95b5-7dc723536d46",
        "teacherId": "f9809200-e31f-4225-b9f3-73e7fb406d9a",
        "name": "Java",
        "createdAt": "2025-05-07T18:33:12.682Z",
        "updatedAt": "2025-05-07T18:33:12.682Z"
      }
    }
  ],
  "nextPage": false,
  "prevPage": false,
  "total": 4
}

Error Responses

Invalid query parameters
Invalid or missing API key
Server error processing the request

Example Usage

cURL

curl -X GET "https://api.lexiconlabs.ai/v1/homeworks?limit=10&offset=0&courseId=course-101" \
  -H "x-tenant-api-secret: YOUR_API_KEY"

JavaScript

fetch('https://api.lexiconlabs.ai/v1/homeworks?limit=10&offset=0&courseId=course-101', {
  method: 'GET',
  headers: {
    'x-tenant-api-secret': 'YOUR_API_KEY'
  }
})
.then(response => response.json())
.then(data => {
  console.log(data);
})
.catch(error => console.error('Error:', error));