Open
Conversation
- fix bug on try receive Lead with null person_id - use `JObject` in `Create` operation, to remove null values from Body
ArdenHide
commented
Mar 6, 2024
| /// </summary> | ||
| /// <remarks> | ||
| /// See the <a href="https://developers.pipedrive.com/docs/api/v1/Leads">Lead API documentation</a> for more information. | ||
| /// </remarks> |
Author
There was a problem hiding this comment.
- Bugfix: This XML docs don't work because close tag missing.
| { | ||
| Ensure.ArgumentNotNull(data, nameof(data)); | ||
|
|
||
| return ApiConnection.Post<LeadCreated>(ApiUrls.Leads(), JObject.FromObject(data)); |
Author
There was a problem hiding this comment.
Using JObject.FromObject construction to handle null values.
Without null values handling receive error like:
{
"success":false,
"data":null,
"additional_data":null,
"error":"provided dataset is not valid",
"error_info":"\"owner_id\" must be a number"
}Example of request:
var data = new NewLead("Lead created from C#")
{
OrganizationId = 1
};
var createdLead = await client.Lead.Create(data);|
|
||
| [JsonProperty("person_id")] | ||
| public long PersonId { get; set; } | ||
| public long? PersonId { get; set; } |
Author
There was a problem hiding this comment.
Added null possible for person_id because, this value can be null. And we receive JsonSerialization exception on try set null in not-nullable PersonId
Exception:
Unhandled exception. Newtonsoft.Json.JsonSerializationException: Error converting value {null} to type 'System.Int64'. Path 'person_id'
Comment on lines
+52
to
+56
| [JsonProperty("visible_to")] | ||
| public string VisibleTo { get; set; } | ||
|
|
||
| [JsonProperty("cc_email")] | ||
| public string CcEmail { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.