Could someone please point out the mistake in the below script?
var restapi_url = "https://XXXXX.rest.marketingcloudapis.com/automation/v1/dataextracts";
var restapi_payload = '{"name": "Test DE extract","key": "966D6D48-1AA4-4812-ABD6-7A2DC5B751D5","description": "Trying Update","dataExtractTypeId": "bb94a04d-9632-4623-be47-daabc3f588a6","fileSpec": "TestingUpdateActivity.csv","intervalType": 0,"dataFields": [{"name": "ColumnDelimiter","type": "string","value": ","},{"name": "DECustomerKey","type": "string","value": "6F29911C-2741-43B9-BC35-26D5CFBC7F74"},{"name": "HasColumnHeaders","type": "bool","value": "True"},{ "name": "TextQualified", "type": "bool","value": "True"},{"name": "UsesLineFeed","type": "bool","value": "False"}]}';
var headerNames = ["Authorization"];
var s1="Bearer ";
var headerValues = "Bearer " + accessToken;
var req = new Script.Util.HttpRequest(restapi_url);
req.contentType = "application/json"
req.setHeader("Authorization", headerValues);
req.method = "POST";
req.postData = restapi_payload;
var restapi_result = req.send();
I am getting Bad Request (400) error.
Create automation soap api
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
<Objects xsi:type="Automation">
<Name>System Data Views5</Name>
<CustomerKey>DataViews_Automation5</CustomerKey>
<AutomationTasks>
<AutomationTask>
<Name>Test DE extract8</Name>
<Activities>
<Activity>
<ObjectID>bb94a04d-9632-4623-be47-daabc3f588a6</ObjectID>
<ActivityObject xsi:type="DataExtractActivity">
<ObjectID>bb94a04d-9632-4623-be47-daabc3f588a6</ObjectID>
<CustomerKey>Test DE extract8</CustomerKey>
<Name>Test DE extract5</Name>
</ActivityObject>
</Activity>
</Activities>
</AutomationTask>
</AutomationTasks>
<AutomationType>scheduled</AutomationType>
</Objects>
</CreateRequest>
</s:Body>
</s:Envelope>
It creates the automation but gives the following error: