HomeGuidesAPI ReferenceChangelogDiscussions
GuidesiMIS ProfessionaliMIS EnterpriseClient SupportLog In
Discussions

Discussions

Ask a Question
Back to All

Creating a Company Administrator Relationship through the API

We are running iMIS version 20.3.30.4688 and using the REST API.

I need the ability to make a user a company administrator of a company through the REST API. I have looked at the existing relationships that are created when I make a user a company admin through the Staff site and was trying to replicate that.

What I was attempting to do was POST to the /api/CsRelationship endpoint with the JSON data to create the _ORG-ADMIN relationship. It was saying the GroupCode and Status fields were required, but when I look at all the existing relationships those fields are empty. As an attempt to get around this I just put in some dummy data for those fields and got the following error: Update or insert of view or function 'vRelationship' failed because it contains a derived or constant field.

I was wondering if anyone had advice on how to create the Company Administrator relationship through the REST API? Or if anyone had any insights into what values would be valid for GroupCode and Status as there are no existing examples to reference?

Thanks!

The following is the JSON I was trying to POST:

{
"$type": "Asi.Soa.Core.DataContracts.GenericEntityData, Asi.Contracts",
"EntityTypeName": "CsRelationship",
"PrimaryParentEntityTypeName": "Party",
"Properties": {
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
"$values": [
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "BeginDate",
"Value": "0001-01-01T00:00:00"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "EndDate",
"Value": "0001-01-01T00:00:00"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "FunctionalTitle",
"Value": "Company Administrator"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "GroupCode",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "ID",
"Value": "72657"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Note",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "RelatedToID",
"Value": "72659"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "RelatedToName",
"Value": "Brian Test"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Relationship",
"Value": "_ORG-ADMIN"
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Status",
"Value": ""
},
{
"$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
"Name": "Title",
"Value": "Company Administrator"
}
]
}
}

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