scottschluer / highrise-api Goto Github PK
View Code? Open in Web Editor NEW.NET wrapper for 37 Signals Highrise API
License: MIT License
.NET wrapper for 37 Signals Highrise API
License: MIT License
Not sure if it is just me, but I'm it seems that Instant Messengers are not uploaded to Highrise, for example, the following code compiles and returns HTTP OK, but the Instant Messenger item is not created:
HighriseApi.ApiRequest api = new HighriseApi.ApiRequest("username", "token");
var person = api.PersonRequest.Get(171257595);
InstantMessenger im = new InstantMessenger();
im.Address = "blahblah";
im.Location = "Personal";
im.Protocol = "MSN";
person.ContactData.InstantMessengers.Add(im);
person = api.PersonRequest.Update(person);
This happens on both the Person and Company class.
Environment: .NET 4.5 in VS2013
Requests captured using Fiddler
Possible (nasty?) fix: Make Company.CreatedAt
a DateTime?
instead of a DateTime
(however see note at the end).
Issue: After updating a company using the code below, the final request to get a list of companies fails, if the updated company is in the block of companies requested
company.Tags.Add(newTag);
company.Tags.Add(oldTag);
api.CompanyRequest.Update(company);
api.CompanyRequest.Get(offset:(int?)currentBlock); // now this fails
Diagnosis:
RestSharp is actually the component throwing the exception. The company is updated with a value in the PUT of <created-at>30/05/2014 14:07:07</created-at>
(for example), but is then returned in the GET xml with <created-at type="datetime" nil="true"></created-at>
. The nil DateTime appears to then throw an exception within RestSharp:
Message: "String was not recognized as a valid DateTime."
Stacktrace: at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.DateTime.Parse(String s, IFormatProvider provider)
at RestSharp.Deserializers.XmlDeserializer.Map(Object x, XElement root)
at RestSharp.Deserializers.XmlDeserializer.CreateAndMap(Type t, XElement element)
at RestSharp.Deserializers.XmlDeserializer.PopulateListFromElements(Type t, IEnumerable`1 elements, IList list)
at RestSharp.Deserializers.XmlDeserializer.HandleListDerivative(Object x, XElement root, String propName, Type type)
at RestSharp.Deserializers.XmlDeserializer.Deserialize[T](IRestResponse response)
at RestSharp.RestClient.Deserialize[T](IRestRequest request, IRestResponse raw)
While changing Company.CreatedAt
to public DateTime? CreatedAt { get; set; }
allows all the companies to be returned in the block, that then creates a new issue: updating a company by api.CompanyRequest.Update(company)
removes the value of CreatedAt
.
In my personal implementation, I added a method override to allow the user to pass in either a page number or "-1" as the page number value to get "all" records. Then I would make a request, while tracking pages in a loop, until I received less than 25 records. Then I would return the data. Otherwise, I added the page number to the querystring object. I have the code to do this and I can submit for review if you send me a message. This is an issue on at least two data obj types.
Hi,
I am testing the API and it's failing at very first beginning... :)
const string username = "<myaccount>";
const string authenticationToken = "<mytoken>";
var api = new ApiRequest(username, authenticationToken);
var people = api.PersonRequest.Get();
foreach (var person in people)
{
Console.WriteLine(person.FirstName);
Console.WriteLine(person.Id);
if (person.ContactData.EmailAddresses.Count != 0)
Console.WriteLine(person.ContactData.EmailAddresses[0].Address);
}
Error I am getting is: System.NullReferenceException occurred on object people. Do I need to set any info before using the API?
Thanks,
Ros.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.