You are not logged in.

Announcement

Bonjour, avant de poster, merci de vérifier que vous avez respecté les pré-requis de l'installation et consultez notre documentation : http://docs.blue-mind.net !

Hi, before posting on the forum, please check that you followed installation prerequisites and get a look to our documentation space : http://docs.blue-mind.net

#1 2013-06-26 09:57:51

ebougerolle
Member
From: Auxerre
Registered: 2013-06-18
Posts: 198

Exemple API - RUBY (Comptage des mail non lu)

Un petit exemple d'utilisation de l'API en Ruby.

# ruby 1.9.3p392 
# gem install savon

require 'savon'
 
client = Savon.client(wsdl: "http://soap.domain.tld:/soap/proxy?wsdl")

response = client.call(:login, message: {arg0: 'admin0@global.virt', arg1: 'password/apikey', arg2: 'ruby'})
token = response.body[:login_response][:return].to_hash

response = client.call(:sudo, message: {arg0: token, arg1: 'jdoe@domain.tld'} )
user = response.body[:sudo_response][:return].to_hash

nbmails = client.call(:get_unread_mail_count, message: {arg0: user} )
puts "Unread emails : #{nbmails.body[:get_unread_mail_count_response][:return]}"  

client.call(:logout, message: {arg0: token})
puts "Logout"

Last edited by ebougerolle (2013-06-28 10:29:58)


Département de l'Yonne

Offline

Board footer

Powered by FluxBB