live_help Notes

assignment This action requires one of theses roles: Advanced staff, Advanced tutor
chrome_reader_mode This resource is paginated by 30 items

settings Params

Param name Description
user_id optional . Must be String

The user id or slug

sort optional . Must be one of: id, subject, created_at, updated_at, identifier, meta, title, subtitle, attachment, from, to, cc, bcc, content, html_content, attachments.

The sort field. Sorted by created_at desc by default.

Example:

To sort on mailings on the fields html_content on a descending order and attachments on a ascending order:

...&sort=-html_content,attachments

filter optional . Must be one of: id, subject, created_at, updated_at, identifier, meta, title, subtitle, attachment, from, to, cc, bcc, content, html_content, attachments.

Filtering on one or more fields

Example:

To filter on mailings with the id field matching a_value or another_value:

...&filter[id]=a_value,another_value

Filterable fields:
  • id (standard field)
  • subject (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • identifier (standard field)
  • meta (standard field)
  • title (standard field)
  • subtitle (standard field)
  • attachment (standard field)
  • from (standard field)
  • to (standard field)
  • cc (standard field)
  • bcc (standard field)
  • content (standard field)
  • html_content (standard field)
  • attachments (standard field)
range optional . Must be one of: id, subject, created_at, updated_at, identifier, meta, title, subtitle, attachment, from, to, cc, bcc, content, html_content, attachments.

Select on a particular range

Example:

To range on mailings with the attachments field between min_value and max_value:

...&range[attachments]=min_value,max_value

Rangeable fields:
  • id
  • subject
  • created_at
  • updated_at
  • identifier
  • meta
  • title
  • subtitle
  • attachment
  • from
  • to
  • cc
  • bcc
  • content
  • html_content
  • attachments
page optional . Must be a Hash

The pagination params, as a hash

page[number] optional . Must be Fixnum

The current page

page[size] optional . Must be Fixnum

The number of items per page, defaults to 30, maximum 100

comments powered by <span class='logo-disqus'>Disqus</span>
GET /v2/mailings?page=1
200
[
  {
    "id": 1725549,
    "subject": "Correction imminent",
    "created_at": "2016-04-28T12:30:10.116Z",
    "updated_at": "2016-04-28T12:30:10.116Z",
    "identifier": "imminent_correction_correctors",
    "meta": {
      "id": 268129,
      "date": "2016-04-28T14:45:00+02:00",
      "name": "Defense for ft_ls",
      "user": "Romain Baran",
      "other_user": "thifranc"
    },
    "title": "Correction imminent",
    "subtitle": null,
    "attachment": null,
    "from": "noreply@42.fr",
    "to": [
      "rbaran@student.42.fr"
    ],
    "cc": [],
    "bcc": [],
    "content": "Hi,\nYou will review thifranc's code in 15 minutes!",
    "html_content": "<p>Hi,\nYou will review thifranc&#39;s code in 15 minutes!</p>\n",
    "attachments": null
  },
  {
    "id": 1725550,
    "subject": "Correction imminent",
    "created_at": "2016-04-28T12:30:11.252Z",
    "updated_at": "2016-04-28T12:30:11.252Z",
    "identifier": "imminent_correction_correcteds",
    "meta": {
      "id": 268140,
      "date": "2016-04-28T14:45:00+02:00",
      "name": "Defense for ft_traceroute",
      "user": "Jean Alexandre Bert",
      "other_user": "pnoyelle"
    },
    "title": "Correction imminent",
    "subtitle": null,
    "attachment": null,
    "from": "noreply@42.fr",
    "to": [
      "jbert@student.42.fr"
    ],
    "cc": [],
    "bcc": [],
    "content": "Hi,\nYour code will be reviewed by pnoyelle in 15 minutes!",
    "html_content": "<p>Hi,\nYour code will be reviewed by pnoyelle in 15 minutes!</p>\n",
    "attachments": null
  },
  {
    "id": 1725551,
    "subject": "Correction imminent",
    "created_at": "2016-04-28T12:30:11.292Z",
    "updated_at": "2016-04-28T12:30:11.292Z",
    "identifier": "imminent_correction_correctors",
    "meta": {
      "id": 268140,
      "date": "2016-04-28T14:45:00+02:00",
      "name": "Defense for ft_traceroute",
      "user": "Pierre Noyelle",
      "other_user": "jbert"
    },
    "title": "Correction imminent",
    "subtitle": null,
    "attachment": null,
    "from": "noreply@42.fr",
    "to": [
      "pnoyelle@student.42.fr"
    ],
    "cc": [],
    "bcc": [],
    "content": "Hi,\nYou will review jbert's code in 15 minutes!",
    "html_content": "<p>Hi,\nYou will review jbert&#39;s code in 15 minutes!</p>\n",
    "attachments": null
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/mailings?page=1"

[
  {
    "id": 1725549,
    "subject": "Correction imminent",
    "created_at": "2016-04-28T12:30:10.116Z",
    "updated_at": "2016-04-28T12:30:10.116Z",
    "identifier": "imminent_correction_correctors",
    "meta": {
      "id": 268129,
      "date": "2016-04-28T14:45:00+02:00",
      "name": "Defense for ft_ls",
      "user": "Romain Baran",
      "other_user": "thifranc"
    },
    "title": "Correction imminent",
    "subtitle": null,
    "attachment": null,
    "from": "noreply@42.fr",
    "to": [
      "rbaran@student.42.fr"
    ],
    "cc": [],
    "bcc": [],
    "content": "Hi,\nYou will review thifranc's code in 15 minutes!",
    "html_content": "<p>Hi,\nYou will review thifranc&#39;s code in 15 minutes!</p>\n",
    "attachments": null
  },
  {
    "id": 1725550,
    "subject": "Correction imminent",
    "created_at": "2016-04-28T12:30:11.252Z",
    "updated_at": "2016-04-28T12:30:11.252Z",
    "identifier": "imminent_correction_correcteds",
    "meta": {
      "id": 268140,
      "date": "2016-04-28T14:45:00+02:00",
      "name": "Defense for ft_traceroute",
      "user": "Jean Alexandre Bert",
      "other_user": "pnoyelle"
    },
    "title": "Correction imminent",
    "subtitle": null,
    "attachment": null,
    "from": "noreply@42.fr",
    "to": [
      "jbert@student.42.fr"
    ],
    "cc": [],
    "bcc": [],
    "content": "Hi,\nYour code will be reviewed by pnoyelle in 15 minutes!",
    "html_content": "<p>Hi,\nYour code will be reviewed by pnoyelle in 15 minutes!</p>\n",
    "attachments": null
  },
  {
    "id": 1725551,
    "subject": "Correction imminent",
    "created_at": "2016-04-28T12:30:11.292Z",
    "updated_at": "2016-04-28T12:30:11.292Z",
    "identifier": "imminent_correction_correctors",
    "meta": {
      "id": 268140,
      "date": "2016-04-28T14:45:00+02:00",
      "name": "Defense for ft_traceroute",
      "user": "Pierre Noyelle",
      "other_user": "jbert"
    },
    "title": "Correction imminent",
    "subtitle": null,
    "attachment": null,
    "from": "noreply@42.fr",
    "to": [
      "pnoyelle@student.42.fr"
    ],
    "cc": [],
    "bcc": [],
    "content": "Hi,\nYou will review jbert's code in 15 minutes!",
    "html_content": "<p>Hi,\nYou will review jbert&#39;s code in 15 minutes!</p>\n",
    "attachments": null
  }
]
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

response = token.get("/v2/mailings?page=1")
response.status
# => 200
response.parsed
# => [{"id"=>1725549, "subject"=>"Correction imminent", "created_at"=>"2016-04-28T12:30:10.116Z", "updated_at"=>"2016-04-28T12:30:10.116Z", "identifier"=>"imminent_correction_correctors", "meta"=>{"id"=>268129, "date"=>"2016-04-28T14:45:00+02:00", "name"=>"Defense for ft_ls", "user"=>"Romain Baran", "other_user"=>"thifranc"}, "title"=>"Correction imminent", "subtitle"=>nil, "attachment"=>nil, "from"=>"noreply@42.fr", "to"=>["rbaran@student.42.fr"], "cc"=>[], "bcc"=>[], "content"=>"Hi,\nYou will review thifranc's code in 15 minutes!", "html_content"=>"<p>Hi,\nYou will review thifranc&#39;s code in 15 minutes!</p>\n", "attachments"=>nil}, {"id"=>1725550, "subject"=>"Correction imminent", "created_at"=>"2016-04-28T12:30:11.252Z", "updated_at"=>"2016-04-28T12:30:11.252Z", "identifier"=>"imminent_correction_correcteds", "meta"=>{"id"=>268140, "date"=>"2016-04-28T14:45:00+02:00", "name"=>"Defense for ft_traceroute", "user"=>"Jean Alexandre Bert", "other_user"=>"pnoyelle"}, "title"=>"Correction imminent", "subtitle"=>nil, "attachment"=>nil, "from"=>"noreply@42.fr", "to"=>["jbert@student.42.fr"], "cc"=>[], "bcc"=>[], "content"=>"Hi,\nYour code will be reviewed by pnoyelle in 15 minutes!", "html_content"=>"<p>Hi,\nYour code will be reviewed by pnoyelle in 15 minutes!</p>\n", "attachments"=>nil}, {"id"=>1725551, "subject"=>"Correction imminent", "created_at"=>"2016-04-28T12:30:11.292Z", "updated_at"=>"2016-04-28T12:30:11.292Z", "identifier"=>"imminent_correction_correctors", "meta"=>{"id"=>268140, "date"=>"2016-04-28T14:45:00+02:00", "name"=>"Defense for ft_traceroute", "user"=>"Pierre Noyelle", "other_user"=>"jbert"}, "title"=>"Correction imminent", "subtitle"=>nil, "attachment"=>nil, "from"=>"noreply@42.fr", "to"=>["pnoyelle@student.42.fr"], "cc"=>[], "bcc"=>[], "content"=>"Hi,\nYou will review jbert's code in 15 minutes!", "html_content"=>"<p>Hi,\nYou will review jbert&#39;s code in 15 minutes!</p>\n", "attachments"=>nil}]