I've getting the above error when trying to access Pipedrive Organizations.
However if I do the same call for Persons it works fine.
When I look at the response from both, the data is exactly the same at this point.
` string APIToken = "My_API_Token!! Happy to PM you this if you need it.";
PipeDriveClient client = new PipeDriveClient(APIToken);
Console.WriteLine("Hello");
IReadOnlyCollection<Person> persons = await client.Persons.GetAllAsync();
foreach (Person p in persons)
{
if (p.OrgId == null)
{
Console.WriteLine(p.FirstName + " " + p.LastName + " " + p.Email[0].Value);
}
else
{
Console.WriteLine(p.FirstName + " " + p.LastName + " " + p.Email[0].Value + " " + p.OrgId.Name);
}
}
IReadOnlyCollection<Organization> Organisations = await client.Organizations.GetAllAsync();
foreach (Organization o in Organisations)
{
Console.WriteLine(o.Name + " " + o.Id);
}
`
Persons response..
"{\"success\":true,\"data\":[{\"id\":1,\"company_id\":1661199,\"owner_id\":{\"id\":2380915,\"name\":\"John Jacobson\",\"email\":\"[email protected]\",\"has_pic\":false,\"pic_hash\":null,\"active_flag\":true,\"value\":2380915},\"org_id\":{\"name\":\"Gold Rush Technology Pty Ltd\",\"people_count\":1,\"owner_id\":2380915,\"address\":\"526 South Titirangi Road, Auckland, New Zealand\",\"cc_email\":\"[email protected]\",\"value\":1},\"name\":\"John Jacobson\",\"first_name\":\"John\",\"last_name\":\"Jacobson\",\"open_deals_count\":0,\"related_open_deals_count\":0,\"closed_deals_count\":0,\"related_closed_deals_count\":0,\"participant_open_deals_count\":0,\"participant_closed_deals_count\":0,\"email_messages_count\":0,\"activities_count\":0,\"done_activities_count\":0,\"undone_activities_count\":0,\"reference_activities_count\":0,\"files_count\":0,\"notes_count\":0,\"followers_count\":1,\"won_deals_count\":0,\"related_won_deals_count\":0,\"lost_deals_count\":0,\"related_lost_deals_co unt\":0,\"active_flag\":true,\"phone\":[{\"label\":\"work\",\"value\":\"1300 737 907\",\"primary\":true}],\"email\":[{\"label\":\"work\",\"value\":\"[email protected]\",\"primary\":true}],\"first_char\":\"j\",\"update_time\":\"2017-04-06 07:13:22\",\"add_time\":\"2017-04-06 07:13:22\",\"visible_to\":\"3\",\"picture_id\":null,\"next_activity_date\":null,\"next_activity_time\":null,\"next_activity_id\":null,\"last_activity_id\":null,\"last_activity_date\":null,\"last_incoming_mail_time\":null,\"last_outgoing_mail_time\":null,\"org_name\":\"Gold Rush Technology Pty Ltd\",\"owner_name\":\"John Jacobson\",\"cc_email\":\"[email protected]\"},{\"id\":2,\"company_id\":1661199,\"owner_id\":{\"id\":2380915,\"name\":\"John Jacobson\",\"email\":\"[email protected]\",\"has_pic\":false,\"pic_hash\":null,\"active_flag\":true,\"value\":2380915},\"org_id\":null,\"name\":\"Sarah Jacobson\",\"first_name\":\"Sarah\",\"last_name\":\"Jacobson\",\"open_deals_count\":0,\"related_open_dea ls_count\":0,\"closed_deals_count\":0,\"related_closed_deals_count\":0,\"participant_open_deals_count\":0,\"participant_closed_deals_count\":0,\"email_messages_count\":0,\"activities_count\":0,\"done_activities_count\":0,\"undone_activities_count\":0,\"reference_activities_count\":0,\"files_count\":0,\"notes_count\":0,\"followers_count\":1,\"won_deals_count\":0,\"related_won_deals_count\":0,\"lost_deals_count\":0,\"related_lost_deals_count\":0,\"active_flag\":true,\"phone\":[{\"label\":\"mobile\",\"value\":\"0201111424\",\"primary\":true}],\"email\":[{\"label\":\"work\",\"value\":\"[email protected]\",\"primary\":true}],\"first_char\":\"s\",\"update_time\":\"2017-04-06 21:36:48\",\"add_time\":\"2017-04-06 21:36:48\",\"visible_to\":\"3\",\"picture_id\":null,\"next_activity_date\":null,\"next_activity_time\":null,\"next_activity_id\":null,\"last_activity_id\":null,\"last_activity_date\":null,\"last_incoming_mail_time\":null,\"last_outgoing_mail_time\":null,\"org_name\":null,\"owner_name\":\"John Jacobs on\",\"cc_email\":\"[email protected]\"}],\"additional_data\":{\"pagination\":{\"start\":0,\"limit\":500,\"more_items_in_collection\":false}},\"related_objects\":{\"organization\":{\"1\":{\"id\":1,\"name\":\"Gold Rush Technology Pty Ltd\",\"people_count\":1,\"owner_id\":2380915,\"address\":\"526 South Titirangi Road, Auckland, New Zealand\",\"cc_email\":\"[email protected]\"}},\"user\":{\"2380915\":{\"id\":2380915,\"name\":\"John Jacobson\",\"email\":\"[email protected]\",\"has_pic\":false,\"pic_hash\":null,\"active_flag\":true}}}}"
Organizations response:
"{\"success\":true,\"data\":[{\"id\":1,\"company_id\":1661199,\"owner_id\":{\"id\":2380915,\"name\":\"John Jacobson\",\"email\":\"[email protected]\",\"has_pic\":false,\"pic_hash\":null,\"active_flag\":true,\"value\":2380915},\"name\":\"Gold Rush Technology Pty Ltd\",\"open_deals_count\":0,\"related_open_deals_count\":0,\"closed_deals_count\":0,\"related_closed_deals_count\":0,\"email_messages_count\":0,\"people_count\":1,\"activities_count\":0,\"done_activities_count\":0,\"undone_activities_count\":0,\"reference_activities_count\":0,\"files_count\":0,\"notes_count\":0,\"followers_count\":1,\"won_deals_count\":0,\"related_won_deals_count\":0,\"lost_deals_count\":0,\"related_lost_deals_count\":0,\"active_flag\":true,\"category_id\":null,\"picture_id\":null,\"country_code\":null,\"first_char\":\"g\",\"update_time\":\"2017-04-06 07:26:56\",\"add_time\":\"2017-04-06 07:12:25\",\"visible_to\":\"3\",\"next_activity_date\":null,\"next_activity_time\":null,\"next_activity_id\":null,\"last_activity_id\":nul l,\"last_activity_date\":null,\"address\":\"526 South Titirangi Road, Auckland, New Zealand\",\"address_subpremise\":\"\",\"address_street_number\":\"526\",\"address_route\":\"South Titirangi Road\",\"address_sublocality\":\"\",\"address_locality\":\"Auckland\",\"address_admin_area_level_1\":\"Auckland\",\"address_admin_area_level_2\":\"\",\"address_country\":\"New Zealand\",\"address_postal_code\":\"0604\",\"address_formatted_address\":\"526 S Titirangi Rd, Titirangi, Auckland 0604, New Zealand\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192\":\"23466\\/1 Mowla Drive, Ashmore, Queensland, Australia\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_subpremise\":\"\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_street_number\":\"1\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_route\":\"Mowla Drive\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_sublocality\":\"\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_locality\":\"Ashmore\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_admin_area_level_1\":\"Queensland\",\"1ba39d7acfc21b491 027a143d1ce15a5e2f08192_admin_area_level_2\":\"Gold Coast City\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_country\":\"Australia\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_postal_code\":\"4214\",\"1ba39d7acfc21b491027a143d1ce15a5e2f08192_formatted_address\":\"1 Mowla Dr, Ashmore QLD 4214, Australia\",\"owner_name\":\"John Jacobson\",\"cc_email\":\"[email protected]\"}],\"additional_data\":{\"pagination\":{\"start\":0,\"limit\":500,\"more_items_in_collection\":false}},\"related_objects\":{\"user\":{\"2380915\":{\"id\":2380915,\"name\":\"John Jacobson\",\"email\":\"[email protected]\",\"has_pic\":false,\"pic_hash\":null,\"active_flag\":true}}}}"
The exception:
Newtonsoft.Json.JsonReaderException was unhandled by user code HResult=-2146233088 LineNumber=1 LinePosition=65 Message=Unexpected character encountered while parsing value: {. Path 'data[0].owner_id', line 1, position 65. Path=data[0].owner_id Source=Newtonsoft.Json StackTrace: at Newtonsoft.Json.JsonTextReader.ReadNumberValue(ReadType readType) at Newtonsoft.Json.JsonTextReader.ReadAsInt32() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, JsonProperty containerProperty, JsonReader reader, Object target) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateObject(Object newObject, JsonReader reader, JsonObjectContract contract, JsonProperty member, String id) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader) at PipeDriveApi.Serializer.PipeDriveJsonSerializer.Deserialize[T](IRestResponse response) in P:\Development\PipeDriveApi-master\Source\PipeDriveApi\PipeDriveApi\Serializer\PipeDriveJsonSerializer.cs:line 58 at RestSharp.RestClient.Deserialize[T](IRestRequest request, IRestResponse raw) InnerException: