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 by default.

Example:

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

Example:

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

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

Filterable fields:
  • id (standard field)
  • kind (standard field)
  • name (standard field)
  • description (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • slug (standard field)
  • internal_name (standard field)
range optional . Must be one of: id, kind, name, description, created_at, updated_at, slug, internal_name.

Select on a particular range

Example:

To range on rules with the internal_name field between min_value and max_value:

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

Rangeable fields:
  • id
  • kind
  • name
  • description
  • created_at
  • updated_at
  • slug
  • internal_name
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/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"=>[]}]