lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi Keith,
 
My server does not provide a login call.  It is using HTTP basic authentication, so I guess I can use the lua HTTP to do a basic authentication to get it to the server.  Do you think that will work?
 
Does anyone have any code example on how to do HTTP basic authentication within a Lua client? 
I would appreciate any help on getting my lua client to work.
 
Thanks alot.
 
Pete

 
On Tue, Jun 3, 2008 at 9:22 PM, Keith Pimmel <pimmel@ieee.org> wrote:
Hi Pete,

Do you have a published API with which you're trying to interact?

As an example, I used Confluence's remote API [1] with LuaXMLRPC, and
it worked fine. The Confluence API has a login call which returns a
session id string, which is used as a key in all subsequent
interactions for that session. An example code snippet follows:
--[[---------------------------------------------------------------------------------------------------------------
require'xmlrpc.http'

local server = 'http://localhost:8080/rpc/xmlrpc'
local user = 'admin'
local password = 'admin'
local space = 'cmt'

-- Login to confluence as user
local ok, token = xmlrpc.http.call(server,'confluence1.login','admin','admin')
if ok ~= true then
 error('Failed to connect to confluence server')
end

local pp = {}
ok,pp = xmlrpc.http.call(server, 'confluence1.getPage', token, space, parent)

-- etc...
---------------------------------------------------------------------------------------------------------------]]--


[1] http://confluence.atlassian.com/display/DOC/Remote+API+Specification
--
Keith Pimmel