Developer Center

Approver.com Developer Center > Developer Documentation > C# Code Examples

GetDocument List - C# Example

This code retrieves the list of a user's documents.

// Compile from the command line:  csc GetDocumentListExample.cs
 
using System;
using System.IO;
using System.Net;
using System.Xml;
 
public class GetDocumentListExample
{
    private const String API_ENDPOINT = "http://api.approver.com/v1/";
 
    // TODO: Change these constants to values that work for you.
    private const String APP_KEY = "bwhjdwvzysulefguwmfqlditbfbkhe";
    private const String TOKEN = "uhdikfyrmghwvsrxrwhe";
 
    public static void Main()
    {
        XmlDocument xd = new XmlDocument();
        xd.Load(API_ENDPOINT + "getDocumentList.aspx?app_key=" + APP_KEY + "&token=" + TOKEN);
        XmlNodeList docs = xd.SelectNodes("/documents/document");
 
        if (docs.Count == 0)
        {
            Console.WriteLine("This user has no actionable documents.");
        }
 
        foreach (XmlNode doc in docs)
        {
            Console.WriteLine(doc.SelectSingleNode("name").InnerText);
        }
    }
}