Skip to content

Latest commit

 

History

History
84 lines (66 loc) · 1.75 KB

delete-a-product.md

File metadata and controls

84 lines (66 loc) · 1.75 KB

Delete a Product

{% api-method method="delete" host="https://api.moltin.com" path="/v2/products/:id" %} {% api-method-summary %} Delete by ID {% endapi-method-summary %}

{% api-method-description %} You can quickly delete a Product by ID. {% endapi-method-description %}

{% api-method-spec %} {% api-method-request %} {% api-method-path-parameters %} {% api-method-parameter name="id" type="string" required=true %} The ID for the Product to delete {% endapi-method-parameter %} {% endapi-method-path-parameters %}

{% api-method-headers %} {% api-method-parameter name="Authorization" type="string" required=true %} The Bearer token to grant access to the API {% endapi-method-parameter %} {% endapi-method-headers %} {% endapi-method-request %}

{% api-method-response %} {% api-method-response-example httpCode=204 %} {% api-method-response-example-description %}

{% endapi-method-response-example-description %}

{% endapi-method-response-example %} {% endapi-method-response %} {% endapi-method-spec %} {% endapi-method %}

{% tabs %} {% tab title="cURL" %}

curl -X DELETE https://api.moltin.com/v2/products/:id \
     -H "Authorization: Bearer XXXX"

{% endtab %}

{% tab title="JavaScript SDK" %}

const MoltinGateway = require('@moltin/sdk').gateway

const Moltin = MoltinGateway({
  client_id: 'X',
  client_secret: 'X'
})

const id = 'XXXX'

Moltin.Products.Delete(id).then(response => {
  // Do something
})

{% endtab %}

{% tab title="Moltin Request" %}

const { MoltinClient } = require('@moltin/request')

const client = new MoltinClient({
  client_id: 'X',
  client_secret: 'X'
})

const id = 'XXXX'

client
  .delete(`products/${id}`)
  .then(console.log)
  .catch(console.error)

{% endtab %} {% endtabs %}