GET /v2/campus/:campus_id/journals
Return all the journals of the given Campus
live_help Notes
assignment
This action requires one of theses roles:
Advanced staff
chrome_reader_mode
This resource is paginated by 30 items
settings Params
Param name | Description |
---|---|
begin_at |
required
. Must be String
begin_at must be before or equal to end_at, your date range must be 124 days maximum |
end_at |
required
. Must be String
end_at must be after or equal to begin_at, your date range must be 124 days maximum |
campus_id |
required
. Must be String
The campus id or slug |
sort |
optional
. Must be one of: id , user_id , item_type , item_id , cursus_id , campus_id , reason , created_at , updated_at , event_at , alumni .
The sort field. Sorted by id desc by default. MoreExample:To sort on journals on the fields event_at on a descending order and alumni on a ascending order: ...&sort=-event_at,alumni |
filter |
optional
. Must be one of: id , user_id , item_type , item_id , cursus_id , campus_id , reason , created_at , updated_at , event_at , alumni , event .
Filtering on one or more fields MoreExample:
To filter on journals with the
...&filter[id]=a_value,another_value Filterable fields:
|
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 |
Examples
GET /v2/campus/1/journals
{
"begin_at": "2021-12-15",
"end_at": "2021-12-16"
}
200
[
{
"id": 5276532,
"user_id": 69936,
"cursus_id": 9,
"campus_id": 1,
"item_type": "Internship",
"item_id": 11547,
"reason": "Currently doing internship",
"created_at": "2021-10-16T01:01:34.979Z",
"updated_at": "2021-10-16T01:01:34.979Z",
"event_at": "2021-10-15T01:01:31.450Z"
},
{
"id": 5178542,
"user_id": 69937,
"item_type": "User",
"item_id": 11547,
"cursus_id": 9,
"campus_id": 1,
"reason": "Used intranet",
"created_at": "2021-10-16T05:15:15.874Z",
"updated_at": "2021-10-16T05:15:15.874Z",
"event_at": "2021-10-15T05:14:13.644Z"
},
{
"id": 42424242,
"user_id": 69936,
"item_type": "ScaleTeam",
"item_id": 11547,
"cursus_id": 9,
"campus_id": 1,
"reason": "Was evaluated by someone",
"created_at": "2021-10-17T05:15:25.874Z",
"updated_at": "2021-10-17T05:15:25.874Z",
"event_at": "2021-10-16T05:02:45.644Z"
}
]
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"begin_at":"2021-12-15","end_at":"2021-12-16"}' "https://api.intra.42.fr/v2/campus/1/journals"
[
{
"id": 5276532,
"user_id": 69936,
"cursus_id": 9,
"campus_id": 1,
"item_type": "Internship",
"item_id": 11547,
"reason": "Currently doing internship",
"created_at": "2021-10-16T01:01:34.979Z",
"updated_at": "2021-10-16T01:01:34.979Z",
"event_at": "2021-10-15T01:01:31.450Z"
},
{
"id": 5178542,
"user_id": 69937,
"item_type": "User",
"item_id": 11547,
"cursus_id": 9,
"campus_id": 1,
"reason": "Used intranet",
"created_at": "2021-10-16T05:15:15.874Z",
"updated_at": "2021-10-16T05:15:15.874Z",
"event_at": "2021-10-15T05:14:13.644Z"
},
{
"id": 42424242,
"user_id": 69936,
"item_type": "ScaleTeam",
"item_id": 11547,
"cursus_id": 9,
"campus_id": 1,
"reason": "Was evaluated by someone",
"created_at": "2021-10-17T05:15:25.874Z",
"updated_at": "2021-10-17T05:15:25.874Z",
"event_at": "2021-10-16T05:02:45.644Z"
}
]
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
params = {begin_at: "2021-12-15", end_at: "2021-12-16"}
response = token.get("/v2/campus/1/journals", params: params)
response.status
# => 200
response.parsed
# => [{"id"=>5276532, "user_id"=>69936, "cursus_id"=>9, "campus_id"=>1, "item_type"=>"Internship", "item_id"=>11547, "reason"=>"Currently doing internship", "created_at"=>"2021-10-16T01:01:34.979Z", "updated_at"=>"2021-10-16T01:01:34.979Z", "event_at"=>"2021-10-15T01:01:31.450Z"}, {"id"=>5178542, "user_id"=>69937, "item_type"=>"User", "item_id"=>11547, "cursus_id"=>9, "campus_id"=>1, "reason"=>"Used intranet", "created_at"=>"2021-10-16T05:15:15.874Z", "updated_at"=>"2021-10-16T05:15:15.874Z", "event_at"=>"2021-10-15T05:14:13.644Z"}, {"id"=>42424242, "user_id"=>69936, "item_type"=>"ScaleTeam", "item_id"=>11547, "cursus_id"=>9, "campus_id"=>1, "reason"=>"Was evaluated by someone", "created_at"=>"2021-10-17T05:15:25.874Z", "updated_at"=>"2021-10-17T05:15:25.874Z", "event_at"=>"2021-10-16T05:02:45.644Z"}]