Thank you for visiting our Partner Zone. This area is an exclusive space for MYOB Partners. Find out how to Partner with MYOB.
May
May
I'm having a serialization error
Followed the docs here
https://developer.myob.com/api/myob-business-api/v2/contact/customer/
and here
https://accountrightapi.myob.cloud/?version=latest#4a7e7e7e-fab9-45e1-9e80-f4190ff36c27
```json
{
LastName: "test",
FirstName: "test",
IsIndividual: true,
IsActive: true,
DisplayID: "CUS000001",
SellingDetails: {
TaxCode: {
UID: "05bd06d3-ad4d-4249-af58-0a68ca7db9e1",
},
FreightTaxCode: {
UID: "ba799085-c700-4910-ac0b-27035a75af02",
},
},
Addresses: {
Email: "testmyob@moretonblue.com",
Phone1: "11111111111",
},
}
`
snippet of my code
```js
```
Here is the error after posting to /Contact/Customer
```json
{
Errors: [
{
Name: "SerializationError",
Message: null,
AdditionalDetails: "Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Collections.Generic.List`1[MYOB.AccountRight.API.Version2.Contracts.Address]' 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 'Addresses.Email', line 1, position 284.",
ErrorCode: 50,
Severity: "Error",
LearnMore: null,
},
],
Information: "Warning, error messages have not been finalised in this release and may change",
}
```
any ideas on why this is happening am I missing something?
May
May
I am having exactly the same issue...
May
May
I contacted MYOBapi support, and the answer is that the Addresses section can contain up to 5 addresses and therefore is an array so must have square brackets added...
Addresses: [
{
Email: "testmyob@moretonblue.com",
Phone1: "11111111111",
}],
May
May
Hi @moretonblue
Thanks for you post.
For any API error/integration related queries, we recommend raising a support request via the following link: https://apisupport.myob.com/hc/en-us/requests/new
Please feel free to post again. I'm happy to assist further.
If my response has answered your inquiry please click "Accept as Solution" to assist other users find this information.
Best Regards,
Cel
Online Help| Forum Search| my.MYOB| Download Page
Did my answer help?
Accept it as a Solution
Leave a to tell others
by
Jodie-D
4 weeks ago
1
159
|
1
|
159
|
||
7
|
343
|
|||
by
![]()
18
1429
|
18
|
1429
|
||
12
|
652
|
|||
10
|
1299
|