Download OpenAPI specification:Download
API for Source Code
+| email required | string <email> |
| password required | string <password> |
{- "email": "jy95@perdu.com",
- "password": "42"
}{- "token": "string",
- "user": {
- "fullName": "Alexandre Dewit",
- "role": "admin"
}
}| email required | string <email> |
| password required | string <password> |
| fullName required | string [ 1 .. 50 ] characters The full name of this new user + |
{- "email": "jy95@perdu.com",
- "password": "42",
- "fullName": "Alexandre Dewit"
}{- "message": "string",
- "errors": [
- { }
]
}| token required | string^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-... An JWT Token string + |
{- "token": "string"
}{- "message": "string",
- "errors": [
- { }
]
}| id required | integer The exercise ID + |
object (IncludeOptions) To include additional properties when fetching exercise + |
{- "title": "A Super Exercise",
- "description": "...",
- "id": 42,
- "version": 42,
- "createdAt": "2019-12-22T15:18:31.090Z",
- "updatedAt": "2019-12-22T15:19:33.473Z",
- "state": "PENDING",
- "file": "sources-88af5adc-1837-11ea-8d71-362b9e155667.zip",
- "metrics": {
- "votes": 42,
- "avg_score": 5
}, - "tags": [
- {
- "tag_id": 42,
- "tag_text": "easy",
- "category": {
- "category_text": "difficulty",
- "category_id": 42
}, - "state": "DEPRECATED"
}
], - "creator": {
- "email": "jy95@perdu.com",
- "fullName": "Alexandre Dewit"
}, - "vote": 5
}Array of objects <= 6 items If you wish to order the provided result, use this parameter. +For example, if you wish to first sort by date descending then by title ascending, you could achieve that with : + | |
object (SearchDataCriterias) Search criterias + | |
object (FilteringOptions) To filter some properties when fetching exercise(s) + | |
object (PaginationCriterias) Fields for pagination + | |
object (IncludeOptions) To include additional properties when fetching exercise(s) + |
Search the first 10 exercises that have 'Java' in their title and have some specific tags ( 1 AND (2 OR 3 OR 4) )
+{- "data": {
- "title": "Java",
- "tags": [
- 1,
- [
- 2,
- 3,
- 4
]
]
}
}{- "metadata": {
- "currentPage": 1,
- "totalItems": 42,
- "totalPages": 5,
- "pageSize": 10
}, - "data": [
- {
- "title": "A Super Exercise",
- "description": "...",
- "id": 42,
- "version": 42,
- "createdAt": "2019-12-22T15:18:31.090Z",
- "updatedAt": "2019-12-22T15:19:33.473Z",
- "state": "PENDING",
- "file": "sources-88af5adc-1837-11ea-8d71-362b9e155667.zip",
- "metrics": {
- "votes": 42,
- "avg_score": 5
}, - "tags": [
- {
- "tag_id": 42,
- "tag_text": "easy",
- "category": {
- "category_text": "difficulty",
- "category_id": 42
}, - "state": "DEPRECATED"
}
], - "creator": {
- "email": "jy95@perdu.com",
- "fullName": "Alexandre Dewit"
}
}
]
}| tags_ids | Array of integers non-empty Only consider the given tag ID(S) + |
| categories_ids | Array of integers non-empty Only consider the given tag categories ID(S) + |
| state | Array of strings (TagState) <= 4 items Items Enum: "NOT_VALIDATED" "VALIDATED" "DEPRECATED" "PENDING" Example: state=DEPRECATED Filter the tags by their state. By default, no filtering is done. + |
| title | string <= 100 characters Filter the tags by their text (case-insensitive comparison) + |
[- {
- "tag_id": 42,
- "tag_text": "easy",
- "category_id": 42,
- "state": "DEPRECATED",
- "version": 42
}
]| fetchStats | integer Enum: 0 1 If enabled, you can retrieve extra properties with the tag category + |
| category_ids | Array of integers Take only the given categories + |
[- {
- "id": 42,
- "category": "difficulty",
- "total": 0,
- "total_validated": 0,
- "total_unvalidated": 0,
- "total_deprecated": 0,
- "total_pending": 0
}
]| state | Array of strings (TagState) <= 4 items Items Enum: "NOT_VALIDATED" "VALIDATED" "DEPRECATED" "PENDING" Example: state=DEPRECATED Filter the tags by their state. By default, no filtering is done. + |
| onlySelected | Array of integers unique Default: [] Example: onlySelected=42 If not empty, only consider the given tag categories ID(S). If empty, no tag category is ignored + |
| countStates | Array of strings (State) <= 5 items Items Enum: "DRAFT" "PENDING" "VALIDATED" "NOT_VALIDATED" "ARCHIVED" Example: countStates=PENDING If not empty, only consider the given exercise state(s) to compute the field "total" inside each tag. |
[- {
- "id": 42,
- "category": "difficulty",
- "tags": [
- {
- "tag_id": 42,
- "tag_text": "easy",
- "category_id": 42,
- "state": "DEPRECATED",
- "version": 42,
- "total": 0
}
]
}
]{- "email": "jy95@perdu.com",
- "fullName": "Alexandre Dewit",
- "role": "user",
- "id": 42
}Any user can freely any information about (him/her)self (except the optional "id" / "role" fields ).
An super admin can freely update any user and it is the only one that can use the "id" / "role" fields.
| fullName | string [ 1 .. 50 ] characters The full name of the user + |
| password | string <password> |
| role | string (Roles) Default: "user" Enum: "super_admin" "admin" "user" The type of user. Currently, 3 types are possibles : +
|
| id | integer The UUID of this user. By default, it will take the one of logged user + |
{- "fullName": "Alexandre Dewit",
- "password": "42",
- "role": "user",
- "id": 42
}{- "message": "string",
- "errors": [
- { }
]
}Creates a new exercise into the system.
+By default (if nothing specified), the exercise will be in state "DRAFT".
You are free to add new tags / keywords but you must add at least 3 validated tags.
The following restrictions are applied on simple user(s) (no restriction for admin):
+| title required | string [ 3 .. 100 ] characters The title of this exercise + |
| description | string <= 5000 characters Default: "" The preamble of this exercise + |
required | Array of integers or TagProposalWithState (object) [ 3 .. 25 ] items unique Mixed array that contains existent tag(s) or not + |
| url | string Nullable ^https?:\/\/[^\s$.?#].[^\s]*$ If not null, the link to the exercise on a plateform + |
| state | string (State) Enum: "DRAFT" "PENDING" "VALIDATED" "NOT_VALIDATED" "ARCHIVED" Status of the exercise into the system. Currently, 5 states are possibles : +
|
{- "title": "A Super Exercise",
- "description": "...",
- "tags": [
- 0,
- 0,
- 0
], - "state": "PENDING"
}{- "message": "string",
- "errors": [
- { }
]
}| id required | integer The exercise ID + |
object (IncludeOptions) To include additional properties when fetching exercise + |
{- "title": "A Super Exercise",
- "description": "...",
- "id": 42,
- "version": 42,
- "createdAt": "2019-12-22T15:18:31.090Z",
- "updatedAt": "2019-12-22T15:19:33.473Z",
- "state": "PENDING",
- "file": "sources-88af5adc-1837-11ea-8d71-362b9e155667.zip",
- "metrics": {
- "votes": 42,
- "avg_score": 5
}, - "tags": [
- {
- "tag_id": 42,
- "tag_text": "easy",
- "category": {
- "category_text": "difficulty",
- "category_id": 42
}, - "state": "DEPRECATED"
}
], - "creator": {
- "email": "jy95@perdu.com",
- "fullName": "Alexandre Dewit"
}, - "vote": 5
}Update this specific exercise data
You are free to add new tags / keywords but you must add at least 3 validated tags.
+The following restrictions are applied on simple user(s) (no restriction for admin) :
| id required | integer The exercise ID + |
object (IncludeOptions) To include additional properties when fetching exercise + |
| title required | string [ 3 .. 100 ] characters The title of this exercise + |
| description | string <= 5000 characters Default: "" The preamble of this exercise + |
required | Array of integers or TagProposalWithState (object) [ 3 .. 25 ] items unique Mixed array that contains existent tag(s) or not + |
| url | string Nullable ^https?:\/\/[^\s$.?#].[^\s]*$ If not null, the link to the exercise on a plateform + |
| state | string (State) Enum: "DRAFT" "PENDING" "VALIDATED" "NOT_VALIDATED" "ARCHIVED" Status of the exercise into the system. Currently, 5 states are possibles : +
|
| version required | integer >= 0 The version of this exercise (optimistic lock) + |
| removePreviousFile | boolean Default: false If set to true, the API will delete the previous file when updating the exercise + |
{- "title": "A Super Exercise",
- "description": "...",
- "tags": [
- 0,
- 0,
- 0
], - "state": "PENDING",
- "version": 42,
- "removePreviousFile": true
}{- "message": "string",
- "errors": [
- { }
]
}| text required | string [ 1 .. 100 ] characters The text of this Tag + |
| category_id required | integer >= 0 the category id to which this tag is related + |
{- "text": "easy",
- "category_id": 42
}{- "message": "string",
- "errors": [
- { }
]
}Change the status of given exercises.
+The following restrictions are applied on simple user(s) (no restriction for admin):
+| exercises required | Array of integers non-empty unique An array of exercises IDs + |
| state required | string (State) Enum: "DRAFT" "PENDING" "VALIDATED" "NOT_VALIDATED" "ARCHIVED" Status of the exercise into the system. Currently, 5 states are possibles : +
|
{- "exercises": [
- 42
], - "state": "PENDING"
}{- "message": "string",
- "errors": [
- { }
]
}Creates multiple tags into the system.
+Warning : the "state" property can only be used by authorized people (no simple user can use it)
+| text required | string [ 1 .. 100 ] characters The text of this Tag + |
| category_id required | integer >= 0 the category id to which this tag is related + |
| state | string (TagState) Enum: "NOT_VALIDATED" "VALIDATED" "DEPRECATED" "PENDING" Status of the tag into the system. Currently, 4 states are possibles : +
|
[- {
- "text": "easy",
- "category_id": 42,
- "state": "DEPRECATED"
}
]{- "message": "string",
- "errors": [
- { }
]
}| exercise_id required | integer >= 0 The ID of the exercise we want to vote / modify a vote + |
| score required | number <double> >= 0 The score we want to give to this exercise + |
{- "exercise_id": 42,
- "score": 5
}{- "message": "string",
- "errors": [
- { }
]
}Get all configurations of the current logged user
+| ids | Array of integers Array of configuration ids you want to search + |
[- {
- "name": "All Java exercises",
- "title": "[LSINF1252]",
- "id": 42,
- "tags": [
- {
- "tag_id": 42,
- "tag_text": "easy",
- "category_id": 42,
- "state": "DEPRECATED",
- "version": 42
}
]
}
]Update a configuration
+| name required | string The name of this configuration + |
| title | string [ 0 .. 100 ] characters The used title for search + |
| tags | Array of integers An array of tags IDS + |
| id required | integer >= 0 The id of this configuration + |
{- "name": "All Java exercises",
- "title": "[LSINF1252]",
- "tags": [
- 42
], - "id": 42
}{- "message": "string",
- "errors": [
- { }
]
}Create a configuration
+| name required | string The name of this configuration + |
| title | string [ 0 .. 100 ] characters The used title for search + |
| tags | Array of integers An array of tags IDS + |
{- "name": "All Java exercises",
- "title": "[LSINF1252]",
- "tags": [
- 42
]
}{- "message": "string",
- "errors": [
- { }
]
}Delete a configuration
+| id | integer >= 0 The id of the configuration you want to delete + |
{- "id": 42
}{- "message": "string",
- "errors": [
- { }
]
}To export exercises that match optional criteria.
+The JSON result is compliant with the format +of our cli which means that if you wish to reupload the exercises in the future, +it's simple as you just have to rely on the cli command "uploader". +Please consider the following facts before using it :
+Don't forget to rename the key "categories" to "own_categories"
+If you wish to upload them without their files, remove the property "file" in each exercise :
+ let json_result = { /* ... */ };
+ const exercisesWithoutFile = json_result["exercises"].map(exercise => {
+ delete exercise["file"]
+ return exercise;
+ });
+ Object.assign(json_result, { "exercises": exercisesWithoutFile });
+If you wish to upload them with their files, download their files and modify each property "file" according our format +of our cli.
+Array of objects <= 6 items If you wish to order the provided result, use this parameter. +For example, if you wish to first sort by date descending then by title ascending, you could achieve that with : + | |
object (SearchDataCriterias) Search criterias + | |
object (FilteringOptions) To filter some properties when fetching exercise(s) + |
{- "orderBy": [
- {
- "field": "state",
- "value": "ASC"
}
], - "data": {
- "title": "SINF2MS",
- "tags": [
- -1,
- [
- 2,
- 3
]
], - "user_ids": [
- 0
], - "exercise_ids": [
- 0
], - "vote": {
- "operator": "<=",
- "value": 5
}
}, - "filterOptions": {
- "state": [
- "PENDING"
], - "tags": [
- "DEPRECATED"
]
}
}{- "exercises": [
- {
- "title": "A Super Exercise",
- "description": "...",
- "id": 42,
- "version": 42,
- "createdAt": "2019-12-22T15:18:31.090Z",
- "updatedAt": "2019-12-22T15:19:33.473Z",
- "state": "PENDING",
- "file": "sources-88af5adc-1837-11ea-8d71-362b9e155667.zip",
- "tags": [
- {
- "text": "INGINIOUS",
- "category": 42,
- "state": "DEPRECATED"
}
]
}
], - "categories": {
- "1": "source",
- "2": "institution",
- "3": "auteur"
}
}| tag_id required | integer >= 0 The Id of this Tag + |
| tag_text required | string [ 1 .. 100 ] characters The text of this Tag + |
| category_id required | integer >= 0 the category id to which it is related + |
| state required | string (TagState) Enum: "NOT_VALIDATED" "VALIDATED" "DEPRECATED" "PENDING" Status of the tag into the system. Currently, 4 states are possibles : +
|
| version required | integer >= 0 The version of this exercise (optimistic lock) + |
{- "tag_id": 42,
- "tag_text": "easy",
- "category_id": 42,
- "state": "DEPRECATED",
- "version": 42
}{- "message": "string",
- "errors": [
- { }
]
}| id required | integer >= 0 The Id of this Tag_Category + |
| category required | string [ 3 .. 100 ] characters The text of this Tag_Category + |
{- "id": 42,
- "category": "difficulty"
}{- "message": "string",
- "errors": [
- { }
]
}Creates multiple exercises into the system +By default (if nothing specified), an exercise will be in state "DRAFT".
+| title required | string [ 3 .. 100 ] characters The title of this exercise + |
| description | string <= 5000 characters Default: "" The preamble of this exercise + |
required | Array of integers or TagProposalWithState (object) [ 3 .. 25 ] items unique Mixed array that contains existent tag(s) or not + |
| url | string Nullable ^https?:\/\/[^\s$.?#].[^\s]*$ If not null, the link to the exercise on a plateform + |
| state | string (State) Enum: "DRAFT" "PENDING" "VALIDATED" "NOT_VALIDATED" "ARCHIVED" Status of the exercise into the system. Currently, 5 states are possibles : +
|
[- {
- "title": "A Super Exercise",
- "description": "...",
- "tags": [
- 0,
- 0,
- 0
], - "state": "PENDING"
}
]{- "message": "string",
- "errors": [
- { }
]
}The name of the Tag Category
+[- "author"
][- {
- "id": 42,
- "category": "difficulty"
}
]Change the status of given exercises.
+The following restrictions are applied on simple user(s) (no restriction for admin):
+| exercises required | Array of integers non-empty unique An array of exercises IDs + |
| state required | string (State) Enum: "DRAFT" "PENDING" "VALIDATED" "NOT_VALIDATED" "ARCHIVED" Status of the exercise into the system. Currently, 5 states are possibles : +
|
{- "exercises": [
- 42
], - "state": "PENDING"
}{- "message": "string",
- "errors": [
- { }
]
}object (PaginationCriterias) Fields for pagination + | |
| roles | Array of strings (Roles) <= 3 items unique Default: [] Items Enum: "super_admin" "admin" "user" If not empty, only consider the given user role(s). If empty, no user role is ignored + |
| fullName | string [ 1 .. 100 ] characters |
string <email> [ 1 .. 100 ] characters |
{- "metadata": {
- "currentPage": 1,
- "totalItems": 42,
- "totalPages": 5,
- "pageSize": 10
}, - "data": [
- {
- "email": "jy95@perdu.com",
- "fullName": "Alexandre Dewit",
- "role": "user",
- "id": 42
}
]
}Any user can freely any information about (him/her)self (except the optional "id" / "role" fields ).
An super admin can freely update any user and it is the only one that can use the "id" / "role" fields.
| fullName | string [ 1 .. 50 ] characters The full name of the user + |
| password | string <password> |
| role | string (Roles) Default: "user" Enum: "super_admin" "admin" "user" The type of user. Currently, 3 types are possibles : +
|
| id | integer The UUID of this user. By default, it will take the one of logged user + |
{- "fullName": "Alexandre Dewit",
- "password": "42",
- "role": "user",
- "id": 42
}{- "message": "string",
- "errors": [
- { }
]
}Permanently remove from system the given exercises. (No way to retrieve them after this)
Otherwise, if you simply want to soft delete/hide these exercises, use this endpoint to change their status to ARCHIVED.
An exercise ID
+[- 42
]{- "message": "string",
- "errors": [
- { }
]
}Delete given tags categories.
+A tag category ID
+[- 42
]{- "message": "string",
- "errors": [
- { }
]
}