Action API

Overview

With the Agendize Action API, you can execute any Agendize action programmatically, bypassing the default widgets and dialog boxes. With it, you can easily integrate Agendize features into your application, website or banner ad with your own user interface.

Request

Authentication

To use the Data API you must authenticate yourself using your Agendize email and password. See the authentication documentation for details on the authentication mechanisms available and how to use them.

Click-to-Call

URL Format:
https://www.agendize.com/api/1.0/action?media=call&<query parameters>
Parameters:
Name Description Required Values
key API Key Y No API Key? Get one here
id Button ID Y  
phone User phone number Y In international format (+xxxxxxxxxxxxx)
delay Delay period N How long to wait before initiating call, in minutes
Response :

Example:

<?xml version="1.0" encoding="UTF-8"?>

	200

Send by SMS/Text Message

URL Format:
https://www.agendize.com/api/1.0/action?media=sms&<query parameters>
Parameters:
Name Description Required Values
key API Key Y No API Key? Get one here
id Button ID Y  
phone User phone number Y In international format (+xxxxxxxxxxxxx)
message Additional user message N  
Response :

Example:

<?xml version="1.0" encoding="UTF-8"?>

	200

Code Sample
Java
import java.net.*;
import java.io.*;
import javax.xml.parsers.*; 
import org.w3c.dom.*; 
import org.xml.sax.*; 

public class SendSMS
{
	public static void main(String[] args) throws Exception
	{    
		URL url = new URL("http://www.agendize.com/api/1.0/action?media=sms&key=452987fa58654eb7448744a7&id=123456&phone=+1555785998");
        
		String myUsername = "john.smith@acme.com";
		String myPassword = "password";
        
		String userPassword = myUsername + ":" + myPassword;
		String encoding = new sun.misc.BASE64Encoder().encode (userPassword.getBytes());

		URLConnection urlConnection = url.openConnection();
		urlConnection.setRequestProperty("Authorization", "Basic " + encoding);
       
		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();			
		DocumentBuilder build = factory.newDocumentBuilder();
						
		Document doc = build.parse(urlConnection.getInputStream());
			
		NodeList nodeList = doc.getElementsByTagName("result");
			
		if (nodeList.getLength() > 0)
		{
			int code = Integer.parseInt(nodeList.item(0).getFirstChild().getNodeValue());
				
			System.out.println("return code: " + code);
		}		
	}
}
		
Get Code
PHP
<?php
	// Set the authentication and the http request in GET method
	$context = stream_context_create(array( 
		'http' => array( 
		  'method'  => 'GET', 
		  'header'  => sprintf("Authorization: Basic %s\r\n", base64_encode('myusername:mypassword')). 
					   "Content-type: application/x-www-form-urlencoded\r\n",
		  'timeout' => 5, 
		), 
	  )); 
	
	// Make the connection
	$xmlResult = file_get_contents('http://www.agendize.com/api/1.0/action?media=sms&key=3ac024abf8c72460764b965199f81808f4cb08&id=142514&phone=+33611111111 ', false, $context);
	// Retrieve AgendiZe response code obtained by searching in the parsed xml content
	$dom = new DomDocument();
	$dom->loadXML($xmlResult);
	$result = $dom->getElementsByTagName('result')->item(0);
	echo $result->nodeValue;
?>
		
Get Code
Python
import urllib.request
import urllib.error
import urllib.parse
import xml.dom.minidom
from xml.dom.minidom import parse, parseString

theurl = "http://www.agendize.com/api/1.0/action?media=sms&key=3ac024abf8c72460764b965199f81808f4cb08&id=142514&phone=+33611111111"

# Build password manager by setting th parameter "realm" as default
password_mgr = urllib.request.HTTPPasswordMgrWithDefaultRealm()
# Add a passwword to our password manager
password_mgr.add_password(None, theurl, "myusername", "mypassword")
# Create our HTML request manager by activing authentication
handler = urllib.request.HTTPBasicAuthHandler(password_mgr)
# Build the opener using our request manager
opener = urllib.request.build_opener(handler)
# Install the opener to be efficient
urllib.request.install_opener(opener)
# Make the connection 
handle = urllib.request.urlopen(theurl)
# Convert in string
chaineResultat = bytes.decode(handle.read())

