live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
id required . Must be String

The requested id

rule optional , nil allowed . Must be a Hash
rule[id] optional , nil allowed . Must be Fixnum

The id.

rule[kind] optional . Must be one of: inscription, correction, final_compilation, eval_compilation, retriable, group_validation, team_generation.

The kind.

rule[name] optional . Must be String

The name. Must be unique in the scope of a given kind.

rule[description] optional , nil allowed . Must be String

The description.

rule[created_at] optional , nil allowed . Must be DateTime

The created at.

rule[updated_at] optional , nil allowed . Must be DateTime

The updated at.

rule[slug] optional , nil allowed . Must be String

The slug.

rule[internal_name] optional , nil allowed . Must be String

The internal name.

rule[params_attributes] optional , nil allowed . Must be an Array of nested elements

The params attributes.

rule[params_attributes][id] optional , nil allowed . Must be Fixnum

The id.

rule[params_attributes][name] optional . Must be String

The name.

rule[params_attributes][default_value] optional , nil allowed . Must be String

The default value.

rule[params_attributes][rule_id] optional , nil allowed . Must be Fixnum

The rule id.

rule[params_attributes][data_type] optional . Must be one of: string, integer, array.

The data type.

rule[params_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

comments powered by <span class='logo-disqus'>Disqus</span>
PUT /v2/rules/10
{
  "rule": {
    "description": "The user first name must start by the #{letter} letter",
    "internal_name": "FirstNameStartingBy",
    "kind": "inscription",
    "name": "First name starting by",
    "params_attributes": [
      {
        "data_type": "string",
        "default_value": "",
        "name": "letter"
      }
    ]
  }
}
204
curl  -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"rule":{"description":"The user first name must start by the #{letter} letter","internal_name":"FirstNameStartingBy","kind":"inscription","name":"First name starting by","params_attributes":[{"data_type":"string","default_value":"","name":"letter"}]}}' "https://api.intra.42.fr/v2/rules/10"
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 = {rule: {description: "The user first name must start by the #{letter} letter", internal_name: "FirstNameStartingBy", kind: "inscription", name: "First name starting by", params_attributes: [{data_type: "string", default_value: "", name: "letter"}]}}
response = token.put("/v2/rules/10", params: params)
response.status
# => 204
response.parsed
# =>