2

Resolved

campaignUnsubscribes

description

Getting a -1: Failed to deserialize data on campaignUnsubscribes.
 
It's trying to read into MCList<string>, but the data is in a struct, so deserialize returns the error "ReadElementContentAs() methods cannot be called on an element that has child elements." XML looks like
 
<data type="array">
    <struct key="0" type="array">
        <email type="string">[email]</email>
        <reason type="NULL" />
        <reason_text type="NULL" />
    </struct>

comments

jgrine wrote Mar 11, 2011 at 6:36 PM

This fixed it:

//------------------------------------------------------------------------------
// (*) Unsubscribes
//------------------------------------------------------------------------------
    [<DataContract(Namespace = "")>]
    type Unsubscribe =
      { [<field: DataMember(Name = "email")>]
        Email: string;
        [<field: DataMember(Name = "reason")>]
        Reason: string; 
        [<field: DataMember(Name = "reason_text")>]
        ReasonText: string;}

    [<DataContract(Name = "MCAPI", Namespace = "")>]
    type Unsubscribes =
      { [<field: DataMember(Name = "total")>]
        Total: int;
        [<field: DataMember(Name = "data")>]
        Data: MCList<Unsubscribe> }
(This is a great wrapper. I can't believe how easy that was.)

denisk1981 wrote Mar 12, 2011 at 8:46 AM

wrote Mar 12, 2011 at 5:25 PM

wrote Mar 12, 2011 at 5:26 PM

wrote Feb 21, 2013 at 10:44 PM

wrote May 16, 2013 at 10:23 AM

wrote May 16, 2013 at 10:23 AM

wrote Jun 14, 2013 at 7:23 AM