2

I try to update an existing SQL query activity in Marketing Cloud with SOAP API but I keep getting the same error.

The request I send is this:

<?xml version="1.0" encoding="UTF-8"?>
<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">
   <s:Header>
    <fueloauth xmlns="http://exacttarget.com">{{accessToken}}</fueloauth>
   </s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
   <Options>
   </Options>
     <Objects xsi:type="QueryDefinition">
       <CustomerKey>Prod_Bronze_SK</CustomerKey>
       <Name>Prod_Bronze_SK</Name>
       <QueryText>SELECT SubscriberKey, Email, Is_Action_NL, 
Is_Club_NL, Is_Fashion_NL 
FROM [Prod_Bronze] 
WHERE SendoutCountry = 'SK'
       </QueryText>
       <TargetType>DE</TargetType>
    <DataExtensionTarget>
     <PartnerKey xsi:nil="true">
     </PartnerKey>
     <ObjectID xsi:nil="true">
     </ObjectID>
     <CustomerKey>Prod_Bronze_SK</CustomerKey>
     <Name>Prod_Bronze_SK</Name>
     </DataExtensionTarget>
     <TargetUpdateType>Overwrite</TargetUpdateType>
   </Objects>
  </UpdateRequest>

I always get back this response:

<Results>
  <StatusCode>Error</StatusCode>
  <StatusMessage>Exception occurred during [UpdateQueryDefinition] ErrorID: 148844611</StatusMessage>
  <OrdinalID>0</OrdinalID>
  <ErrorCode>2</ErrorCode>

In the documentation I found this for that Error code:

You may encounter this error code on a SOAP fault during authentication (login has an unexpected exception). Log error information and contact Marketing Cloud support.

So it seems like there is a problem with the authentication. I tried to process my call with token authentication and also with Username/PW authentication. With both authentication types I could perform create requests.

In the QueryDefinition documentation page I found this (and set the permissions accordingly for my API user - with no change in result):

To update a QueryDefinition where the CategoryID is greater than 0, you need the Email | Interactions | Activities | Query | Move permission.

For the Token authentication, I enabled all rights in the API package.

Can anyone help me finding the cause of the error? Do I need to set additional rights? Is there an error in my request?

Thanks for your answers!

Best regards,

Sebastian

2

To successfully update a QueryDefinition using SOAP, I had to include (1)the account's MID and (2)the query activity's ObjectID. I found the ObjectID by hovering over the link to the query activity in Email Studio, down in the browser's status bar — it'll be the "id" query parameter value.

<Objects xsi:type="QueryDefinition">
  <Client>
    <ID>{{ mid }}</ID>
  </Client>
  <ObjectID>{{ id }}</ObjectID>
  <CustomerKey>Prod_Bronze_SK</CustomerKey>
  ...
0

I came across this post whilst trying to troubleshoot an upsert issue. We had the same error which we solved by creating an MID/Business Unit specific endpoint/package.

With this we noticed we did not need to specify the Client ID

Edit: MID is the company account ID or 'Business Unit' you're assigned in Marketing Cloud. You can find it by navigating to the top bar, then clicking the Down arrow next to your company/account name

Otherwise you can inspect and search for the following:

<div class="pull-right">MID: 11111212</div>

Finding out which package you have assigned to which MID: 1. Nav to top right 2. Click user, dropdown should appear 3. Click Administration (if you don't have access to it, an admin will need to do this) 4. new page will load. Go to Account -> Installed packages 5. Select the package you're using to interact with SFMC from the list 6. look for 'Business Unit'

  • 1
    Can you edit your original post to spell out what MID means? – David Cheng Nov 14 '18 at 4:15

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.