Discussions
REST API - 2017 - query by ID or PartyID for a UD_Table?
Hi - I have an interesting case where I'm trying to query the API for a UD_Table. When I call:
/api/BOEntityDefinition/{UD_Table_Name}
I see the ObjectTypeName is "Standard," and there's an "ID" property represented as:
{
"$type": "Asi.Soa.Core.DataContracts.PropertyTypeStringData, Asi.Contracts",
"MaxLength": 10,
"PropertyTypeName": "String",
"Name": "ID",
"Description": "",
"Caption": "ID",
"DefaultValue": "",
"DisplayMask": "",
"IsIdentity": true,
"RenderingInformation": {
"$type": "Asi.Soa.Core.DataContracts.PropertyRenderingInformationData, Asi.Contracts",
"HelpText": "",
"ToolTip": "",
"WatermarkText": "",
"ControlType": 7
},
"Required": true,
"Visible": true
}
When I query the table using the endpoint:
/api/{UD_Table_Name}?ID={ID_Value}
I get this response:
{
"$type": "Asi.Soa.Core.DataContracts.ValidateResultsData, Asi.Contracts",
"IsValid": false,
"ValidationResults": {
"$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": "In the query, ID is not a known property name."
}
]
},
"Warnings": {
"$type": "Asi.Soa.Core.DataContracts.ValidationResultDataCollection, Asi.Contracts",
"$values": []
}
}
}
But when I query by PartyId instead of ID, I get a valid response:
/api/{UD_Table_Name}?PartyId={ID_Value}
Ok, so my question is, when I call the BOEntityDefinition endpoint, how do I know from the response whether I should query the entity using PartyId or ID?
(For instance, if I call /api/BOEntityDefinition/CsContact, it also shows an ID property in the metadata, but in this case, I need to query by ID, e.g. /api/CsContact?ID={val}. If I try call /api/CsContact?PartyId={val}, I get the inverse error message, "In the query, PartyId is not a known property name.")