GET /v2/rules
Return all the rules
GET /v2/project_sessions/:project_session_id/rules
Return all the rules of the given Project session
live_help Notes
assignment
This action requires one of theses roles:
Basic staff
chrome_reader_mode
This resource is paginated by 30 items
settings Params
Param name | Description |
---|---|
project_session_id |
optional
. Must be String
The project_session id |
sort |
optional
. Must be one of: id , kind , name , description , created_at , updated_at , slug , internal_name .
The sort field. Sorted by created_at desc, id desc by default. MoreExample:To sort on rules on the fields slug on a descending order and internal_name on a ascending order: ...&sort=-slug,internal_name |
filter |
optional
. Must be one of: id , kind , name , description , created_at , updated_at , slug , internal_name .
Filtering on one or more fields MoreExample:
To filter on rules with the
...&filter[id]=a_value,another_value Filterable fields:
|
range |
optional
. Must be one of: id , kind , name , description , created_at , updated_at , slug , internal_name .
Select on a particular range MoreExample:
To range on rules with the
...&range[internal_name]=min_value,max_value Rangeable 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/rules?page=1
200
[
{
"id": 34,
"kind": "inscription",
"name": "First name starting by",
"description": "The user first name must start by the #{letter} letter",
"created_at": "2016-05-31T15:00:49.898Z",
"updated_at": "2016-05-31T15:00:49.898Z",
"slug": "inscription-first-name-starting-by",
"internal_name": "FirstNameStartingBy",
"params": [
{
"id": 27,
"name": "letter",
"default_value": "",
"rule_id": 34,
"created_at": "2016-05-31T15:00:49.905Z",
"updated_at": "2016-05-31T15:00:49.905Z",
"data_type": "string"
}
],
"project_sessions_rules": []
}
]
curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/rules?page=1"
[
{
"id": 34,
"kind": "inscription",
"name": "First name starting by",
"description": "The user first name must start by the #{letter} letter",
"created_at": "2016-05-31T15:00:49.898Z",
"updated_at": "2016-05-31T15:00:49.898Z",
"slug": "inscription-first-name-starting-by",
"internal_name": "FirstNameStartingBy",
"params": [
{
"id": 27,
"name": "letter",
"default_value": "",
"rule_id": 34,
"created_at": "2016-05-31T15:00:49.905Z",
"updated_at": "2016-05-31T15:00:49.905Z",
"data_type": "string"
}
],
"project_sessions_rules": []
}
]
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/rules?page=1")
response.status
# => 200
response.parsed
# => [{"id"=>34, "kind"=>"inscription", "name"=>"First name starting by", "description"=>"The user first name must start by the \#{letter} letter", "created_at"=>"2016-05-31T15:00:49.898Z", "updated_at"=>"2016-05-31T15:00:49.898Z", "slug"=>"inscription-first-name-starting-by", "internal_name"=>"FirstNameStartingBy", "params"=>[{"id"=>27, "name"=>"letter", "default_value"=>"", "rule_id"=>34, "created_at"=>"2016-05-31T15:00:49.905Z", "updated_at"=>"2016-05-31T15:00:49.905Z", "data_type"=>"string"}], "project_sessions_rules"=>[]}]