# Retrieve AgendiZe response code obtained by searching in the parsed xml content
dom = parseString(chaineResultat)
element = dom.getElementsByTagName("result")[0]
print(element.childNodes[0].data)
    
		
Get Code
Ruby
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
require 'rexml/document'
include REXML

url = '/api/1.0/action?media=sms&key=3ac024abf8c72460764b965199f81808f4cb08&id=424581&phone=+33611111111'
xmlContent = ''
Net::HTTP.start('www.agendize.com') {|http|
		req = Net::HTTP::Get.new(url)
		req.basic_auth('myusername','mypassword')
		response = http.request(req)
		xmlContent = response.body
	}
#Analyze the xml content and display the response code
doc = Document.new(xmlContent)
root = doc.root
puts root.elements[1].text

		
Get Code
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
using System.Xml;

namespace SendSMS
{
    class SendSMS
    {
        static void Main(string[] args)
        {
            // The url for sending SMS
            string url = "http://www.agendize.com/api/1.0/action?media=sms&key=3ac024abf8c72460764b965199f81808f5dc19&id=142514&phone=+33611111111";
            // Establish the request
            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

            // set the authentication
            string authInfo = "myusername:mypassword";
            authInfo = Convert.ToBase64String(Encoding.Default.GetBytes(authInfo));
            req.Headers["Authorization"] = "Basic " + authInfo;

            // Set properties
            req.Timeout = 5000;     // 5 secs

            // Retrieve request info headers
            HttpWebResponse webResponse = (HttpWebResponse)req.GetResponse();
            Encoding enc = Encoding.GetEncoding(1252);  // Windows default Code Page
            StreamReader responseStream = new StreamReader(webResponse.GetResponseStream(), enc);
            string xmlContent = responseStream.ReadToEnd();
                        
            webResponse.Close();
            responseStream.Close();
            
            // Retrieve AgendiZe response code obtained by searching in the parsed xml content
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.LoadXml(xmlContent);
            XmlNodeList listeNoeud = xmlDoc.GetElementsByTagName("result");
            // Display the response code
            Console.WriteLine(listeNoeud.Item(0).InnerText);

        }
    }
}
		
Get Code
C++/CLI
#include "stdafx.h"

using namespace System::Xml;
using namespace System::Text;
using namespace System;

int main(array<System::String ^> ^args)
{
	String ^url = "http://www.agendize.com/api/1.0/action?media=sms&key=3ac024abf8c72460764b965199f81808f4cb08&id=424581&phone=+33611111111";
    //authentication
	System::Net::NetworkCredential^ myCred = gcnew System::Net::NetworkCredential("myusername","mypassword");
	System::Net::CredentialCache^ myCache = gcnew System::Net::CredentialCache;
	myCache->Add( gcnew Uri( url ), "Basic", myCred );
		
	System::Net::HttpWebRequest ^_HttpWebRequest = safe_cast<System::Net::HttpWebRequest^>(System::Net::HttpWebRequest::Create(url));
	_HttpWebRequest->Credentials = myCache;
	_HttpWebRequest->AllowWriteStreamBuffering = true;
	// set timeout for 15 seconds 
	_HttpWebRequest->Timeout = 15000;
	// Request response:
	System::Net::WebResponse ^_WebResponse = _HttpWebRequest->GetResponse();
	// Open data stream:
	System::IO::Stream ^_WebStream = _WebResponse->GetResponseStream();
	// Read the data stream
	System::IO::StreamReader ^sreader = gcnew System::IO::StreamReader(_WebStream);
	String ^xmlContent = sreader->ReadToEnd();
	
	// Cleanup
	_WebStream->Close();
	_WebResponse->Close();

	// Analyze the xml content and display the response code
	XmlDocument ^ xmlDoc = gcnew XmlDocument();
	xmlDoc->LoadXml(xmlContent);
	XmlNodeList ^ nodes = xmlDoc->GetElementsByTagName("result");

	Console::WriteLine(nodes->Item(0)->InnerText);
    Console::ReadLine();
	return 0;
}

		
Get Code
Visual Basic .NET
Imports System.Net
Imports System.IO
Imports WinHttp

