Communicate with server using PUT

Phil Davis revdev at pdslabs.net
Thu Jun 27 00:59:22 EDT 2013


On 6/26/13 7:45 PM, J. Landman Gay wrote:
> On 6/26/13 9:09 PM, Peter W A Wood wrote:
>> Jacque
>>
>> On 27 Jun 2013, at 09:33, J. Landman Gay wrote:
>>
>>> That's how I first started, using "put", but I think I had the
> content wrong. What goes into "theData"? In this case, the parameter
> values are the data. Should I just do "put empty into url http://blah 
> blah"?
>
>> I didn't think that the HTTP specification allowed for query strings
>> with the POST or PUT methods. If they do, it is most unusual. Have
>> you tried putting the query string (without the ?) into theData and
>> removing it from the url?
>
> A browser can send http URLs with query strings, and I think that's a 
> PUT. 

It's a GET. If you try this, you'll see " $REQUEST_METHOD = GET":
     http://pdslabs.net/rev/globals.cgi?first=1&second=2

That's all I have.  :-)

Phil


> When using POST we format the content as query strings too, and I have 
> that working. But I wondered the same thing about PUT, so I was 
> originally putting the values into theData. That didn't work so I 
> tried it Trevor's way. I get errors in either case. The URL does 
> exist, Rails can PUT to it and get data back, so I'm not sure about 
> the 404 error. Error 401 is a bad format error.
>
> So far, I've tried:
>
> put "value1=one&value2=two" into tData
> put tData into url "http://domain.com/page.xxx
>   -> result: Error 401
>   -> urlResponse: empty
>
> put "test" into url "http://domain.com/page.xxx?value1=one&value2=two"
> (also tried putting empty into the same URL)
>   -> result: Error 401
>   -> urlResponse: empty
>
> get url "http://domain.com/page.xxx?value1=one&value2=two"
>   -> "it": Error 404
>
> There may be something wrong with my actual parameters. Some of them 
> are bracketed like this:
>
> thing[id]=1234&thing[name]=Sally
>
> But it seems like that shouldn't matter.
>

-- 
Phil Davis




More information about the use-livecode mailing list