GET /v2/balances
Return all the balances
GET /v2/pools/:pool_id/balances
Return all the balances of the given Pool
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. MoreExample: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 MoreExample:
To filter on balances 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 |
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. |
Examples
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}]