Related object metadata in $list api

We need certain clarifications for the Sage CRM api:

We notice that in the response for $list api for most of the objects, we also see URLs for related objects. For eg, for Company, we see the following:

"Email":
{
"$url": "..../sagecrm2/-/Company('28')/Email?startindex=1&count=10"
},
"Address":
{
"$url": "..../sagecrm2/-/Company('28')/Address?startindex=1&count=10"
},
"Phone":
{
"$url": "..../sagecrm2/-/Company('28')/Phone?startindex=1&count=10"
},
"Opportunity":
{
"$url": "..../sagecrm2/-/Company('28')/Opportunity?startindex=1&count=10"
},
"Library":
{
"$url": "..../sagecrm2/-/Company('28')/Library?startindex=1&count=10"
},
"Person":
{
"$url": "..../sagecrm2/-/Company('28')/Person?startindex=1&count=10"
},
"Cases":
{
"$url": "..../sagecrm2/-/Company('28')/Cases?startindex=1&count=10"
},
"Communication":
{
"$url": "..../sagecrm2/-/Company('28')/Communication?startindex=1&count=10"
}


We do not see these mentioned in the metadata api response for this object. ( $prototypes/Company ).

We need to know how we can get the metadata for these related objects. In other words, how do we fetch which all objects would be shown for a particular object $list api?


Thanks,

Harish

  • 0

    Harish

    You need to be sure which API version you are using. For example, if you are looking at the $prototypes for the Company then you are using SData 2.0. At the moment SData 2.0 covers primarily the new custom entities and the core contact entities - Company/Person/Address/Phone/Email as there are data model differences around the modelling of entities that impact the description of relationships.

    In the $prototypes of the company

    cloud.eu.sagecrm.com/sdata[installname]/sagecrm2/-/$prototypes/Company

    The relationships are shown in the description e.g.

    "Conference": {

    "$title": "Conference"

    "$type": "sdata/reference"

    "$isMandatory": true

    "$isHidden": false

    "$isReadOnly": false

    "$relationship": "association"

    "$isCollection": true

    "$item": {...}-

    "$links": {...}-

    }

    Where in my instance Conference is a new custom entity that is related to the Company.

    The $schema call of SData 1.1 will however report all associations (relationships).

    So

    cloud.eu.sagecrm.com/sdata[installname]/sagecrm/-/company/$schema

    will show in the XML the elements

    [code language="xml"]

    [/code]

    You will need to code to parse the XML but the information about the relationships is declared.

  • 0

    Thanks Jeff for your response.

    We checked all the objects in our instance. None of the objects returns a property of type "sdata/reference" in it's metadata response. For eg. [installname]/sagecrm2/-/$prototypes/Company doesn't have any property of type "sdata/reference" in the response. Hence, we aren't able to discover the relationships between objects.

    Do we need to do any configuration on our Sage CRM instance to be able to view such relationships in the $prototypes response? Please help.

  • 0

    Harish

    Have you added any new entities into the system using the Builder feature? It is only these new entities that are related to other entities that will have the 'sdata/reference' in the $prototypes result.

  • 0

    Hi Jeff,

    Yes, we did create some custom objects using the Builder feature, and these objects do have the references. Thanks for confirming the behaviour.