HomeGuidesAPI ReferenceChangelogDiscussions
GuidesiMIS ProfessionaliMIS EnterpriseClient SupportLog In
Discussions

Discussions

Ask a Question
Back to All

Does anyone know why BadRequest: ValidationError occurs here?

I send this JSON which is VALIDATED by JsonLint. But each time I POST the following code I receive the BAdRequest/Validation Error but no further details from iMIS Scheduler. I can GET, but cannot PUT or POST.

Here is the C# code:
static async Task Update(string id)
{
PersonData existingParty;
var responseItem = await Client.GetAsync($"api/party/{id}");
if (responseItem.IsSuccessStatusCode)
{
// deserialize response to DataContract
existingParty = JsonConvert.DeserializeObject(await responseItem.Content.ReadAsStringAsync(), new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All });
}
else return responseItem;

        // make minor update to the party
        existingParty.WebsiteUrl = Guid.NewGuid().ToString();

        // serialize person data
        var serializedParty = JsonConvert.SerializeObject(existingParty, new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All });
        HttpContent httpContent = new StringContent(serializedParty, Encoding.UTF8, "application/json");

        var response = await Client.PutAsync($"api/party/{id}", httpContent);
        return response;
    }

The JSON payload package returns "BadRequest/Validation Error"
{
"$type": "Asi.Soa.Membership.DataContracts.PersonData, Asi.Contracts",
"PersonName": {
"$type": "Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Contracts",
"FirstName": "Jeff",
"LastName": "Kase",
"FullName": "Jeff Kase"
},
"AdditionalAttributes": {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "IsMember",
"Value": {
"$type": "System.Boolean",
"$value": false
}
}, {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "IsInactiveMember",
"Value": {
"$type": "System.Boolean",
"$value": false
}
}, {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "AllowAdvanceRenewal",
"Value": {
"$type": "System.Boolean",
"$value": false
}
}, {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "JoinDate",
"Value": "0001-01-01T00:00:00"
}, {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "MajorKey",
"Value": "14744"
}]
},
"Addresses": {
"$type": "Asi.Soa.Membership.DataContracts.FullAddressDataCollection, Asi.Contracts",
"$values": []
},
"AlternateIds": {
"$type": "Asi.Soa.Core.DataContracts.AlternateIdDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
"Id": "14744",
"IdType": "MajorKey"
}, {
"$type": "Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
"Id": "14744",
"IdType": "Id"
}]
},
"Emails": {
"$type": "Asi.Soa.Membership.DataContracts.EmailDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Membership.DataContracts.EmailData, Asi.Contracts",
"Address": "[email protected]",
"EmailType": "_Primary",
"IsPrimary": true
}]
},
"FinancialInformation": {
"$type": "Asi.Soa.Membership.DataContracts.FinancialInformationData, Asi.Contracts"
},
"Salutations": {
"$type": "Asi.Soa.Membership.DataContracts.PartySalutationDataCollection, Asi.Contracts",
"$values": [{
"$type": "Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
"SalutationId": "14744:LIST_AS",
"SalutationMethod": {
"$type": "Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
"PartySalutationMethodId": "LIST_AS"
},
"Text": "Jeff Kase"
}]
},
"SocialNetworks": {
"$type": "Asi.Soa.Membership.DataContracts.PartySocialNetworkDataCollection, Asi.Contracts",
"$values": []
},
"CommunicationTypePreferences": {
"$type": "Asi.Soa.Membership.DataContracts.PartyCommunicationTypePreferenceDataCollection, Asi.Contracts",
"$values": []
},
"SortIsOverridden": false,
"UpdateInformation": {
"$type": "Asi.Soa.Core.DataContracts.EntityUpdateInformationData, Asi.Contracts",
"CreatedBy": "ADMINISTRATOR",
"CreatedOn": "2018-09-27T09:19:05.22",
"UpdatedBy": "[email protected]",
"UpdatedOn": "2018-09-28T10:04:11.15"
},
"WebsiteUrl": "9aa577f7-642a-4314-8489-32356dfc188e",
"PartyId": "14744",
"Id": "14744",
"UniformId": "557090fb-ca0c-4f4c-8e92-475dc9f5dba3",
"Status": {
"$type": "Asi.Soa.Membership.DataContracts.PartyStatusData, Asi.Contracts",
"PartyStatusId": "",
"Name": "",
"Description": ""
},
"Name": "Jeff Kase",
"Sort": "Kase, Jeff"
}

Thanks for the input

Contact us
Copyright © Advanced Solutions International, All rights reserved.