live_help Notes

assignment This action requires one of theses roles: Basic tutor, Basic staff

settings Params

Param name Description
accreditation optional , nil allowed . Must be a Hash
accreditation[name] required . Must be String

The name.

accreditation[user_id] required . Must be Fixnum

The user id.

accreditation[cursus_id] required . Must be Fixnum

The cursus id.

accreditation[validated] optional , nil allowed . Must be one of: true, false.

Is it validated ?

accreditation[difficulty] required . Must be Fixnum

The difficulty.

accreditation[accreditations_skills_attributes] optional , nil allowed . Must be an Array of nested elements

The accreditations skills attributes.

accreditation[accreditations_skills_attributes][skill_id] required . Must be Fixnum

The skill id.

accreditation[accreditations_skills_attributes][value] required . Must be Float

The value.

accreditation[accreditations_skills_attributes][_destroy] optional , nil allowed . Must be String

The destroy.

POST /v2/accreditations
{
  "accreditation": {
    "accreditations_skills_attributes": [
      {
        "skill_id": "5",
        "value": "100.0"
      }
    ],
    "cursus_id": "2",
    "difficulty": "100.0",
    "name": "DQar",
    "user_id": "90",
    "validated": "true"
  }
}
201
{
  "id": 3,
  "name": "DQar",
  "user_id": 90,
  "cursus_id": 2,
  "validated": true,
  "difficulty": 100
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"accreditation":{"accreditations_skills_attributes":[{"skill_id":"5","value":"100.0"}],"cursus_id":"2","difficulty":"100.0","name":"DQar","user_id":"90","validated":"true"}}' "https://api.intra.42.fr/v2/accreditations"

{
  "id": 3,
  "name": "DQar",
  "user_id": 90,
  "cursus_id": 2,
  "validated": true,
  "difficulty": 100
}
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 = {accreditation: {accreditations_skills_attributes: [{skill_id: "5", value: "100.0"}], cursus_id: "2", difficulty: "100.0", name: "DQar", user_id: "90", validated: "true"}}
response = token.post("/v2/accreditations", params: params)
response.status
# => 201
response.parsed
# => {"id"=>3, "name"=>"DQar", "user_id"=>90, "cursus_id"=>2, "validated"=>true, "difficulty"=>100}