我正在寻找一个.NET (c#)包装器,用于37signals Highrise REST API。遗憾的是,我找不到任何真正合适的东西。有没有人开发了这样的东西,或者有链接可以分享?
发布于 2011-05-28 17:41:48
使用RestSharp - http://restsharp.org/
发布于 2012-04-29 11:06:24
正如一些人所建议的那样,在HighRise API中使用RestSharp非常容易。至少有一个人建议使用xsd.exe,这是我强烈反对的--这会使事情变得太复杂。相反,创建一个POCO类型,只包含您想要获取/设置的项目。如下所示:
namespace Highrise.Model
{
public class Person
{
[XmlElement("author-id")]
public string AuthorId
{
get;
set;
}
[XmlElement("background")]
public string Background
{
get;
set;
}
[XmlElement("first-name")]
public string FirstName
{
get;
set;
}
[XmlElement("last-name")]
public string LastName
{
get;
set;
}
[XmlElement("id")]
public string Id
{
get;
set;
}
}
public class People : List<Person>{}
}然后,使用RestSharp库执行get,如下所示:
// Setup our client:
var client = new RestClient("https://yourhighrisename.highrisehq.com");
client.Authenticator = new HttpBasicAuthenticator("YOUR_API_KEY_HERE", "X");
// Create our request:
var request = new RestRequest("/people.xml", Method.GET);
// Execute our request with our client:
RestResponse<People> response = (RestResponse<People>) client.Execute<People>(request);发布于 2013-03-23 11:28:16
我知道我正在复活一个老问题,但如果这对从谷歌来到这里的人有帮助(我自己在寻找同样的东西时发现了这个帖子),我为.NET Highrise API包装器创建了一个新的Github repository。
https://stackoverflow.com/questions/5651186
复制相似问题