Skip to content
JornWildt edited this page Mar 25, 2013 · 3 revisions
using System;
using Ramone;

// Define resource type
public class Cat
{
  public string Name { get; set; }
  public DateTime DateOfBirth { get; set; }
}


public static class Cats
{
  // URL template (relative to service root)
  const string CatUrlTemplate = "/cat/{name}";


  public static void GetCat()
  {
    // Create session pointing to service root
    ISession Session = RamoneConfiguration.NewSession(new Uri("http://cat-examples.com"));

    // Setup HTTP request
    Request req = Session.Bind(CatUrlTemplate, new { name = "Mike" });

    // Make actual request
    using (var resp = req.AcceptXml().Get<Cat>())
    {
      Cat c = resp.Body;
      Console.WriteLine("Cat with name={0} was born on={1:d}.", c.Name, c.DateOfBirth);
    }
  }
}