Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

UpdateRequest "Requested value 'APIObject' was not found." #107

Open
Munawwar opened this issue Feb 15, 2017 · 3 comments
Open

UpdateRequest "Requested value 'APIObject' was not found." #107

Munawwar opened this issue Feb 15, 2017 · 3 comments

Comments

@Munawwar
Copy link

Munawwar commented Feb 15, 2017

Hi Developers.
I am using fuel-soap for updating a DataExtensionObject and I was receiving a "Requested value 'APIObject' was not found." error.
I tracked the issue down to line 305 at lib/fuel-soap.js

body.UpdateRequest.Objects.$ = { 'xsi:type': type };

That line was adding an extra Objects XML tag to the body:

<Body>
  <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
    ...
    <Objects>
      <xsi:type>DataExtensionObject</xsi:type>
    </Objects>
  </UpdateRequest>
</Body>

When I commented that line, I started receiving the expected response.
So my question is, is that line necessary? Or am I doing something wrong?


Here is the exact request XML being generated with some props & options (with that line of code):

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Header>
    <fueloauth xmlns="http://exacttarget.com">7BmEgYaQZRrAXAS5uJmM8MOo</fueloauth>
  </Header>
  <Body>
    <UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
      <Options>
        <SaveOptions>
          <SaveOption>
            <PropertyName>DataExtensionObject</PropertyName>
            <SaveAction>UpdateAdd</SaveAction>
          </SaveOption>
        </SaveOptions>
      </Options>
      <Objects xsi:type="DataExtensionObject">
        <CustomerKey>Consolidated_Opt_Out_table</CustomerKey>
        <Keys>
          <Key>
            <Name>Customer_Id</Name>
            <Value>XXXXXXXXX</Value>
          </Key>
          <Key>
            <Name>BrandName__c</Name>
            <Value>brandname</Value>
          </Key>
          <Key>
            <Name>Channel__c</Name>
            <Value>Email</Value>
          </Key>
        </Keys>
        <Properties>
          <Property>
            <Name>Newsletter__c</Name>
            <Value>false</Value>
          </Property>
          <Property>
            <Name>Newsletter_Date__c</Name>
            <Value>2017-02-14</Value>
          </Property>
        </Properties>
      </Objects>
      <Objects>
        <xsi:type>DataExtensionObject</xsi:type>
      </Objects>
    </UpdateRequest>
  </Body>
</Envelope>
@tdsticks
Copy link

I had trouble pulling DE data from ET. After digging around online I saw that dev's were adding the DE name directly into the object type and not using the CustomerKey.

//
// Retrieve Data Extension
//
EtFuelApi.prototype.retrieveDataExtension = function () {
    console.log("::et_fuel_api:: retrieveDataExtension:");

    var deferred = Q.defer();

    var DEName = "{Your DataExtension Name here}";

    // DE look up is handled by passing the DE name into the Type field
    var DEObj = "DataExtensionObject" + "[" + DEName + "]";

    // var CustomerKey = "CUSTOMER KEY DIDN'T WORK FOR ME!";
    // console.log("CustomerKey", CustomerKey);

    // DE fields
    var props = [
        // "EmailAddress",
        // "ListID",
        // "ListName",
        // "ListType",
        // "Status",
        // "SubscriberID",
        "SubscriberKey"
        // "SubscriberType",
        // "AddedBy",
        // "AddMethod",
        // "CreatedDate",
        // "DateUnsubscribed"
    ];

    // If you want to filter your returned data
    var options = {
        // filter: {
        //     leftOperand: 'ListID',
        //     operator: 'equals',
        //     rightOperand: listID
        // }
    };

    SoapClient.retrieve(
        DEObj,
        props,
        options,
        function( err, response ) {
            if ( err ) {
                // error here
                console.error("::et_fuel_api:: retrieveDataExtension:", err);
                return;
            }
            // console.log("::et_fuel_api:: retrieveDataExtension:", response.body);

            if (continueRequest) {
                options.continueRequest = continueRequest;

            }
            // deferred.resolve(response.body);
        }
    );

    return deferred.promise;
};

So try altering your DataExtensionObject name to add the DE name:

    <Objects>
        <xsi:type>DataExtensionObject[YOUR DE NAME HERE]</xsi:type>
      </Objects>

See if that works for you!

@Munawwar
Copy link
Author

Thanks for the tip, but I still get the same error :(

@tdsticks
Copy link

I haven't saved / updated to a DE yet, but if you look at ET's SOAP examples they show this:

<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
	<Header>
		<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
			<UsernameToken>
				<Username>USERNAME_GOES_HERE</Username>
				<Password>PASSWORD_GOES_HERE</Password>
			</UsernameToken>
		</Security>
	</Header>
	<Body>
		<UpdateRequest xmlns="http://exacttarget.com/wsdl/partnerAPI">
			<Options>
				<SaveOptions>
					<SaveOption>
						<PropertyName>*</PropertyName>
						<SaveAction>UpdateAdd</SaveAction>
					</SaveOption>
				</SaveOptions>
			</Options>
			<Objects xsi:type="DataExtensionObject">
				<PartnerKey xsi:nil="true">
				</PartnerKey>
				<ObjectID xsi:nil="true">
				</ObjectID>
				<CustomerKey>First Send</CustomerKey>
				<Properties>
					<Property>
						<Name>EMAIL</Name>
						<Value>ryan2@terralever.com</Value>
					</Property>
					<Property>
						<Name>FIRST SEND</Name>
						<Value>true</Value>
					</Property>
				</Properties>
			</Objects>
		</UpdateRequest>
	</Body>
</Envelope>

This example was from the "Upsert Date Extension Row.xml" file found in here:
http://help.exacttarget.com/Global/Documentation/APIStarterKits/SOAPv3.zip

I've found these to be invaluable as I've had to modify their fuel-soap calls in the past to get things to work properly.

Also, use POSTMAN to test your SOAP calls. This speeds up testing a lot.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants