I am trying to inactive Apex Trigger using tooling API. I don't see any errors, I am getting "Success" message, but Trigger is not getting updated with inactive flag.
String json= '{ "MetadataContainerId":"1dcS0000000fGp7IAE", "ContentEntityId": "01qS0000000YCKZIA4", "Metadata": { "status": "Inactive"} }';
Httprequest req =new HttpRequest();
req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v43.0/tooling/sobjects/ApexTriggerMember/');
req.setHeader('Content-Type','application/json');
req.setHeader('Authorization','OAuth ' + UserInfo.getSessionId());
req.setMethod('POST');
req.setBody(json);
Http httpReq =new Http();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());
System.HttpRequest[Endpoint=https://yearup--Staging.my.salesforce.com/services/data/v43.0/tooling/sobjects/ApexTriggerMember/, Method=POST] System.HttpResponse[Status=Created, StatusCode=201] DEBUG|{"id":"401S0000000ANl3IAG","success":true,"errors":[],"warnings":[]}
// Create a Trigger
String json = '{ "Name" : "AccountTrigger", "TableEnumOrId" : "Account", "Body" : "trigger AccountTrigger1 on Account (before insert) { for(Account objacc : trigger.new){}}" }';
Httprequest req = new HttpRequest();
req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm() + '/services/data/v27.0/sobjects/ApexTrigger');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');
req.setHeader('Authorization', 'OAuth ' + UserInfo.getSessionId());
req.setBody(json);
Http httpReq = new Http();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());
// 01q54000000ShJ9AAK
// Create container
Httprequest req =new HttpRequest();
req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v28.0/tooling/sobjects/MetadataContainer/');
req.setHeader('Content-Type','application/json');
req.setHeader('Authorization','OAuth ' + UserInfo.getSessionId());
req.setMethod('POST');
req.setBody('{"Name":"TriggerMContainer"}');
Http httpReq =new Http();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());
// 1dc54000000bs2bAAA
// Update Trigger
Httprequest req =new HttpRequest();
req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v28.0/tooling/sobjects/ApexTriggerMember/');
req.setHeader('Content-Type','application/json');
req.setHeader('Authorization','OAuth ' + UserInfo.getSessionId());
req.setMethod('POST');
req.setBody('{"MetadataContainerId":"1dc54000000bs2bAAA","ContentEntityId" : "01q54000000ShJ9AAK", "Metadata": { "status": "Inactive"} }');
Http httpReq =new Http();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());
// Create Async
Httprequest req =new HttpRequest();
req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v28.0/tooling/sobjects/ContainerAsyncRequest/');
req.setHeader('Content-Type','application/json');
req.setHeader('Authorization','OAuth ' + UserInfo.getSessionId());
req.setMethod('POST');
req.setBody('{"MetadataContainerId" : "1dc54000000bs2bAAA", "isCheckOnly": "false"}');
Http httpReq =new Http();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());
// 1dr54000001zhB4AAI
// Async Status
Httprequest req =new HttpRequest();
req.setEndpoint(URL.getSalesforceBaseUrl().toExternalForm()+'/services/data/v28.0/tooling/sobjects/ContainerAsyncRequest/1dr54000001zhB4AAI');
req.setHeader('Content-Type','application/json');
req.setHeader('Authorization','OAuth ' + UserInfo.getSessionId());
req.setMethod('GET');
Http httpReq =new Http();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());
Error: