live_help Notes

assignment This action requires one of theses roles: Advanced tutor

settings Params

Param name Description
cursus_id optional . Must be String

The cursus id or slug

announcement optional , nil allowed . Must be a Hash
announcement[cursus_ids] optional , nil allowed . Must be an array of Integer

The cursus ids.

announcement[campus_ids] optional , nil allowed . Must be an array of Integer

The campus ids.

announcement[author] required . Must be String

The author.

announcement[title] required . Must be String

The title.

announcement[text] required . Must be String

The text.

announcement[kind] optional , nil allowed . Must be String

The kind.

announcement[expire_at] required . Must be DateTime

The expire at.

announcement[image] optional , nil allowed . Must be String

The image.

comments powered by <span class='logo-disqus'>Disqus</span>
POST /v2/announcements
{
  "announcement": {
    "author": "42partnerships",
    "campus_ids": [
      "1"
    ],
    "cursus_ids": [
      "1"
    ],
    "expire_at": "2017-03-06 15:49:52 UTC",
    "kind": "global",
    "text": "42partnerships revient",
    "title": "Partenariats écoles 2016"
  }
}
201
{
  "id": 6,
  "author": "42partnerships",
  "title": "Partenariats écoles 2016",
  "text": "42partnerships revient",
  "kind": "global",
  "link": null,
  "created_at": "2017-03-06T15:20:06.625Z",
  "updated_at": "2017-03-06T15:20:06.625Z",
  "expire_at": "2017-03-06T15:49:52.000Z"
}
curl  -X POST -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json" -d '{"announcement":{"author":"42partnerships","campus_ids":["1"],"cursus_ids":["1"],"expire_at":"2017-03-06 15:49:52 UTC","kind":"global","text":"42partnerships revient","title":"Partenariats écoles 2016"}}' "https://api.intra.42.fr/v2/announcements"

{
  "id": 6,
  "author": "42partnerships",
  "title": "Partenariats écoles 2016",
  "text": "42partnerships revient",
  "kind": "global",
  "link": null,
  "created_at": "2017-03-06T15:20:06.625Z",
  "updated_at": "2017-03-06T15:20:06.625Z",
  "expire_at": "2017-03-06T15:49:52.000Z"
}
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 = {announcement: {author: "42partnerships", campus_ids: ["1"], cursus_ids: ["1"], expire_at: "2017-03-06 15:49:52 UTC", kind: "global", text: "42partnerships revient", title: "Partenariats écoles 2016"}}
response = token.post("/v2/announcements", params: params)
response.status
# => 201
response.parsed
# => {"id"=>6, "author"=>"42partnerships", "title"=>"Partenariats écoles 2016", "text"=>"42partnerships revient", "kind"=>"global", "link"=>nil, "created_at"=>"2017-03-06T15:20:06.625Z", "updated_at"=>"2017-03-06T15:20:06.625Z", "expire_at"=>"2017-03-06T15:49:52.000Z"}