Set Parent API Array error
How do I fix my array?
endpoint: https://mysupport.domain.edu/TDWebApi/api/{appId}/tickets/{id}/children
body
{
"childTicketIds":["14624090","14624084","14624079","14624074","14623941","14623940"]
}
result:
{
"ID": -1,
"Message": "childTicketIds must not be null. Errors:\r\n* Exception Message: Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.IEnumerable`1[System.Int32]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'childTicketIds', line 2, position 21."
}
Asked by Scott Cory
on Fri 8/25/23 2:59 PM
Sign In to leave feedback or contribute an answer
Answers (2)
This answer has been marked as the accepted answer
Mark Sayers
Fri 8/25/23 3:11 PM
Hello Scott,
It should just be an array of ticket IDs really, comma separated. Have you tried it that way already?
Sincerely,
Mark Sayers
Sr Support Consultant, CS
No feedback
{
"childTicketIds":[14624090,14624084,14624079,14624074,14623941,14623942]
}
result: same error - Scott Cory Fri 8/25/23 3:14 PM
"childTicketIds":[14624090,14624084,14624079,14624074,14623941,14623942]
}
result: same error - Scott Cory Fri 8/25/23 3:14 PM
Try just sending simply: ["14624090","14624084","14624079","14624074","14623941","14623940"]
With no property name. - Mark Sayers Fri 8/25/23 3:16 PM
With no property name. - Mark Sayers Fri 8/25/23 3:16 PM
tested with and without double quotes and the result is:
{
"ID": -1,
"Message": "childTicketIds must not be null. Errors:\r\n* Exception Message: Invalid property identifier character: [. Path '', line 2, position 0."
} - Scott Cory Fri 8/25/23 3:23 PM
{
"ID": -1,
"Message": "childTicketIds must not be null. Errors:\r\n* Exception Message: Invalid property identifier character: [. Path '', line 2, position 0."
} - Scott Cory Fri 8/25/23 3:23 PM
In Postman where I tested I get it to work when I just pass the child ticket IDs as an array in the body (no quotes around the individual IDs). Like so:
[123445,678990] - Mark Sayers Mon 8/28/23 9:38 AM
[123445,678990] - Mark Sayers Mon 8/28/23 9:38 AM
Thank you Mark, I just needed to omit the curly braces { } from the body and the array worked. "Successfully added 225 child ticket(s) to this major service request."
- Scott Cory
Mon 8/28/23 12:15 PM