Discussions
How do I add a new Address
about 5 years ago by Lee
I don't really see an actual Addresses endpoint so I was attempting to use CsAddress:
POSTing the following to /api/CsAddress:
{
"$type": "Asi.Soa.Core.DataContracts.GenericEntityData, Asi.Contracts",
"EntityTypeName": "CsAddress",
"PrimaryParentEntityTypeName": "Party",
"PrimaryParentIdentity": {
"$type": "Asi.Soa.Core.DataContracts.IdentityData, Asi.Contracts",
"EntityTypeName": "Party",
"IdentityElements": {
"$type": "System.Collections.ObjectModel.Collection`1[[System.String, mscorlib]], mscorlib",
"$values": [
"CONTACT_ID_HERE"
]
}
},
"Properties": {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
"$values": [
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Address1",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Address2",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Address3",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "BadAddress",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "BarCode",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "City",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Country",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "County",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "CRRT",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Email",
"Value": "[email protected]"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Fax",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "FullAddress",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "MailCode",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Phone",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "AddressPurpose",
"Value": "Reception"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "StateHouse",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "StateProvince",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "StateSenate",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "UsCongress",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Zip",
"Value": ""
}
]
}
}
Results in:
{
"$type": "Asi.Soa.Core.DataContracts.ValidationResultsData, Asi.Contracts",
"Errors": {
"$type": "Asi.Soa.Core.DataContracts.ValidationResultDataCollection, Asi.Contracts",
"$values": [
{
"$type": "Asi.Soa.Core.DataContracts.ValidationResultData, Asi.Contracts",
"Message": " \r\nCsAddress constraint violations:\r\n PropertyName=Address1; Message=Required Field - Address1; Severity=Error\r\n PropertyName=Address2; Message=Required Field - Address2; Severity=Error\r\n PropertyName=Address3; Message=Required Field - Address3; Severity=Error\r\n PropertyName=BadAddress; Message=Required Field - BadAddress; Severity=Error\r\n PropertyName=BarCode; Message=Required Field - BarCode; Severity=Error\r\n PropertyName=City; Message=Required Field - City; Severity=Error\r\n PropertyName=Country; Message=Required Field - Country; Severity=Error\r\n PropertyName=County; Message=Required Field - County; Severity=Error\r\n PropertyName=CRRT; Message=Required Field - CRRT; Severity=Error\r\n PropertyName=Fax; Message=Required Field - Fax; Severity=Error\r\n PropertyName=FullAddress; Message=Required Field - FullAddress; Severity=Error\r\n PropertyName=ID; Message=Required Field - ID; Severity=Error\r\n PropertyName=MailCode; Message=Required Field - MailCode; Severity=Error\r\n PropertyName=Phone; Message=Required Field - Phone; Severity=Error\r\n PropertyName=StateHouse; Message=Required Field - StateHouse; Severity=Error\r\n PropertyName=StateProvince; Message=Required Field - StateProvince; Severity=Error\r\n PropertyName=StateSenate; Message=Required Field - StateSenate; Severity=Error\r\n PropertyName=UsCongress; Message=Required Field - UsCongress; Severity=Error\r\n PropertyName=Zip; Message=Required Field - Zip; Severity=Error\r\n"
}
]
},
"Warnings": {
"$type": "Asi.Soa.Core.DataContracts.ValidationResultDataCollection, Asi.Contracts",
"$values": []
}
}
I clearly have those properties in the body, so I'm not sure why I'm getting those validation errors.
Additionally, is there an easier way to go about this?