live_help Notes

assignment This action requires one of theses roles: Student 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, value, user_id, transactable_id, transactable_type, created_at, reason.

The sort field. Sorted by created_at desc, id desc by default.

Example:

To sort on transactions on the fields created_at on a descending order and reason on a ascending order:

...&sort=-created_at,reason

filter optional . Must be one of: id, value, user_id, transactable_id, transactable_type, created_at, reason.

Filtering on one or more fields

Example:

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

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

Filterable fields:
  • id (standard field)
  • value (standard field)
  • user_id (standard field)
  • transactable_id (standard field)
  • transactable_type (standard field)
  • created_at (standard field)
  • reason (standard field)
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

GET /v2/transactions?page=1
200
[
  {
    "id": 1,
    "value": 150,
    "user_id": 22,
    "transactable_id": 81,
    "transactable_type": "Achievement",
    "reason": "Mathieu c'est le plus fort ♥️",
    "user": {
      "id": 22,
      "login": "mathieu",
      "url": "https://api.intra.42.fr/v2/users/mathieu"
    }
  },
  {
    "id": 2,
    "value": 666,
    "user_id": 123,
    "transactable_id": 186,
    "transactable_type": "Event",
    "reason": "Réunion entre démons.",
    "user": {
      "id": 123,
      "login": "jeanne",
      "url": "https://api.intra.42.fr/v2/users/jeanne"
    }
  },
  {
    "id": 2,
    "value": 1,
    "user_id": 12837,
    "transactable_id": null,
    "transactable_type": "Tuteur api",
    "reason": "Exam C 24 janvier",
    "user": {
      "id": 12837,
      "login": "jbailhac",
      "url": "https://api.intra.42.fr/v2/users/jbailhac"
    }
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/transactions?page=1"

[
  {
    "id": 1,
    "value": 150,
    "user_id": 22,
    "transactable_id": 81,
    "transactable_type": "Achievement",
    "reason": "Mathieu c'est le plus fort ♥️",
    "user": {
      "id": 22,
      "login": "mathieu",
      "url": "https://api.intra.42.fr/v2/users/mathieu"
    }
  },
  {
    "id": 2,
    "value": 666,
    "user_id": 123,
    "transactable_id": 186,
    "transactable_type": "Event",
    "reason": "Réunion entre démons.",
    "user": {
      "id": 123,
      "login": "jeanne",
      "url": "https://api.intra.42.fr/v2/users/jeanne"
    }
  },
  {
    "id": 2,
    "value": 1,
    "user_id": 12837,
    "transactable_id": null,
    "transactable_type": "Tuteur api",
    "reason": "Exam C 24 janvier",
    "user": {
      "id": 12837,
      "login": "jbailhac",
      "url": "https://api.intra.42.fr/v2/users/jbailhac"
    }
  }
]
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/transactions?page=1")
response.status
# => 200
response.parsed
# => [{"id"=>1, "value"=>150, "user_id"=>22, "transactable_id"=>81, "transactable_type"=>"Achievement", "reason"=>"Mathieu c'est le plus fort ♥️", "user"=>{"id"=>22, "login"=>"mathieu", "url"=>"https://api.intra.42.fr/v2/users/mathieu"}}, {"id"=>2, "value"=>666, "user_id"=>123, "transactable_id"=>186, "transactable_type"=>"Event", "reason"=>"Réunion entre démons.", "user"=>{"id"=>123, "login"=>"jeanne", "url"=>"https://api.intra.42.fr/v2/users/jeanne"}}, {"id"=>2, "value"=>1, "user_id"=>12837, "transactable_id"=>nil, "transactable_type"=>"Tuteur api", "reason"=>"Exam C 24 janvier", "user"=>{"id"=>12837, "login"=>"jbailhac", "url"=>"https://api.intra.42.fr/v2/users/jbailhac"}}]