PATCH /v2/achievements/:id
Update an achievement
PUT /v2/achievements/:id
Update an achievement
live_help Notes
assignment
This action requires one of theses roles:
Achievements manager
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
achievement | optional , nil allowed . Must be a Hash |
achievement[name] |
optional
. Must be String
The name. |
achievement[internal_name] |
optional
. Must be String
The internal name. |
achievement[description] |
optional
. Must be String
The description. Maximum length is 140. |
achievement[pedago] |
optional
, nil allowed
. Must be one of: true , false .
Is it pedago ? Default to false. |
achievement[visible] |
optional
, nil allowed
. Must be one of: true , false .
Is it visible ? Default to false. |
achievement[nbr_of_success] |
optional
, nil allowed
. Must be Fixnum
The nbr of success. |
achievement[parent_id] |
optional
, nil allowed
. Must be Fixnum
The parent id. |
achievement[image_cache] |
optional
, nil allowed
. Must be String
The image cache. |
achievement[image] |
optional
, nil allowed
. Must be File
The image. |
achievement[kind] |
optional
. Must be one of: project , social , scolarity , pedagogy .
The kind. |
achievement[title_id] |
optional
, nil allowed
. Must be Fixnum
The title id. |
achievement[tier] |
optional
. Must be one of: none , easy , medium , hard , challenge .
The tier. |
achievement[lg] |
optional
, nil allowed
. Must be String
The language id. |
achievement[position] |
optional
, nil allowed
. Must be Fixnum
The position. |
achievement[reward] |
optional
, nil allowed
. Must be String
The reward. |
achievement[cursus_ids] |
optional
, nil allowed
. Must be an array of Integer
The cursus ids. |
achievement[campus_ids] |
optional
, nil allowed
. Must be an array of Integer
The campus ids. |
achievement[community_services_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The community services attributes. |
achievement[community_services_attributes][duration] |
optional
. Must be Fixnum
The duration. |
achievement[community_services_attributes][occupation] |
optional
, nil allowed
. Must be String
The occupation. Maximum length is 255. Allow blank length is true. |
achievement[community_services_attributes][id] |
optional
, nil allowed
. Must be Fixnum
The id. |
achievement[community_services_attributes][_destroy] |
optional
, nil allowed
. Must be String
The destroy. |
Examples
PUT /v2/achievements/8
{
"achievement": {
"name": "Be a test of the API",
"internal_name": "BeATestAPI",
"kind": "social",
"tier": "none",
"description": "Be used as a test for the api",
"image": {
"tempfile": [],
"original_filename": "logo.svg",
"content_type": "image/svg+xml",
"headers": "Content-Disposition: form-data; name=\"achievement[image]\"; filename=\"logo.svg\"\r\nContent-Type: image/svg+xml\r\nContent-Length: 2989\r\n"
},
"title_id": "30",
"cursus_ids": [
"1"
],
"campus_ids": [
"1"
],
"lg": "1"
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"achievement":{"name":"Be a test of the API","internal_name":"BeATestAPI","kind":"social","tier":"none","description":"Be used as a test for the api","image":{"tempfile":[],"original_filename":"logo.svg","content_type":"image/svg+xml","headers":"Content-Disposition: form-data; name=\"achievement[image]\"; filename=\"logo.svg\"\r\nContent-Type: image/svg+xml\r\nContent-Length: 2989\r\n"},"title_id":"30","cursus_ids":["1"],"campus_ids":["1"],"lg":"1"}}' "https://api.intra.42.fr/v2/achievements/8"
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 = {achievement: {name: "Be a test of the API", internal_name: "BeATestAPI", kind: "social", tier: "none", description: "Be used as a test for the api", image: {tempfile: [], original_filename: "logo.svg", content_type: "image/svg+xml", headers: "Content-Disposition: form-data; name="achievement[image]"; filename="logo.svg"
Content-Type: image/svg+xml
Content-Length: 2989
"}, title_id: "30", cursus_ids: ["1"], campus_ids: ["1"], lg: "1"}}
response = token.put("/v2/achievements/8", params: params)
response.status
# => 204
response.parsed
# =>