[SalesForce] Create Marketing Cloud DE Using SOAP API in Postman

I haven't been having luck with using the FuelSDKs to use the Marketing Cloud APIs. So I've been trying to test the SOAP API directly in postman first to see if it works; and sadly I haven't gotten that to work either…

I pretty much copied and pasted the SOAP request from here but it doesn't work. I get a 400 Bad Request

Details

First I get an access token by authenticating against https://domain.auth.marketingcloudapis.com/v2/token/

{
"grant_type": "client_credentials",
"client_id": "clientid",
"client_secret": "secret",
"scope": "data_extensions_read data_extensions_write"
}

This seems to work fine, I get the access token, which I use in the following request, which I copied verbatim from the link above.

I send the request to https://domain.soap.marketingcloudapis.com/Service.asmx

<?xml version="1.0"?>
<s:envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:header>
  <fueloauth>
    access_token
  </fueloauth>
</s:header>
<s:body>
    <CreateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
        <Options></Options>
        <Objects xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI" xsi:type="ns1:DataExtension">
            <CustomerKey>DataExtensionFromAPI</CustomerKey>
            <Name>DataExtensionFromAPI</Name>
            <IsSendable>false</IsSendable>
            <SendableDataExtensionField>
                <CustomerKey>EmailAddress_Key</CustomerKey>
                <Name>EmailAddress</Name>
                <FieldType>EmailAddress</FieldType>
            </SendableDataExtensionField>
            <SendableSubscriberField>
                <Name>Email Address</Name>
                <Value></Value>
            </SendableSubscriberField>
            <Fields>
                <Field>
                    <CustomerKey>EmailAddress_Key</CustomerKey>
                    <Name>EmailAddress</Name>
                    <FieldType>EmailAddress</FieldType>
                </Field>
                <Field>
                    <CustomerKey>ChannelUser_Key</CustomerKey>
                    <Name>ChannelUser</Name>
                    <FieldType>Text</FieldType>
                </Field>
                <Field>
                    <CustomerKey>ChannelUser_EmailAddress_Key</CustomerKey>
                    <Name>ChannelUser_EmailAddress</Name>
                    <FieldType>EmailAddress</FieldType>
                </Field>
                <Field>
                    <CustomerKey>Demographic_Address_Key</CustomerKey>
                    <Name>Demographic_Address</Name>
                    <FieldType>Text</FieldType>
                </Field>
            </Fields>
        </Objects>
    </CreateRequest>
</s:body>
</s:envelope>

However I seem to get this 400 Bad Request as a response. What am I doing wrong?

Best Answer

Validating your call in SoapUI it appears your syntax is wrong in the envelope/header/body tag. They should be capitalized

Similar to

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="xsi">
   <s:Header>
      <fueloauth>access_token</fueloauth>
   </s:Header>
   <s:Body>

And corresponding closing tags

Related Topic