PolyCode API (1.0)

Download OpenAPI specification:Download

Do awesome stuff with PolyCode API

Application

Get the health of the application

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

User

Find all users

Authorizations:
bearer
query Parameters
page
number

Page number for pagination

limit
number

Number of item per page for pagination

order-by
string
Example: order-by=points:null,username:null

Available keys: points, username

username
any

Filter results by username (matching)

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "data": [
    ]
}

Find a user by id

Authorizations:
bearer
path Parameters
userId
required
any <uuid>

The uuid of the user

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Update a user

Authorizations:
bearer
path Parameters
userId
required
any <uuid>

The uuid of the user

Request Body schema: application/json
username
string

The username of the user. Must be unique. Must be at least 3 characters long.

description
string

The description of the user.

Responses

Request samples

Content type
application/json
{
  • "username": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Get user's teams

Returns the user's teams

Authorizations:
bearer
path Parameters
userId
required
any <uuid>

The uuid of the user

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "data": [
    ]
}

Get all emails for a user

Authorizations:
bearer
path Parameters
userId
required
any <uuid>

The uuid of the user

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "data": [
    ]
}

Create a new email

Authorizations:
bearer
path Parameters
userId
required
any <uuid>

The uuid of the user

Request Body schema: application/json
email
required
string <email>

The email of the user. Must be unique. Must be a valid email address.

Responses

Request samples

Content type
application/json
{
  • "email": "user@example.com"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Delete an email

Authorizations:
bearer
path Parameters
emailId
required
string <uuid>

The uuid of the email

userId
required
any <uuid>

The uuid of the user

Responses

Validate an email

path Parameters
verificationToken
required
string <uuid>

Token used to verify email.

Responses

Regenerate a verification token for an email and resend an email

path Parameters
emailId
required
string <uuid>

The uuid of the email

Responses

Get settings for an user

Authorizations:
bearer
path Parameters
userId
required
any <uuid>

The uuid of the user

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Update settings for a user

Authorizations:
bearer
path Parameters
userId
required
any <uuid>

The uuid of the user

Request Body schema: application/json
preferredEditingLanguage
string
Default: "javascript"

The programming language that should be used by default for this user.

preferredLanguage
string
Default: "en"
Enum: "en" "fr"

The human language that should be used by default for this user.

Responses

Request samples

Content type
application/json
{
  • "preferredEditingLanguage": "python",
  • "preferredLanguage": "fr"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Reset user settings

Authorizations:
bearer
path Parameters
userId
required
any <uuid>

The uuid of the user

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Item

Get all items

Authorizations:
bearer
query Parameters
page
number

Page number for pagination

limit
number

Number of item per page for pagination

order-by
string
Example: order-by=cost:null

Available keys: cost

type
string
Enum: "hint" "validator"

Filter results by type

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "data": [
    ]
}

Get an item by id

Authorizations:
bearer
path Parameters
id
required
string <uuid>

The id of the item

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Buy an item

Buy an item, decrement the user's points by the item's cost & returns the item. It wont decrement points if already bought

Authorizations:
bearer
path Parameters
id
required
string <uuid>

The id of the item

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Returns an item

Returns the item with data if the item was bought, without data otherwise

Authorizations:
bearer
path Parameters
id
required
string <uuid>

The id of the item

Responses

Transactions

Get all transactions

Authorizations:
bearer
query Parameters
page
number

Page number for pagination

limit
number

Number of item per page for pagination

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "data": [
    ]
}

Module

Find all modules

Authorizations:
bearer
query Parameters
page
number

Page number for pagination

limit
number

Number of item per page for pagination

order-by
string
Example: order-by=name:null,reward:null

Available keys: name, reward

name
any

Filter results by name (matching)

authorId
any

Filter results by authorId

type
any

Filter results by type (matching)

tags
any

Filter results by tags. Must be enclosed in square brackets, and be separated by commas

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "data": [
    ]
}

Find a module by id

Authorizations:
bearer
path Parameters
moduleId
required
string <uuid>

The uuid of the module

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Content

Find all contents

Authorizations:
bearer
query Parameters
page
number

Page number for pagination

limit
number

Number of item per page for pagination

order-by
string
Example: order-by=name:null,reward:null

Available keys: name, reward

name
any

Filter results by name (matching)

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "data": [
    ]
}

Find a content by id

Authorizations:
bearer
path Parameters
contentId
required
string <uuid>

The UUID of the content

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Team

Create a new team

Authorizations:
bearer
Request Body schema: application/json
name
required
string

The name of the team. Must be unique. Must be at least 3 characters long. Must be less than 20 characters long.

description
string

The description of the team. Must be less than 255 characters long.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Find all teams

Authorizations:
bearer
query Parameters
page
number

Page number for pagination

limit
number

Number of item per page for pagination

order-by
string
Example: order-by=name:null

Available keys: name

name
any

Filter results by name (matching)

Responses

Response samples

Content type
application/json
{
  • "metadata": {
    },
  • "data": [
    ]
}

Find a team by id

Authorizations:
bearer
path Parameters
teamId
required
string <uuid>

The uuid of the team

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Update a team

Authorizations:
bearer
path Parameters
teamId
required
any <uuid>

The uuid of the team

Request Body schema: application/json
name
string

The name of the team. Must be unique. Must be at least 3 characters long. Must be less than 20 characters long.

description
string

The description of the team. Must be less than 255 characters long.

Responses

Request samples

Content type
application/json
{
  • "name": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Delete a team

Authorizations:
bearer
path Parameters
teamId
required
string <uuid>

The uuid of the team

Responses

Add a member to a team.

Authorizations:
bearer
path Parameters
teamId
required
string
Request Body schema: application/json
userId
required
string <uuid>

The userId of the user to add to the team

Responses

Request samples

Content type
application/json
{
  • "userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Remove a member from a team.

Authorizations:
bearer
path Parameters
teamId
required
string
Request Body schema: application/json
userId
required
string <uuid>

The id of the user to add to the team

Responses

Request samples

Content type
application/json
{
  • "userId": "2c4a230c-5085-4924-a3e1-25fb4fc5965b"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Submission

Get last attempt and last success

Get best and last attempts if the user has completed the component

Authorizations:
bearer
path Parameters
componentId
required
string

Responses

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Submit a code

Submit a code, calls a runner to execute it and check the result with the validators of the component

Authorizations:
bearer
Request Body schema: application/json
componentId
required
string

The uuid of the component

language
required
string

The used programming language

code
required
string

Code to execute

Responses

Request samples

Content type
application/json
{
  • "componentId": "string",
  • "language": "string",
  • "code": "string"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}

Submit a code and test it with one validator

Submit a code, calls a runner to execute it and check the result with the validator

Authorizations:
bearer
path Parameters
validatorId
required
string
Request Body schema: application/json
language
required
string

The used programming language

code
required
string

Code to execute

Responses

Request samples

Content type
application/json
{
  • "language": "string",
  • "code": "string"
}

Response samples

Content type
application/json
{
  • "metadata": { },
  • "data": {
    }
}