1

I'm having an issue of getting the date property from the ImportDefinition using SOAP. this is the way im trying to get it:

var retReq = new RetrieveRequest();
retReq.ObjectType = "ImportDefinition";
retReq.Properties = new string[] { "ObjectID", "Name", "CustomerKey", "Description", "CreatedDate"};
var retReq1 = new RetrieveRequest1(retReq);
var res = await _Client.RetrieveAsync(retReq1);

2 Answers 2

0

You can use "ImportResultsSummary" object via WSProxy or follow the documentation to do that with SOAP API Call.

<script runat="server">
Platform.Load("core","1");

try {

   var prox = new Script.Util.WSProxy();
   var cols = [
       "ImportDefinitionCustomerKey",
       "ImportType",
       "ImportStatus",
       "ID",
       "ObjectID",
       "NumberDuplicated",
       "NumberErrors",
       "NumberSuccessful",
       "DestinationID",
       "TaskResultID"
   ];
   var filter = {
       Property: "ImportDefinitionCustomerKey",
       SimpleOperator: "equals",
       Value: "xxxx" /* Paste here External Key*/
   };

   var result = prox.retrieve("ImportResultsSummary", cols, filter);
   Write("Result: " + Stringify(result));

} catch(e) {
    Write("An error has occurred: " + Stringify(e));
}
</script>

However, as you can see there is no CreatedDate available to retrieve, and based on the documentation it is only mentioned in the part "SOAP Request For Import Definiton Creation" and "SOAP Envelope to Create Import Definition with MapByOrdinal".

Moreover, when you would execute the code from above, you would actually retrieve the CreatedDate field but with only default value = 0001-01-01T00:00:00.000, thus it probably means that if you create ImportDefinition manually, then CreatedDate equals the default value and when via API call it would be equal to the time specified by you.

0

As @Niko says, CreatedDate isn't a retrievable property using SOAP. You can get the CreatedDate using the REST /automation/v1/imports route:

curl -sS -X GET https://myTssd.rest.marketingcloudapis.com/automation/v1/imports -H 'Accept: application/json' -H 'Content-Type: application/json'  -H 'Authorization: Bearer myToken'

Although undocumented, the REST based Automation API's quite intuitive compared to the poorly documented SOAP equivalent. The best place to start with respect to understanding what's available with REST would be the Discovery Document on the /automation/v1/rest route or open up the network tab in your browser's developer tools - the UI uses a set of similar routes, so you can see the type of objects expected for POSTs/PUTs/PATCHEs

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .