0

I have to Retrieve the Data Extension Fields from Data Extension object using Soap Api,But I am unable to Retrieve the Data Extension fields using Data Extension Object.

Data Extension Soap Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:par="http://exacttarget.com/wsdl/partnerAPI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Header>
    <Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
      <UsernameToken>
        <Username>xxxxxx</Username>
        <Password>xxxxxxx</Password>
      </UsernameToken>
    </Security>
  </soapenv:Header>
  <soapenv:Body>
    <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
      <RetrieveRequest>
        <ObjectType>DataExtension</ObjectType>
        <Properties>CustomerKey</Properties>
        <Properties>Name</Properties>
        <Properties>DataExtension.ObjectID</Properties>
        <Properties>IsSendable</Properties>
        <Properties>SendableSubscriberField.Name</Properties>
        <Properties>SendableDataExtensionField.Name</Properties>
        <Properties>Fields</Properties>
        <Property>Field.CustomerKey</Property>
        <Property>Field.FieldType</Property>
        <Properties>CategoryID</Properties>
        <Filter xsi:type="SimpleFilterPart">
          <Property>CategoryID</Property>
          <SimpleOperator>equals</SimpleOperator>
          <Value>xxxxxx</Value>
        </Filter>
        <QueryAllAccounts>true</QueryAllAccounts>
      </RetrieveRequest>
    </RetrieveRequestMsg>
  </soapenv:Body>
</soapenv:Envelope>

Here I am trying to Retrieve the fields , but i am unable to Retrieve, what i have to give the value?

<Properties>Fields</Properties>
 <Property>Field.CustomerKey</Property>
 <Property>Field.FieldType</Property>

I dont want to use DataExtension Field object,I want to Retrieve the fields using Data Extension object,please anyone help me for the Answer...

Error Message:

 <RetrieveResponseMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
         <OverallStatus>Error: The Request Property(s) Fields do not match with the fields of DataExtension retrieve</OverallStatus>
         <RequestID>3aadeb4f-2290-402d-9590-f0f07ac3247f</RequestID>
      </RetrieveResponseMsg>
  • Please update your question with the exact error message you are getting when you execute your code. – Adam Spriggs Sep 15 '17 at 13:19
  • I have update the Error Message @AdamSpriggs – user36636 Sep 15 '17 at 13:26
4

You have to do a retrieve on the DataExtensionField object, specifying the DataExtension.CustomerKey in your filter:

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
  <!-- header removed -->
  <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <RetrieveRequestMsg xmlns="http://exacttarget.com/wsdl/partnerAPI">
      <RetrieveRequest>
        <ClientIDs>
          <ID>999999999</ID>
        </ClientIDs>
        <ObjectType>DataExtensionField</ObjectType>
        <Properties>ObjectID</Properties>
        <Properties>PartnerKey</Properties>
        <Properties>CustomerKey</Properties>
        <Properties>Name</Properties>
        <Properties>DefaultValue</Properties>
        <Properties>MaxLength</Properties>
        <Properties>IsRequired</Properties>
        <Properties>Ordinal</Properties>
        <Properties>IsPrimaryKey</Properties>
        <Properties>FieldType</Properties>
        <Properties>CreatedDate</Properties>
        <Properties>ModifiedDate</Properties>
        <Properties>Scale</Properties>
        <Properties>Client.ID</Properties>
        <Properties>DataExtension.CustomerKey</Properties>
        <Properties>StorageType</Properties>
        <Filter xsi:type="SimpleFilterPart">
          <Property>DataExtension.CustomerKey</Property>
          <SimpleOperator>equals</SimpleOperator>
          <Value>DATAEXTENSIONCUSTOMERKEY</Value>
        </Filter>
      </RetrieveRequest>
    </RetrieveRequestMsg>
  </s:Body>
</s:Envelope>

Reference

  • I know this already, i want to retrieve fields using <ObjectType>DataExtension</ObjectType> @Adam Spriggs – user36636 Sep 15 '17 at 13:32
  • please Guide me for this Scenario – user36636 Sep 15 '17 at 13:32
  • 1
    The field information is in a separate object -- DataExtensionField -- not DataExtension. The DataExtension.CustomerKey exists in DataExtension, so if you don't know it, you'll need to retrieve that first. – Adam Spriggs Sep 15 '17 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.