Module Module1

    Sub Main()
        Dim url = "http://www.agendize.com/api/1.0/action?media=sms&key=3ac024abf8c72460764b965199f81808f4cb08&id=424581&phone=+33611111111"
        ' Assemble an HTTP request.
        Dim WinHttpReq = New WinHttpRequest
		WinHttpReq.Open("GET", url, False)
        ' Set the user name and password.
        WinHttpReq.SetCredentials("myusername","mypassword", 0)
        ' Send the HTTP Request.
        WinHttpReq.Send()
        ' Return the response.
        Dim xmlContent = WinHttpReq.ResponseText
        ' Analyzes the xml content and return the response code
        Dim domDoc As Xml.XmlDocument
        domDoc = New Xml.XmlDocument
        domDoc.LoadXml(xmlContent)
        Console.WriteLine(domDoc.GetElementsByTagName("result").Item(0).InnerText)
    End Sub

End Module

		
Get Code

Send by Email

URL Format:
https://www.agendize.com/api/1.0/action?media=email&<query parameters>
Parameters:
Name Description Required Values
key API Key Y No API Key? Get one here
id Button ID Y  
email Recipient email address Y  
email-from Sender email address N  
sender-name -actions.sender- N  
message Additional user message N  
Response :

Example:

<?xml version="1.0" encoding="UTF-8"?>

	200

Send by Instant Message

URL Format:
https://www.agendize.com/api/1.0/action?media=messengers&<query parameters>
Parameters:
Name Description Required Values
key API Key Y No API Key? Get one here
id Button ID Y  
contact Recipient messenging account ID Y  
messenger Instant messaging service Y 7 : Windows Live Messenger
2 : Yahoo! Messenger
3: AOL Messenger (AIM)
4: ICQ
5: Google Talk
message Additional user message N  
Response :

Example:

<?xml version="1.0" encoding="UTF-8"?>

	200

Save to Address Book/Save to Calendar

URL Format:
https://www.agendize.com/api/1.0/action?media=pim&<query parameters>
Parameters:
Name Description Required Values
key API Key Y No API Key? Get one here
id Button ID Y  
pim Address book/calendar software Y oultook, oexpress, notes, ical
Response :

Example:

<?xml version="1.0" encoding="UTF-8"?>

	200

Comment & Rate

URL Format:
https://www.agendize.com/api/1.0/action?media=testimonials&<query parameters>
Parameters:
Name Description Required Values
key API Key Y No API Key? Get one here
id Button ID Y  
email Commenter email address Y  
login Commenter nickname N  
message Comment text N  
rating Rating Y 1 to 5
Response :

Example:

<?xml version="1.0" encoding="UTF-8"?>

	200

Save to Desktop

URL Format:
https://www.agendize.com/api/1.0/action?media=desktop&<query parameters>
Parameters:
Name Description Required Values
key API Key Y No API Key? Get one here
id Button ID Y  
format File format Y pdf, rtf
Response :

Example:

<?xml version="1.0" encoding="UTF-8"?>

	200

Save to Blog

URL Format:
https://www.agendize.com/api/1.0/action?media=blog&<query parameters>
Parameters:
Name Description Required Values
key API Key Y No API Key? Get one here
id Button ID Y  
service Blog service Y wordpress, dotclear, livejournal, blogger
login Blog username or email address Y
password Blog user password Y
url Blog service URL N
ptitle Post title Y
Response :

Example:

<?xml version="1.0" encoding="UTF-8"?>

	200