Loading ...
Sorry, an error occurred while loading the content.

Re: Attachment upload/download

Expand Messages
  • paultackett
    ... ID, ... message ... I ... making ... Fri ... I haven t heard any responses on this and have not been able to get this to work. Has anyone been able to get
    Message 1 of 10 , Aug 2, 2007
    • 0 Attachment
      --- In ydn-mail@yahoogroups.com, "paultackett" <paultackett@...>
      wrote:
      >
      > --- In ydn-mail@yahoogroups.com, "Ryan Kennedy" <rckenned@> wrote:
      > >
      > > --- In ydn-mail@yahoogroups.com, "paultackett" <paultackett@>
      wrote:
      > > >
      > > > I have tried to use the upload/download endpoint url and I keep
      > getting
      > > > a 502 error. Am I using the correct url's h
      > > > (ttp://mail.yahooapis.com/ya/download,
      > > > http://mail.yahooapis.com/ya/upload). For the upload, it looks
      > like
      > > > all I need to do is post with a value for the filename. Am I
      > missing
      > > > something?
      > >
      > > Did you also include all of the authentication bits (application
      ID,
      > > WSSID, Y cookie)? Is the 502 all you got back or was there a
      message
      > > in the response body?
      > >
      > > Ryan Kennedy
      > > Yahoo! Mail Web Service
      > >
      > I was not passing the authentication data so that was a problem.
      > Now, when I try to download I just get nothing back. No error no
      > data, nothing. On the upload I am able to get a response but it is
      > missing the id. Please take a look at my request and the response
      I
      > am getting to see if you can find a problem with the way I am
      making
      > my call.
      >
      > Request:
      >
      > {"method":"UploadAttachment","params":[{"uploadfile":"http:\/
      > \/mywebserver.com\/attachments\/testfile.txt"}]}
      >
      > Response:
      >
      > <?xml version="1.0" encoding="UTF-8"?>
      > <Response>
      > </Response><!-- web55415.mail.re4.yahoo.com uncompressed/chunked
      Fri
      > Jul 6 12:37:30 PDT 2007 -->
      >
      I haven't heard any responses on this and have not been able to get
      this to work. Has anyone been able to get the upload download
      functionality to work?
    • Ryan Kennedy
      ... Paul: you need to do it like a normal file upload. Attachment uploading isn t handled via the standard RPC (SOAP or JSON-RPC) interface.
      Message 2 of 10 , Aug 13, 2007
      • 0 Attachment
        --- In ydn-mail@yahoogroups.com, "paultackett" <paultackett@...> wrote:
        > I haven't heard any responses on this and have not been able to get
        > this to work. Has anyone been able to get the upload download
        > functionality to work?

        Paul:

        you need to do it like a normal file upload. Attachment uploading
        isn't handled via the standard RPC (SOAP or JSON-RPC) interface.

        http://developer.yahoo.com/mail/docs/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=yMail&file=UploadAttachment.26.1.html

        Someone else brought up the "resulturl" field. Ignore it. That's an
        artifact of how the web service is used internally.

        Ryan Kennedy
        Yahoo! Mail Web Service
      • paultackett
        ... get ... http://developer.yahoo.com/mail/docs/html/wwhelp/wwhimpl/common/html/w whelp.htm?context=yMail&file=UploadAttachment.26.1.html ... Ryan, I
        Message 3 of 10 , Aug 13, 2007
        • 0 Attachment
          --- In ydn-mail@yahoogroups.com, "Ryan Kennedy" <rckenned@...> wrote:
          >
          > --- In ydn-mail@yahoogroups.com, "paultackett" <paultackett@> wrote:
          > > I haven't heard any responses on this and have not been able to
          get
          > > this to work. Has anyone been able to get the upload download
          > > functionality to work?
          >
          > Paul:
          >
          > you need to do it like a normal file upload. Attachment uploading
          > isn't handled via the standard RPC (SOAP or JSON-RPC) interface.
          >
          >
          http://developer.yahoo.com/mail/docs/html/wwhelp/wwhimpl/common/html/w
          whelp.htm?context=yMail&file=UploadAttachment.26.1.html
          >
          > Someone else brought up the "resulturl" field. Ignore it. That's an
          > artifact of how the web service is used internally.
          >
          > Ryan Kennedy
          > Yahoo! Mail Web Service
          >
          Ryan,

          I understand what you are saying and I have done this. When I post I
          get an xml response like the following:

          <?xml version="1.0" encoding="UTF-8" ?>
          <Response />
          - <!-- web55411.mail.re4.yahoo.com uncompressed/chunked Mon Aug 13
          12:41:27 PDT 2007
          -->

          There is no error, but there is also no attachment info like the ID.
          Below is the code I am using so you can see how I am making the call.

          $AttachURL = "http://mail.yahooapis.com/ya/upload?
          appid=".APPID."&WSSID=".$sWSSID;
          $postdata = array('uploadfile'
          => 'http://www.webserver.com/test.txt');
          $ch = curl_init($AttachURL);
          curl_setopt ($ch, CURLOPT_POST, true);
          curl_setopt ($ch, CURLOPT_POSTFIELDS, $postdata);
          curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:
          application/x-www-form-urlencoded", "Cookie: ".$sCookie));
          curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
          $response = curl_exec( $ch );
        • Ryan Kennedy
          ... I don t think this is doing what you think it s doing: 1) I m not sure if cURL will upload from a URL. 2) Uploading a file using cURL requires you to put
          Message 4 of 10 , Aug 13, 2007
          • 0 Attachment
            --- In ydn-mail@yahoogroups.com, "paultackett" <paultackett@...> wrote:
            > $postdata = array('uploadfile'
            > => 'http://www.webserver.com/test.txt');

            I don't think this is doing what you think it's doing:

            1) I'm not sure if cURL will upload from a URL.

            2) Uploading a file using cURL requires you to put an '@' in front of
            the filename to be uploaded.

            So...I'd try putting the '@' in front of the URL. If that doesn't
            work, you'll probably have to put that file on the local filesystem
            and use the local file path instead of a URL to upload the file.

            I think what's happening in this case is that you're not actually
            uploading any files. So the upload handler doesn't see an error but it
            also doesn't see any uploaded files (although, you could say the lack
            of any files sent to the upload handler is an error).

            Ryan Kennedy
            Yahoo! Mail Web Service
          • paultackett
            ... of ... it ... lack ... Yes, that was the problem. I am now able to get the ID so that I can send a message. When I do this, I have another problem.
            Message 5 of 10 , Aug 14, 2007
            • 0 Attachment
              --- In ydn-mail@yahoogroups.com, "Ryan Kennedy" <rckenned@...> wrote:
              >
              > --- In ydn-mail@yahoogroups.com, "paultackett" <paultackett@> wrote:
              > > $postdata = array('uploadfile'
              > > => 'http://www.webserver.com/test.txt');
              >
              > I don't think this is doing what you think it's doing:
              >
              > 1) I'm not sure if cURL will upload from a URL.
              >
              > 2) Uploading a file using cURL requires you to put an '@' in front
              of
              > the filename to be uploaded.
              >
              > So...I'd try putting the '@' in front of the URL. If that doesn't
              > work, you'll probably have to put that file on the local filesystem
              > and use the local file path instead of a URL to upload the file.
              >
              > I think what's happening in this case is that you're not actually
              > uploading any files. So the upload handler doesn't see an error but
              it
              > also doesn't see any uploaded files (although, you could say the
              lack
              > of any files sent to the upload handler is an error).
              >
              > Ryan Kennedy
              > Yahoo! Mail Web Service
              >
              Yes, that was the problem. I am now able to get the ID so that I can
              send a message. When I do this, I have another problem. Please take
              a look at my request and the response I get. Thanks!

              Request:
              object(stdClass)(2) {
              ["method"]=>
              string(11) "SendMessage"
              ["params"]=>
              array(1) {
              [0]=>
              object(stdClass)(2) {
              ["savecopy"]=>
              bool(true)
              ["message"]=>
              object(stdClass)(4) {
              ["to"]=>
              object(stdClass)(1) {
              ["email"]=>
              string(22) "test2@..."
              }
              ["from"]=>
              object(stdClass)(1) {
              ["email"]=>
              string(21) "test1@..."
              }
              ["subject"]=>
              string(4) "test"
              ["simplebody"]=>
              object(stdClass)(2) {
              ["html"]=>
              string(9) "test body"
              ["attachment"]=>
              object(stdClass)(1) {
              ["attachment"]=>
              string(45) "uploadfile://c9ad65400d9af577d17425f0c48e40c6"
              }
              }
              }
              }
              }
              }

              Response:
              Cannot locate AttachmentSource for protocol "uploadfile"
            • Ryan Kennedy
              ... Ah...so close. ;) http://developer.yahoo.com/mail/docs/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=yMail&file=DataTypes.27.1.html#1572777 Try
              Message 6 of 10 , Aug 14, 2007
              • 0 Attachment
                --- In ydn-mail@yahoogroups.com, "paultackett" <paultackett@...> wrote:
                > object(stdClass)(1) {
                > ["attachment"]=>
                > string(45) "uploadfile://c9ad65400d9af577d17425f0c48e40c6"
                > }
                >
                > Response:
                > Cannot locate AttachmentSource for protocol "uploadfile"

                Ah...so close. ;)

                http://developer.yahoo.com/mail/docs/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=yMail&file=DataTypes.27.1.html#1572777

                Try "upload://upload id" instead.

                Ryan Kennedy
                Yahoo! Mail Web Service
              • paultackett
                ... (45) uploadfile://c9ad65400d9af577d17425f0c48e40c6 ... http://developer.yahoo.com/mail/docs/html/wwhelp/wwhimpl/common/html/w
                Message 7 of 10 , Aug 15, 2007
                • 0 Attachment
                  --- In ydn-mail@yahoogroups.com, "Ryan Kennedy" <rckenned@...> wrote:
                  >
                  > --- In ydn-mail@yahoogroups.com, "paultackett" <paultackett@> wrote:
                  > > object(stdClass)(1) {
                  > > ["attachment"]=>
                  > > string
                  (45) "uploadfile://c9ad65400d9af577d17425f0c48e40c6"
                  > > }
                  > >
                  > > Response:
                  > > Cannot locate AttachmentSource for protocol "uploadfile"
                  >
                  > Ah...so close. ;)
                  >
                  >
                  http://developer.yahoo.com/mail/docs/html/wwhelp/wwhimpl/common/html/w
                  whelp.htm?context=yMail&file=DataTypes.27.1.html#1572777
                  >
                  > Try "upload://upload id" instead.
                  >
                  > Ryan Kennedy
                  > Yahoo! Mail Web Service
                  >
                  It's always the little things. This did work. Thank you!
                Your message has been successfully submitted and would be delivered to recipients shortly.