PATCH /v2/accreditations/:id
Update an accreditation
PUT /v2/accreditations/:id
Update an accreditation
live_help Notes
assignment
This action requires one of theses roles:
Basic tutor
, Basic staff
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
accreditation | optional , nil allowed . Must be a Hash |
accreditation[name] |
optional
. Must be String
The name. |
accreditation[user_id] |
optional
. Must be Fixnum
The user id. |
accreditation[cursus_id] |
optional
. Must be Fixnum
The cursus id. |
accreditation[validated] |
optional
, nil allowed
. Must be one of: true , false .
Is it validated ? |
accreditation[difficulty] |
optional
. 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] |
optional
. Must be Fixnum
The skill id. |
accreditation[accreditations_skills_attributes][value] |
optional
. Must be Float
The value. |
accreditation[accreditations_skills_attributes][_destroy] |
optional
, nil allowed
. Must be String
The destroy. |
Examples
PUT /v2/accreditations/2
{
"accreditation": {
"accreditations_skills_attributes": [
{
"skill_id": "2",
"value": "0.0"
}
],
"cursus_id": "2",
"difficulty": "100.0",
"name": "Kamino",
"user_id": "59",
"validated": "true"
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"accreditation":{"accreditations_skills_attributes":[{"skill_id":"2","value":"0.0"}],"cursus_id":"2","difficulty":"100.0","name":"Kamino","user_id":"59","validated":"true"}}' "https://api.intra.42.fr/v2/accreditations/2"
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: "2", value: "0.0"}], cursus_id: "2", difficulty: "100.0", name: "Kamino", user_id: "59", validated: "true"}}
response = token.put("/v2/accreditations/2", params: params)
response.status
# => 204
response.parsed
# =>