Discussions
Error on all API PUT calls to an Organization end point
We are encountering issues with making changes to an Organization object via an API PUT call. Basically, we receive Internal Server Error 500 messages but the changes are being made by the call. Another interesting note is that we also receive a response that the "Name" attribute is required which we find odd for a PUT call and isn't mentioned in the Developer SDK documentation.
POST calls to the Organization end point have been working as expected for us.
Here's the call that successfully updates the organization NAME and TYPE; however, it returns "status: 500, ok: false, status Text: "Internal Server Error"". We're seeing this error issue with all Organization PUT calls we try (i.e. name and partyID attributes only are included in the request body).
const options = {
method: 'PUT',
headers: {"Content-Type": "application/json", "RequestVerificationToken" : jQuery("#__RequestVerificationToken").val()},
body: JSON.stringify({
"$type": 'Asi.Soa.Membership.DataContracts.OrganizationData, Asi.Contracts',
"PartyId": '53121',
"Name": 'Automation Test WLREQ',
"OrganizationType": {
"$type": 'Asi.Soa.Membership.DataContracts.Organization.OrganizationTypeData, Asi.Contracts',
"Name": 'Wish List Request'},
"AdditionalAttributes": {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
"$values": [
{ "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "CustomerTypeDescription",
"Value": "Wish List Request" },
{"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "CustomerTypeCode",
"Value": "WLREQ" }
] }
})
};
fetch('https://testsite.imiscloud.com/api/Organization/53121', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));