live_help Notes

assignment This action requires one of theses roles: Advanced tutor
chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
pool_id optional . Must be String

The pool id

sort optional . Must be one of: id, begin_at, end_at, created_at, updated_at, pool_id.

The sort field. Sorted by created_at desc, id desc by default.

Example:

To sort on balances on the fields updated_at on a descending order and pool_id on a ascending order:

...&sort=-updated_at,pool_id

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

Filtering on one or more fields

Example:

To filter on balances 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)
  • updated_at (standard field)
  • pool_id (standard field)
  • future : Return only balances which begins in the future. Can be one of: true, false
  • end (standard field)
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

balance optional , nil allowed . Must be a Hash
balance[begin_at] optional . Must be Fixnum

The begin at. Must be before end at. .

balance[end_at] optional . Must be Fixnum

The end at. .

balance[pool_id] optional , nil allowed . Must be Fixnum

The pool id.

GET /v2/balances?page=1

[
  {
    "id": 191,
    "begin_at": "2018-06-16 10:49:28",
    "end_at": "2018-06-16 14:03:41",
    "pool_id": 21
  },
  {
    "id": 192,
    "begin_at": "2018-06-25 22:52:56",
    "end_at": "2018-07-23 22:52:56",
    "pool_id": 16
  },
  {
    "id": 193,
    "begin_at": "2018-06-28 11:56:03",
    "end_at": "2018-07-26 11:56:03",
    "pool_id": 18
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/balances?page=1"

[
  {
    "id": 191,
    "begin_at": "2018-06-16 10:49:28",
    "end_at": "2018-06-16 14:03:41",
    "pool_id": 21
  },
  {
    "id": 192,
    "begin_at": "2018-06-25 22:52:56",
    "end_at": "2018-07-23 22:52:56",
    "pool_id": 16
  },
  {
    "id": 193,
    "begin_at": "2018-06-28 11:56:03",
    "end_at": "2018-07-26 11:56:03",
    "pool_id": 18
  }
]
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/balances?page=1")
response.status
# => 
response.parsed
# => [{"id"=>191, "begin_at"=>"2018-06-16 10:49:28", "end_at"=>"2018-06-16 14:03:41", "pool_id"=>21}, {"id"=>192, "begin_at"=>"2018-06-25 22:52:56", "end_at"=>"2018-07-23 22:52:56", "pool_id"=>16}, {"id"=>193, "begin_at"=>"2018-06-28 11:56:03", "end_at"=>"2018-07-26 11:56:03", "pool_id"=>18}]