DELETE /v2/products/:id
Destroy a product
DELETE /v2/campus/:campus_id/products/:id
Destroy a product for the given Id, associated with the given Campus
live_help Notes
assignment
This action requires one of theses roles:
Shop manager
, Advanced tutor
settings Params
Param name | Description |
---|---|
id |
required
. Must be String
The requested id |
campus_id |
optional
. Must be String
The campus id or slug |
product | optional , nil allowed . Must be a Hash |
product[name] |
optional
. Must be String
The name. Must be unique. |
product[description] |
optional
. Must be String
The description. |
product[price] |
optional
. Must be Fixnum
The price. |
product[quantity] |
optional
, nil allowed
. Must be Fixnum
The quantity. |
product[begin_at] |
optional
, nil allowed
. Must be DateTime
The begin at. |
product[end_at] |
optional
, nil allowed
. Must be DateTime
The end at. |
product[category_id] |
optional
. Must be Fixnum
The category id. |
product[kind] |
optional
. Must be one of: user , manager , auto .
The kind. |
product[slug] |
optional
, nil allowed
. Must be String
The slug. |
product[image] |
optional
. Must be File
The image. |
product[is_uniq] |
optional
, nil allowed
. Must be one of: true , false .
Is it is uniq ? |
product[one_time_purchase] |
optional
, nil allowed
. Must be one of: true , false .
Is it one time purchase ? |
product[campus_products_attributes] |
optional
, nil allowed
. Must be an Array of nested elements
The campus products attributes. |
product[campus_products_attributes][campus_id] |
optional
. Must be Fixnum
The campus id. |
product[campus_products_attributes][_destroy] |
optional
, nil allowed
. Must be String
The destroy. |
Examples
DELETE /v2/products/1
204
curl -X DELETE -H "Authorization: Bearer YOUR_ACCESS_TOKEN" "https://api.intra.42.fr/v2/products/1"
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.delete("/v2/products/1")
response.status
# => 204
response.parsed
# =>