Timothy Fong <timfong888@...>
Thanks, testing it now. Want to make sure I am sending the XML
correctly, this right? There isn't an example in the docs of just
sending a straight-up string/xml:
@response = RestClient.post
' http://www.postful.com/service/mail', @noko_xml,
{:Authorization => 'Basic
dxxxxxxxxxxxxxxxxxxxxxx='}
Archiloque wrote:
In this case you could read the file into a string before
sending it:
{:upload => {
}
},
{"Content-Type" =>
@postalcard.postalimage.content_type,
"Content-Length" =>
@postalcard.postalimage.size,
"Authorization" => 'Basic
xxxxxeeeeexxxxxx'
} # end headers
) #close arguments to Restclient.post
does it work ?
A.
Le 30 mai 2010 à 19:31, Timothy Fong a écrit :
According to the web service,
they say it is being uploaded as
multi-part, and that is messing up the file on their end.
Archiloque wrote:
Le 28 mai 2010 à 19:18, Timothy Fong a écrit :
This is how I am doing it, am I doing this right? I get a 200 response,
but still issues.
@response = RestClient.post('http://www.postful.com/service/upload',
{:upload => {
:file =>
File.new("#{@postalcard.postalimage.path}",'rb')
}
},
{"Content-Type" =>
@postalcard.postalimage.content_type,
"Content-Length" => @postalcard.postalimage.size,
"Authorization" => 'Basic xxxxxeeeeexxxxxx'
} # end headers
) #close arguments to Restclient.post
It seems good, what specific issue do you have ?
A.
|
|
You can specify the content-type as xml, see the json example that should be close to what you need.
A.
toggle quoted messageShow quoted text
Le 31 mai 2010 à 04:07, Timothy Fong < timfong888@...> a écrit :
Thanks, testing it now. Want to make sure I am sending the XML
correctly, this right? There isn't an example in the docs of just
sending a straight-up string/xml:
@response = RestClient.post
' http://www.postful.com/service/mail', @noko_xml,
{:Authorization => 'Basic
dxxxxxxxxxxxxxxxxxxxxxx='}
Archiloque wrote:
In this case you could read the file into a string before
sending it:
{:upload => {
}
},
{"Content-Type" =>
@postalcard.postalimage.content_type,
"Content-Length" =>
@postalcard.postalimage.size,
"Authorization" => 'Basic
xxxxxeeeeexxxxxx'
} # end headers
) #close arguments to Restclient.post
does it work ?
A.
Le 30 mai 2010 à 19:31, Timothy Fong a écrit :
According to the web service,
they say it is being uploaded as
multi-part, and that is messing up the file on their end.
Archiloque wrote:
Le 28 mai 2010 à 19:18, Timothy Fong a écrit :
This is how I am doing it, am I doing this right? I get a 200 response,
but still issues.
@response = RestClient.post('http://www.postful.com/service/upload',
{:upload => {
:file =>
File.new("#{@postalcard.postalimage.path}",'rb')
}
},
{"Content-Type" =>
@postalcard.postalimage.content_type,
"Content-Length" => @postalcard.postalimage.size,
"Authorization" => 'Basic xxxxxeeeeexxxxxx'
} # end headers
) #close arguments to Restclient.post
It seems good, what specific issue do you have ?
A.
|
|
Tim Fong <timfong888@...>
Okay, thanks. The example in the restclient.rb for xml didn't show a content-type, just xml_doc as the body without any headers or options so wasn't clear, let me try that....does that need to be corrected in the restclient.rb comments or does that still work but under a different situation?
toggle quoted messageShow quoted text
On Mon, 31 May 2010, Archiloque wrote: You can specify the content-type as xml, see the json example that should be close to what you need. A. Le 31 mai 2010 à 04:07, Timothy Fong <timfong888@...> a écrit :
Thanks, testing it now. Want to make sure I am sending the XML correctly, this right? There isn't an example in the docs of just sending a straight-up string/xml:
@response = RestClient.post 'http://www.postful.com/service/mail', @noko_xml, {:Authorization => 'Basic dxxxxxxxxxxxxxxxxxxxxxx='}
Archiloque wrote: In this case you could read the file into a string before sending it: @response = RestClient.post('http://www.postful.com/service/upload', {:upload => { :file => IO.read("#{@postalcard.postalimage.path}") } }, {"Content-Type" => @postalcard.postalimage.content_type, "Content-Length" => @postalcard.postalimage.size, "Authorization" => 'Basic xxxxxeeeeexxxxxx' } # end headers ) #close arguments to Restclient.post does it work ? A. Le 30 mai 2010 à 19:31, Timothy Fong a écrit :
According to the web service, they say it is being uploaded as multi-part, and that is messing up the file on their end.
Archiloque wrote: Le 28 mai 2010 à 19:18, Timothy Fong a écrit :
This is how I am doing it, am I doing this right? I get a 200 response, but still issues.
@response = RestClient.post('http://www.postful.com/service/upload', {:upload => { :file => File.new("#{@postalcard.postalimage.path}",'rb') } }, {"Content-Type" => @postalcard.postalimage.content_type, "Content-Length" => @postalcard.postalimage.size, "Authorization" => 'Basic xxxxxeeeeexxxxxx' } # end headers ) #close arguments to Restclient.post It seems good, what specific issue do you have ? A.
-- #end Timothy Fong To connect with me, find times on my Timebridge: http://meetwith.me/timfong -- #end Timothy Fong To connect with me, find times on my Timebridge: http://meetwith.me/timfong
|
|
Timothy Fong <timfong888@...>
What is the format, in the example, there's a "," but it only takes
three arguments, the headers options being in {}.
When I do the following based on the example, it wonks out:
@response = RestClient.post ' http://www.postful.com/service/mail',
@noko_xml, :content_type => :xml,
{:Authorization => 'Basic
dGltZm9uZzg4OEBnbWFpbC5jb206ZDlQcTVKUU4='}
Archiloque wrote:
You can specify the content-type as xml, see the json example
that should be close to what you need.
Thanks, testing it now. Want to make sure I am sending the
XML
correctly, this right? There isn't an example in the docs of just
sending a straight-up string/xml:
@response = RestClient.post
' http://www.postful.com/service/mail',
@noko_xml,
{:Authorization => 'Basic
dxxxxxxxxxxxxxxxxxxxxxx='}
Archiloque wrote:
In this case you could read the file into a string before
sending it:
{:upload => {
}
},
{"Content-Type" =>
@postalcard.postalimage.content_type,
"Content-Length" =>
@postalcard.postalimage.size,
"Authorization" => 'Basic
xxxxxeeeeexxxxxx'
} # end headers
) #close arguments to Restclient.post
does it work ?
A.
Le 30 mai 2010 à 19:31, Timothy Fong a écrit :
According to the web
service,
they say it is being uploaded as
multi-part, and that is messing up the file on their end.
Archiloque wrote:
Le 28 mai 2010 à 19:18, Timothy Fong a écrit :
This is how I am doing it, am I doing this right? I get a 200 response,
but still issues.
@response = RestClient.post('http://www.postful.com/service/upload',
{:upload => {
:file =>
File.new("#{@postalcard.postalimage.path}",'rb')
}
},
{"Content-Type" =>
@postalcard.postalimage.content_type,
"Content-Length" => @postalcard.postalimage.size,
"Authorization" => 'Basic xxxxxeeeeexxxxxx'
} # end headers
) #close arguments to Restclient.post
It seems good, what specific issue do you have ?
A.
|
|
Timothy Fong <timfong888@...>
Hi, I dug in and am now trying the following:
@response = RestClient.post ' http://www.postful.com/service/mail',
@noko_xml,
{:content_type =>
"application/xhtml+xml",
:Authorization => 'Basic
dGltZm9uZzg4OEBnbWFpbC5jb206ZDlQcTVKUU4='
}
Archiloque wrote:
You can specify the content-type as xml, see the json example
that should be close to what you need.
Thanks, testing it now. Want to make sure I am sending the
XML
correctly, this right? There isn't an example in the docs of just
sending a straight-up string/xml:
@response = RestClient.post
' http://www.postful.com/service/mail',
@noko_xml,
{:Authorization => 'Basic
dxxxxxxxxxxxxxxxxxxxxxx='}
Archiloque wrote:
In this case you could read the file into a string before
sending it:
{:upload => {
}
},
{"Content-Type" =>
@postalcard.postalimage.content_type,
"Content-Length" =>
@postalcard.postalimage.size,
"Authorization" => 'Basic
xxxxxeeeeexxxxxx'
} # end headers
) #close arguments to Restclient.post
does it work ?
A.
Le 30 mai 2010 à 19:31, Timothy Fong a écrit :
According to the web
service,
they say it is being uploaded as
multi-part, and that is messing up the file on their end.
Archiloque wrote:
Le 28 mai 2010 à 19:18, Timothy Fong a écrit :
This is how I am doing it, am I doing this right? I get a 200 response,
but still issues.
@response = RestClient.post('http://www.postful.com/service/upload',
{:upload => {
:file =>
File.new("#{@postalcard.postalimage.path}",'rb')
}
},
{"Content-Type" =>
@postalcard.postalimage.content_type,
"Content-Length" => @postalcard.postalimage.size,
"Authorization" => 'Basic xxxxxeeeeexxxxxx'
} # end headers
) #close arguments to Restclient.post
It seems good, what specific issue do you have ?
A.
|
|