Disable/Enable product through the Magento 2 Api with Rest
you can achieve this using catalogProductRepositoryV1
method
PUT
url
http://magento.host/rest/V1/products/{sku}
Response Class (Status 200)
{
"id": 0,
"sku": "string",
"name": "string",
"attributeSetId": 0,
"price": 0,
"status": 0,
"visibility": 0,
"typeId": "string",
"createdAt": "string",
"updatedAt": "string",
"weight": 0,
"extensionAttributes": {
"downloadableProductLinks": [
{
"id": 0,
"title": "string",
"sortOrder": 0,
"isShareable": 0,
"price": 0,
"numberOfDownloads": 0,
"linkType": "string",
"linkFile": "string",
"linkFileContent": {
"fileData": "string",
"name": "string",
"extensionAttributes": {}
},
"linkUrl": "string",
"sampleType": "string",
"sampleFile": "string",
"sampleFileContent": {
"fileData": "string",
"name": "string",
"extensionAttributes": {}
},
"sampleUrl": "string",
"extensionAttributes": {}
}
],
"downloadableProductSamples": [
{
"id": 0,
"title": "string",
"sortOrder": 0,
"sampleType": "string",
"sampleFile": "string",
"sampleFileContent": {
"fileData": "string",
"name": "string",
"extensionAttributes": {}
},
"sampleUrl": "string",
"extensionAttributes": {}
}
],
"stockItem": {
"itemId": 0,
"productId": 0,
"stockId": 0,
"qty": 0,
"isInStock": true,
"isQtyDecimal": true,
"showDefaultNotificationMessage": true,
"useConfigMinQty": true,
"minQty": 0,
"useConfigMinSaleQty": 0,
"minSaleQty": 0,
"useConfigMaxSaleQty": true,
"maxSaleQty": 0,
"useConfigBackorders": true,
"backorders": 0,
"useConfigNotifyStockQty": true,
"notifyStockQty": 0,
"useConfigQtyIncrements": true,
"qtyIncrements": 0,
"useConfigEnableQtyInc": true,
"enableQtyIncrements": true,
"useConfigManageStock": true,
"manageStock": true,
"lowStockDate": "string",
"isDecimalDivided": true,
"stockStatusChangedAuto": 0,
"extensionAttributes": {}
},
"giftcardAmounts": [
{
"websiteId": 0,
"value": 0,
"websiteValue": 0,
"extensionAttributes": {}
}
],
"configurableProductOptions": [
{
"id": 0,
"attributeId": "string",
"label": "string",
"position": 0,
"isUseDefault": true,
"values": [
{
"valueIndex": 0,
"extensionAttributes": {}
}
],
"extensionAttributes": {},
"productId": 0
}
],
"configurableProductLinks": [
0
],
"bundleProductOptions": [
{
"optionId": 0,
"title": "string",
"required": true,
"type": "string",
"position": 0,
"sku": "string",
"productLinks": [
{
"id": "string",
"sku": "string",
"optionId": 0,
"qty": 0,
"position": 0,
"isDefault": true,
"price": 0,
"priceType": 0,
"canChangeQuantity": 0,
"extensionAttributes": {}
}
],
"extensionAttributes": {}
}
]
},
"productLinks": [
{
"sku": "string",
"linkType": "string",
"linkedProductSku": "string",
"linkedProductType": "string",
"position": 0,
"extensionAttributes": {
"qty": 0
}
}
],
"options": [
{
"productSku": "string",
"optionId": 0,
"title": "string",
"type": "string",
"sortOrder": 0,
"isRequire": true,
"price": 0,
"priceType": "string",
"sku": "string",
"fileExtension": "string",
"maxCharacters": 0,
"imageSizeX": 0,
"imageSizeY": 0,
"values": [
{
"title": "string",
"sortOrder": 0,
"price": 0,
"priceType": "string",
"sku": "string",
"optionTypeId": 0
}
],
"extensionAttributes": {}
}
],
"mediaGalleryEntries": [
{
"id": 0,
"mediaType": "string",
"label": "string",
"position": 0,
"disabled": true,
"types": [
"string"
],
"file": "string",
"content": {
"base64EncodedData": "string",
"type": "string",
"name": "string"
},
"extensionAttributes": {
"videoContent": {
"mediaType": "string",
"videoProvider": "string",
"videoUrl": "string",
"videoTitle": "string",
"videoDescription": "string",
"videoMetadata": "string"
}
}
}
],
"tierPrices": [
{
"customerGroupId": 0,
"qty": 0,
"value": 0,
"extensionAttributes": {}
}
],
"customAttributes": [
{
"attributeCode": "string",
"value": "string"
}
]
}
you can change/update it using PUT method.
let me know if you have any query.