- URL:
- https://<root>/<serviceName>/FeatureServer/relationships
- Methods:
GET
- Version Introduced:
- 10.7
Description
The relationships
resource includes relationship class information for the layers and tables in a specific service, including information about relationship rules from the back-end relationship classes and relationship information already found in individual layers and tables. The relationships
resource allows applications to get all the information in one resource, rather than having to piece together the relationships information in each individual layer and table.
Services that support the relationships resource will have the supports
property set as true
on their service resource.
For more information on relationship classes in enterprise geodatabases, see Relationship class properties.
New at 11.3
- Reference feature services support user defined relationship IDs for relationship classes published from ArcGIS Pro 3.3. Each relationship id is still a unique integer value across the relationship classes in the feature service, but now it can be user defined rather than generated by the system.
New at 11.1
The following update has been made for enterprise hosted feature services running on a relational data store:
- This resource is now supported for qualifying hosted feature services. Support for this is indicated when the service-level
supports
property isRelationships Resource true
.
The following update has been made for non-hosted feature services (referencing enterprise geodatabases) published from ArcGIS Pro:
- The
catalog
property has been added to the relationships array returned by theI D relationships
resource.
Request parameters
Parameter | Details |
---|---|
| The response format. The default response format is Values: |
Response properties
The following properties are returned for each relationship class.
Property | Details |
---|---|
| The unique identifier assigned to each relationship. |
| The name assigned to the relationship when the relationship was created. |
| A name to identify the relationship when navigating from the destination table to the origin table. |
| The layer ID of the origin table participating in the relationship. |
| The name of the primary key field in the origin table. |
| A name to identify the relationship when navigating from the origin table to the destination table. |
| The layer ID of the destination table participating in the relationship. |
| In a non-attributed relationship, the |
| The ID of the intermediate table in the feature service for attributed relationships. |
| The name of the primary key field in the destination table. |
| In attributed relationships, this is the foreign key in the intermediate table that relates the rows of the intermediate table to the destination layer or table. |
| If the relationship class has relationship rules, the rules array will list information about each rule. If no rules are defined, an empty array is returned. The each rule has the following properties:
|
| The cardinality of the relationships as a combination of origin and destination cardinalities. When you create a relationship class, you create it with an initial cardinality, such as one-to-many or many-to-many. In a real system, however, relationship cardinalities are more specific. Once you've created the relationship class, you can refine the cardinality by creating rules. Relationship rules allow you to restrict the type of objects in the origin feature class or table that can be related to a certain kind of object in the destination feature class or table. Values: If an object in the origin table can be related to only one object in the destination table, the relationship cardinality is |
| Indicates whether the relationship is attributed. Values: |
| Indicates whether the relationship is composite. Values: |
| Introduced at ArcGIS Enterprise 11.1. A universal identifier from the back-end data store. This value can be used, for example, by the UUID for the relationship class in the back-end enterprise geodatabse. |
JSON Response syntax
{
"relationships": [
{
"id": <id>,
"name": "<name>",
"catalogID": "<identifier>",//Added at 11.1
"backwardPathLabel": "<backwardPathLabel>",
"originLayerId": <originLayerId>,
"originPrimaryKey": "<originPrimaryKey>",
"forwardPathLabel": "<forwardPathLabel>",
"destinationLayerId": <destinationLayerId>,
"originForeignKey": "<originForeignKey>",
"relationshipTableId": <relationshipTableId>,
"destinationPrimaryKey": "<destinationPrimaryKey>",
"destinationForeignKey": "<destinationForeignKey>",
"rules": [
{
"ruleID": <ruleID>,
"originSubtypeCode": <originSubtypeCode>,
"originMinimumCardinality": <originMinimumCardinality>,
"originMaximumCardinality": <originMaximumCardinality>,
"destinationSubtypeCode": <destinationSubtypeCode>,
"destinationMinimumCardinality": <destinationMinimumCardinality>,
"destinationMaximumCardinality": <destinationMaximumCardinality>
}
],
"cardinality": "<cardinality>",
"attributed": <true | false>,
"composite": <true | false>
}
]
}
JSON Response example
{
"relationships": [
{
"id": 0,
"name": "county_division",
"catalogID": "{A14D41FC-ABB5-4E9C-86BC-BB0290D5B331}",
"backwardPathLabel": "belongs",
"originLayerId": 0,
"originPrimaryKey": "GlobalID",
"forwardPathLabel": "has",
"destinationLayerId": 2,
"originForeignKey": "GlobalID_sor",
"relationshipTableId": 3,
"destinationPrimaryKey": "GlobalID",
"destinationForeignKey": "GlobalID_des",
"rules": [
{
"ruleID": 1,
"originSubtypeCode": 1,
"originMinimumCardinality": 0,
"originMaximumCardinality": 2,
"destinationSubtypeCode": 0,
"destinationMinimumCardinality": 0,
"destinationMaximumCardinality": 1
},
{
"ruleID": 2,
"originSubtypeCode": 2,
"originMinimumCardinality": -1,
"originMaximumCardinality": -1,
"destinationSubtypeCode": 0,
"destinationMinimumCardinality": -1,
"destinationMaximumCardinality": -1
}
],
"cardinality": "esriRelCardinalityOneToMany",
"attributed": false,
"composite": true
}
]
}