PATCH /v2/coalitions/:id
Update a coalition
PUT /v2/coalitions/:id
Update a coalition
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 |
coalition | optional , nil allowed . Must be a Hash |
coalition[bloc_id] |
optional
. Must be Fixnum
The bloc id. |
coalition[user_id] |
optional
. Must be Fixnum
The user id. |
coalition[name] |
optional
. Must be String
The name. Must be unique in the scope of a given bloc. |
coalition[image] |
optional
. Must be File
The image. |
coalition[slug] |
optional
, nil allowed
. Must be String
The slug. |
coalition[color] |
optional
. Must be String
The color. |
coalition[cover] |
optional
, nil allowed
. Must be File
The cover. |
Examples
PUT /v2/coalitions/2
{
"coalition": {
"name": "monkeys",
"bloc_id": "1",
"user_id": "34",
"image": {
"tempfile": [],
"original_filename": "logo.svg",
"content_type": "image/svg+xml",
"headers": "Content-Disposition: form-data; name=\"coalition[image]\"; filename=\"logo.svg\"\r\nContent-Type: image/svg+xml\r\nContent-Length: 2989\r\n"
},
"color": "#f8f45d"
}
}
204
curl -X PUT -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"coalition":{"name":"monkeys","bloc_id":"1","user_id":"34","image":{"tempfile":[],"original_filename":"logo.svg","content_type":"image/svg+xml","headers":"Content-Disposition: form-data; name=\"coalition[image]\"; filename=\"logo.svg\"\r\nContent-Type: image/svg+xml\r\nContent-Length: 2989\r\n"},"color":"#f8f45d"}}' "https://api.intra.42.fr/v2/coalitions/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 = {coalition: {name: "monkeys", bloc_id: "1", user_id: "34", image: {tempfile: [], original_filename: "logo.svg", content_type: "image/svg+xml", headers: "Content-Disposition: form-data; name="coalition[image]"; filename="logo.svg"
Content-Type: image/svg+xml
Content-Length: 2989
"}, color: "#f8f45d"}}
response = token.put("/v2/coalitions/2", params: params)
response.status
# => 204
response.parsed
# =>