A Slot is a time interval when a user desclares himself available to correct other users. Actually, a slot must be at least 30 minutes (with a granularity of 15 minutes). A slot can be set every day between 30 minutes and 2 weeks in advance.

This call obviously lists all slots.

An user without the advanced tutor role can’t set the user_id or the scale_team_id parameter.

  • if there is a resource owner (an user uses this api trough your app, with the web application flow):

    • The /me/slots endpoint will list all the slots set by the current user.
    • The /projects/:project_id/slots endpoint will list all the available slots for the given project. Theses slots can be booked by the current user in order to make a defense.
  • if there isn’t a resource owner

    • The /projects/:project_id/slots endpoint lists all the slots scheduled (with a scale_team) on this project, including all the past ones.
    • The /users/:user_id/slots endpoint lists all the slots for the requested user, as corrector and as corrected. This call is restricted.

In all the cases, the /slots endpoint lists all the slots, booked or not, including all the past ones.

live_help Notes

chrome_reader_mode This resource is paginated by 30 items
assignment_ind This action requires a token resource owner scoped on projects with enough privileges .

settings Params

Param name Description
project_id optional . Must be String

The project id or slug

user_id optional . Must be String

The user id or slug

sort optional . Must be one of: id, begin_at, end_at, user_id, created_at, scale_team_id.

The sort field. Sorted by begin_at desc by default.

Example:

To sort on slots on the fields created_at on a descending order and scale_team_id on a ascending order:

...&sort=-created_at,scale_team_id

filter optional . Must be one of: id, begin_at, end_at, created_at, future, end.

Filtering on one or more fields

Example:

To filter on slots with the id field matching a_value or another_value:

...&filter[id]=a_value,another_value

Filterable fields:
  • id (standard field)
  • begin_at (standard field)
  • end_at (standard field)
  • created_at (standard field)
  • future : Return only slots which begins in the future. Can be one of: true, false
  • end (standard field)
range optional . Must be one of: id, begin_at, end_at, created_at.

Select on a particular range

Example:

To range on slots with the created_at field between min_value and max_value:

...&range[created_at]=min_value,max_value

Rangeable fields:
  • id
  • begin_at
  • end_at
  • created_at
page optional . Must be a Hash

The pagination params, as a hash

page[number] optional . Must be Fixnum

The current page

page[size] optional . Must be Fixnum

The number of items per page, defaults to 30, maximum 100

comments powered by <span class='logo-disqus'>Disqus</span>
GET /v2/slots
200
[
  {
    "id": 9,
    "begin_at": "2017-03-08T20:15:00.000Z",
    "end_at": "2017-03-08T20:30:00.000Z",
    "scale_team": null,
    "user": "invisible"
  },
  {
    "id": 41,
    "begin_at": "2017-03-08T20:15:00.000Z",
    "end_at": "2017-03-08T20:30:00.000Z",
    "scale_team": null,
    "user": "invisible"
  },
  {
    "id": 56,
    "begin_at": "2017-03-08T20:15:00.000Z",
    "end_at": "2017-03-08T20:30:00.000Z",
    "scale_team": null,
    "user": "invisible"
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/slots"

[
  {
    "id": 9,
    "begin_at": "2017-03-08T20:15:00.000Z",
    "end_at": "2017-03-08T20:30:00.000Z",
    "scale_team": null,
    "user": "invisible"
  },
  {
    "id": 41,
    "begin_at": "2017-03-08T20:15:00.000Z",
    "end_at": "2017-03-08T20:30:00.000Z",
    "scale_team": null,
    "user": "invisible"
  },
  {
    "id": 56,
    "begin_at": "2017-03-08T20:15:00.000Z",
    "end_at": "2017-03-08T20:30:00.000Z",
    "scale_team": null,
    "user": "invisible"
  }
]
require "oauth2"
UID = "Your application uid"
SECRET = "Your application secret"
client = OAuth2::Client.new(UID, SECRET, site: "https://api.intra.42.fr")
token = client.client_credentials.get_token

response = token.get("/v2/slots")
response.status
# => 200
response.parsed
# => [{"id"=>9, "begin_at"=>"2017-03-08T20:15:00.000Z", "end_at"=>"2017-03-08T20:30:00.000Z", "scale_team"=>nil, "user"=>"invisible"}, {"id"=>41, "begin_at"=>"2017-03-08T20:15:00.000Z", "end_at"=>"2017-03-08T20:30:00.000Z", "scale_team"=>nil, "user"=>"invisible"}, {"id"=>56, "begin_at"=>"2017-03-08T20:15:00.000Z", "end_at"=>"2017-03-08T20:30:00.000Z", "scale_team"=>nil, "user"=>"invisible"}]