attachEmail service date format issue

Has anyone successfully used the attachEmail service recently?
It seems the documentation expects the receivedDate and sendDate arguments to be strings. Sending a string (“2017-07-27”) results in a “[DatabaseError]Error attaching the email.” result.
The xmlrpc library automatically converts anything that looks like a datetime to an ISO date; which fails as the params no longer match the method signature.
I have existing code that sends date(“Ymd\TH:i:s”). I’m wondering if this is also failing.

I just tried an XML-RPC call to that service and was successful. My payload is attached, if you would like to see. Could you post yours as well so that I have a point of comparison to help further?

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>APIEmailService.attachEmail</methodName>
  <params>
  	<param>
      <value><string>secretapikeystring</string></value>
    </param>
    <param>
      <value><int>1</int></value>
    </param>
    <param>
      <value><string>a</string></value>
    </param>
    <param>
      <value><string>a@a.com</string></value>
    </param>
    <param>
      <value><string>b@b.com</string></value>
    </param>
    <param>
      <value><string></string></value>
    </param>
    <param>
      <value><string></string></value>
    </param>
    <param>
      <value><string>Text</string></value>
    </param>
    <param>
      <value><string>A</string></value>
    </param>
    <param>
      <value><string>A</string></value>
    </param>
    <param>
      <value><string>A</string></value>
    </param>
    <param>
      <value><string>text</string></value>
    </param>
    <param>
      <value><string>2017-07-28</string></value>
    </param>
    <param>
      <value><string>2017-07-28</string></value>
    </param>
    <param>
      <value><int>1</int></value>
    </param>
  </params>
</methodCall>

Array
(
[0] => xmlrpcval Object
(
[me] => Array
(
[string] => ee…da
)

        [mytype] => 1
        [_php_class] => 
    )

[1] => xmlrpcval Object
    (
        [me] => Array
            (
                [int] => 144
            )

        [mytype] => 1
        [_php_class] => 
    )

[2] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => Jeffrey Chimene
            )

        [mytype] => 1
        [_php_class] => 
    )

[3] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => jeff@systasis.co
            )

        [mytype] => 1
        [_php_class] => 
    )

[4] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => jeff@systasis.co
            )

        [mytype] => 1
        [_php_class] => 
    )

[5] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => 
            )

        [mytype] => 1
        [_php_class] => 
    )

[6] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => 
            )

        [mytype] => 1
        [_php_class] => 
    )

[7] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => HTML
            )

        [mytype] => 1
        [_php_class] => 
    )

[8] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => Your email finance banner (Banner 4)
            )

        [mytype] => 1
        [_php_class] => 
    )

[9] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => 

Hello …
)

        [mytype] => 1
        [_php_class] => 
    )

[10] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => 
            )

        [mytype] => 1
        [_php_class] => 
    )

[11] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => 
            )

        [mytype] => 1
        [_php_class] => 
    )

[12] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => 2017-07-27
            )

        [mytype] => 1
        [_php_class] => 
    )

[13] => xmlrpcval Object
    (
        [me] => Array
            (
                [string] => 2017-07-27
            )

        [mytype] => 1
        [_php_class] => 
    )

[14] => xmlrpcval Object
    (
        [me] => Array
            (
                [int] => 1
            )

        [mytype] => 1
        [_php_class] => 
    )

)

I’m not seeing anything immediately wrong with what you’re sending; I don’t believe it’s a date format coercion issue. Is it possible to see the generated XML from the SDK that you are actually sending to the server, so that I can send it to my internal instance to test it?

(Also, if you use three backticks around it, it makes code more readable in forum posts)

I’ll have to figure out how to get the XML from the xmlrpc library.
I think the issue is missing required fields. Let me try that now.

I’m sure this will "work from your account"
I’m interested in running it against sd108
Gives:

```<?xml version="1.0" encoding="UTF-8" ?>
<methodCall>
<methodName>APIEmailService.attachEmail</methodName>
<params>
<param>
<value><string>ee..da</string></value>
</param>
<param>
<value><int>144</int></value>
</param>
<param>
<value><string>Jeffrey Chimene</string></value>
</param>
<param>
<value><string>jeff@systasis.co</string></value>
</param>
<param>
<value><string>jeff@systasis.co</string></value>
</param>
<param>
<value><string></string></value>
</param>
<param>
<value><string></string></value>
</param>
<param>
<value><string>HTML</string></value>
</param>
<param>
<value><string>Your email finance banner (Banner 4)</string></value>
</param>
<param>
<value><string>Redacted</string></value>
</param>
<param>
<value><string>This is sample text</string></value>
</param>
<param>
<value><string>A</string></value>
</param>
<param>
<value><string>2017-07-27</string></value>
</param>
<param>
<value><string>2017-07-27</string></value>
</param>
<param>
<value><int>1</int></value>
</param>
</params>
</methodCall>

Solved: The contact ID is invalid

1 Like

Ah, sometimes it’s the small things that trip us up, no worries. Glad you got it!

1 Like