HomeGuidesAPI ReferenceChangelogDiscussions
GuidesiMIS ProfessionaliMIS EnterpriseClient SupportLog In
Discussions

Discussions

Ask a Question
Back to All

Rest API Call to update an Event's user defined field.

I am looking to update one of the MUF fields for an event. I have written a javascript PATCH call to update this field but it's not updating the data. When trying to update other fields like Status, Capacity, or Category, it works fine but any of the additional attributes it doesn't update. Here is what I have that works.

const options = {
    method: 'PATCH',
    headers: {
        accept: 'application/json', 'content-type': 'application/json',
        'RequestVerificationToken': document.getElementById("__RequestVerificationToken").value
    },
    body: JSON.stringify(

        {
            "Status": "P",
            "Capacity": 12,
            "Category" :{
                "$type": "Asi.Soa.Events.DataContracts.EventCategoryData, Asi.Contracts",
                "EventCategoryId": "NewCategory"
            } 
        }
    )
};

fetch("https://{url}/api/Event/EventID", options)
    .then(response => response.json())
    .then(response => console.log(response))
    .catch(err => console.error(err));

but when I do the following, the muf field is not updated.

const options = {
    method: 'PATCH',
    headers: {
        accept: 'application/json', 'content-type': 'application/json',
        'RequestVerificationToken': document.getElementById("__RequestVerificationToken").value
    },
    body: JSON.stringify(

        {
            "AdditionalAttributes":                               
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "MUFPro4",
                "Value": "New Value for MUF_4 field"
            } 
        }
    )
};
fetch("https://{url}/api/Event/EventID", options)
    .then(response => response.json())
    .then(response => console.log(response))
    .catch(err => console.error(err));

PATCH seems to be supported but undocumented, so I don't have any reference to check to get the call right.
What am I missing?

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