2

I'm having this issue with the php soap-api where I'm just unable to connect a DataExtension to a DataExtensionField. To be more precise, I can't get the DataExentensionFields related to a DataExtension object.

When I return all DataExtension(s) I should be able to specify in the properties array (which tells the api what to return) the Fields property which is specified in the DataExtension definition here: http://help.exacttarget.com/en/technical_library/web_service_guide/objects/dataextension/ Could it be a permission problem? Here is an example snipped from the code I use:

                       * Create the retrieve request for data extensions
           * @var ExactTarget_RetrieveRequest
           */
                $re = new ExactTarget_RetrieveRequest();
                $re->ObjectType = "DataExtension";
                $re->Properties =  array();
                $re->Properties[] = "Name";
                $re->Properties[] = "ObjectID";
                $re->Properties[] = "PartnerKey"; 
                $re->Properties[] = "IsSendable";
                $re->Properties[] = "Status";
                $re->Properties[] = "Fields";
                $re->Options = NULL;
                                     /**
                 * return all available extensions
                 *
                 * @var array
                 */
                $rre = new ExactTarget_RetrieveRequestMsg();
                $rre->RetrieveRequest = $re;
                $results = $this->connection->Retrieve($rre);
                $extensions_ =$results->Results;

The result is:

stdClass Object
(
    [OverallStatus] => Error: The Request Property(s) Fields do not match with the fields of DataExtension retrieve
    [RequestID] => 7b01e972-d522-4329-a082-77e9d3015b64
)

If I delete the line ** $re->Properties[] = "Fields";** everything works as expected. This happens to many other properties in the object definition, if I request them.

2 Answers 2

1

You need the DataExtensionField objects, filtering on the DataExtension object.

0

Not all properties of an object are retrievable. I have a method to get all the properties of an object (eg. Data Extension), and use these to make a retrieve request.

private List<PropertyDefinition> getObjectRetrievableProperties(String objectType){
    ObjectDefinitionRequest odr = new ObjectDefinitionRequest();
    odr.setObjectType("DataExtension");
    DefinitionRequestMsg drm = new DefinitionRequestMsg();
    drm.setDescribeRequests(new ArrayOfObjectDefinitionRequest());
    drm.getDescribeRequests().getObjectDefinitionRequest().add(odr);
    DefinitionResponseMsg drm2 = etClient.getSoapConnection().getSoap().describe(drm);
    ObjectDefinition od = drm2.getObjectDefinition().get(0);

    List<PropertyDefinition> retrievableProperties = new ArrayList<>(od.getProperties().size());
    for(PropertyDefinition pd : od.getProperties()){
        if(pd.getIsRetrievable()){
            retrievableProperties.add(pd);
        }
    }
    return retrievableProperties;
}

You can use something like this to create a retrieve request with all retrievable properties.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .