Does anyone know how to define the location for the data extension when using SOAP api to create a data extension?
2 Answers
You can use it by <CategoryID>
tag in SOAP to add it in folder. If you use Inspect (Open in Chrome > Right click > Inspect > click on the data extension folder) on the category Id will be the parent folder ID.
Below can be same example for SOAP UI to create a data extension in a folder:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:par="http://exacttarget.com/wsdl/partnerAPI">
<soapenv:Body>
<par:CreateRequest>
<par:Options/>
<par:Objects
xsi:type="par:DataExtension">
<par:Client>
<par:ClientID>MID</par:ClientID>
</par:Client>
<par:CategoryID>Folder ID</par:CategoryID>
<par:ModifiedDate xsi:nil="true"/>
<par:ObjectID xsi:nil="true"/>
<par:Name>Data Extension Name</par:Name>
<par:Description>Data Extension Description</par:Description>
<par:IsSendable>false</par:IsSendable>
<par:IsTestable>false</par:IsTestable>
<par:DataRetentionPeriodLength>48</par:DataRetentionPeriodLength>
<par:DataRetentionPeriod>Days</par:DataRetentionPeriod>
<par:RowBasedRetention>false</par:RowBasedRetention>
<par:ResetRetentionPeriodOnImport>true</par:ResetRetentionPeriodOnImport>
<par:DeleteAtEndOfRetentionPeriod>false</par:DeleteAtEndOfRetentionPeriod>
<par:Fields>
<par:Field>
<par:CustomerKey>PE_ID</par:CustomerKey>
<par:Name>PE_ID</par:Name>
<par:Description>PE_ID</par:Description>
<par:IsPrimaryKey>true</par:IsPrimaryKey>
<par:MaxLength>100</par:MaxLength>
<par:FieldType>Text</par:FieldType>
<par:DefaultValue></par:DefaultValue>
<par:IsRequired>true</par:IsRequired>
</par:Field>
</par:Fields>
</par:Objects>
</par:CreateRequest>
</soapenv:Body>
</soapenv:Envelope>
Let me know if this helps.
-
1This is about creating a data extension folder, but the OP is asking about adding a Data Extension into a specific folder. Great info, but it is not what the question is about. Please adjust it to reflect what is being asked. May 14, 2020 at 12:45
-
1Thanks @Gortonington for rightly pointing out. Am sorry, I overlooked the question. I have updated my answer now. May 14, 2020 at 14:31
-
-
We use ssjs to create Data Extension and we use the property CategoryID on the data extension object. We set the value to a static value of the folder in which we wish to create the data extension. When you hover over your folder, you will see the id at the bottom. See below. I have not worked with SOAP API, but I believe the underlying object and property remains the same. Hope this helps :)