Count all occurences on a particular field (default on created_at) by a particular period, starting from the first occurence to now.

settings Params

Param name Description
field optional . Must be one of: created_at, updated_at, pinned_at, locked_at, write_at.

The date field to graph on. Default to created_at.

interval optional . Must be one of: day, week, month, quarter, year, hour_of_day, day_of_week, day_of_month, month_of_year.

The interval to graph by. Default to month_of_year.

sort optional . Must be one of: id, name, author_id, kind, created_at, updated_at, pinned_at, locked_at, pinner_id, locker_id, language_id, write_at, message_id, answer_id.

The sort field. Sorted by updated_at desc by default.

Example:

To sort on topics on the fields message_id on a descending order and answer_id on a ascending order:

...&sort=-message_id,answer_id

filter optional . Must be one of: id, name, author_id, kind, created_at, updated_at, pinned_at, locked_at, pinner_id, locker_id, language_id, write_at, message_id, answer_id, pinned, locked, write.

Filtering on one or more fields

Example:

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

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

Filterable fields:
  • id (standard field)
  • name (standard field)
  • author_id (standard field)
  • kind (standard field)
  • created_at (standard field)
  • updated_at (standard field)
  • pinned_at (standard field)
  • locked_at (standard field)
  • pinner_id (standard field)
  • locker_id (standard field)
  • language_id (standard field)
  • write_at (standard field)
  • message_id (standard field)
  • answer_id (standard field)
  • pinned (standard field)
  • locked (standard field)
  • write (standard field)
range optional . Must be one of: id, name, author_id, kind, created_at, updated_at, pinned_at, locked_at, pinner_id, locker_id, language_id, write_at, message_id, answer_id.

Select on a particular range

Example:

To range on topics with the answer_id field between min_value and max_value:

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

Rangeable fields:
  • id
  • name
  • author_id
  • kind
  • created_at
  • updated_at
  • pinned_at
  • locked_at
  • pinner_id
  • locker_id
  • language_id
  • write_at
  • message_id
  • answer_id
comments powered by <span class='logo-disqus'>Disqus</span>
GET /v2/topics/graph/on/created_at/by/day
200
{
  "2017-03-06": 10
}
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/topics/graph/on/created_at/by/day"

{
  "2017-03-06": 10
}
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/topics/graph/on/created_at/by/day")
response.status
# => 200
response.parsed
# => {"2017-03-06"=>10}