I'm trying to create a QueryDefinition through the SOAP API using a new Server-to-Server Integration
. I can successfully generate an access_token
through the TENANT_ENDPOINT.auth.marketingcloudapis.com/v2/token
endpoint but am unable to use it in any requests.
This is the SOAP envelope being generated
<soapenv:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="http://exacttarget.com/wsdl/partnerAPI" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<fueloauth> [ACCESS TOKEN FROM AUTH REQUEST] </fueloauth>
</soapenv:Header>
<soapenv:Body>
<tns:CreateRequest>
<tns:Objects xsi:type="ns1:QueryDefinition" xmlns:ns1="http://exacttarget.com/wsdl/partnerAPI">
<tns:Name>Sample Query</tns:Name>
<tns:CustomerKey>SamlpeQueryKey</tns:CustomerKey>
<tns:QueryText>SELECT * FROM [QueryDefinitionTest]</tns:QueryText>
<tns:TargetType>DE</tns:TargetType>
<tns:DataExtensionTarget>
<tns:CustomerKey>QueryDefinitionTest</tns:CustomerKey>
<tns:Name>QueryDefinitionTest</tns:Name>
</tns:DataExtensionDarget>
<tns:TargetUpdateType>Overwrite</tns:TargetUpdateType>
</tns:Objects>
</tns:CreateRequest>
</soapenv:Body>
</soapenv:Envelope>
This is the error being returned from SFMC
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>User not authorized</faultstring>
<faultactor>https://webservice.exacttarget.com/Service.asmx</faultfactor>
<detail>
<apifault xmlns="urn:fault.partner.exacttarget.com">
<Code>11</Code>
<Message>User not authorized</Message>
</apifault>
</detail>
</soap:Fault>
Has something on the SOAP API changed that I haven't found in the docs? I'm not authenticating through a user so the error message doesn't give me an indication as to what is going on.
soap_instance_url
when making your soap calls? This authentication will not work with any legacy endpoints.