settings Params

Param name Description
campus_id optional . Must be String

The campus id or slug

comments powered by <span class='logo-disqus'>Disqus</span>
GET /v2/products
200
[
  {
    "id": 1,
    "name": "Jakku",
    "description": "Utapau",
    "price": 100,
    "quantity": 20,
    "begin_at": null,
    "end_at": null,
    "category_id": 1,
    "created_at": "2017-11-22T13:41:20.457Z",
    "updated_at": "2017-11-22T13:41:20.498Z",
    "kind": "auto",
    "slug": "jakku",
    "image": {
      "url": "/uploads/product/image/1/logo.png",
      "thumb": {
        "url": "/uploads/product/image/1/thumb_logo.png"
      }
    },
    "is_uniq": true,
    "one_time_purchase": false
  },
  {
    "id": 2,
    "name": "Sullust",
    "description": "Lothal",
    "price": 100,
    "quantity": 20,
    "begin_at": null,
    "end_at": null,
    "category_id": 1,
    "created_at": "2017-11-22T13:41:20.528Z",
    "updated_at": "2017-11-22T13:41:20.561Z",
    "kind": "auto",
    "slug": "sullust",
    "image": {
      "url": "/uploads/product/image/2/logo.png",
      "thumb": {
        "url": "/uploads/product/image/2/thumb_logo.png"
      }
    },
    "is_uniq": true,
    "one_time_purchase": false
  },
  {
    "id": 3,
    "name": "Geonosis",
    "description": "Naboo",
    "price": 100,
    "quantity": 20,
    "begin_at": null,
    "end_at": null,
    "category_id": 1,
    "created_at": "2017-11-22T13:41:20.590Z",
    "updated_at": "2017-11-22T13:41:20.621Z",
    "kind": "auto",
    "slug": "geonosis",
    "image": {
      "url": "/uploads/product/image/3/logo.png",
      "thumb": {
        "url": "/uploads/product/image/3/thumb_logo.png"
      }
    },
    "is_uniq": true,
    "one_time_purchase": false
  }
]
curl  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/products"

[
  {
    "id": 1,
    "name": "Jakku",
    "description": "Utapau",
    "price": 100,
    "quantity": 20,
    "begin_at": null,
    "end_at": null,
    "category_id": 1,
    "created_at": "2017-11-22T13:41:20.457Z",
    "updated_at": "2017-11-22T13:41:20.498Z",
    "kind": "auto",
    "slug": "jakku",
    "image": {
      "url": "/uploads/product/image/1/logo.png",
      "thumb": {
        "url": "/uploads/product/image/1/thumb_logo.png"
      }
    },
    "is_uniq": true,
    "one_time_purchase": false
  },
  {
    "id": 2,
    "name": "Sullust",
    "description": "Lothal",
    "price": 100,
    "quantity": 20,
    "begin_at": null,
    "end_at": null,
    "category_id": 1,
    "created_at": "2017-11-22T13:41:20.528Z",
    "updated_at": "2017-11-22T13:41:20.561Z",
    "kind": "auto",
    "slug": "sullust",
    "image": {
      "url": "/uploads/product/image/2/logo.png",
      "thumb": {
        "url": "/uploads/product/image/2/thumb_logo.png"
      }
    },
    "is_uniq": true,
    "one_time_purchase": false
  },
  {
    "id": 3,
    "name": "Geonosis",
    "description": "Naboo",
    "price": 100,
    "quantity": 20,
    "begin_at": null,
    "end_at": null,
    "category_id": 1,
    "created_at": "2017-11-22T13:41:20.590Z",
    "updated_at": "2017-11-22T13:41:20.621Z",
    "kind": "auto",
    "slug": "geonosis",
    "image": {
      "url": "/uploads/product/image/3/logo.png",
      "thumb": {
        "url": "/uploads/product/image/3/thumb_logo.png"
      }
    },
    "is_uniq": true,
    "one_time_purchase": false
  }
]
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/products")
response.status
# => 200
response.parsed
# => [{"id"=>1, "name"=>"Jakku", "description"=>"Utapau", "price"=>100, "quantity"=>20, "begin_at"=>nil, "end_at"=>nil, "category_id"=>1, "created_at"=>"2017-11-22T13:41:20.457Z", "updated_at"=>"2017-11-22T13:41:20.498Z", "kind"=>"auto", "slug"=>"jakku", "image"=>{"url"=>"/uploads/product/image/1/logo.png", "thumb"=>{"url"=>"/uploads/product/image/1/thumb_logo.png"}}, "is_uniq"=>true, "one_time_purchase"=>false}, {"id"=>2, "name"=>"Sullust", "description"=>"Lothal", "price"=>100, "quantity"=>20, "begin_at"=>nil, "end_at"=>nil, "category_id"=>1, "created_at"=>"2017-11-22T13:41:20.528Z", "updated_at"=>"2017-11-22T13:41:20.561Z", "kind"=>"auto", "slug"=>"sullust", "image"=>{"url"=>"/uploads/product/image/2/logo.png", "thumb"=>{"url"=>"/uploads/product/image/2/thumb_logo.png"}}, "is_uniq"=>true, "one_time_purchase"=>false}, {"id"=>3, "name"=>"Geonosis", "description"=>"Naboo", "price"=>100, "quantity"=>20, "begin_at"=>nil, "end_at"=>nil, "category_id"=>1, "created_at"=>"2017-11-22T13:41:20.590Z", "updated_at"=>"2017-11-22T13:41:20.621Z", "kind"=>"auto", "slug"=>"geonosis", "image"=>{"url"=>"/uploads/product/image/3/logo.png", "thumb"=>{"url"=>"/uploads/product/image/3/thumb_logo.png"}}, "is_uniq"=>true, "one_time_purchase"=>false}]