Eric,
Sorry this is not documented well so I could not find the doc for you to use. Will work with the team to get this documented.
But you will need to follows the example I have sent you. Only what I have included in my example is needed. Before you do anything, pl. send me the full url (strip the token) and the json used. The json you have used in your last message is not correct.
>Also, how am I defining what the 2nd layer is? As in, a pointer to the name of the 2nd layer (table) so it knows which >table is related? I do not see any such reference in your sample.
All what you really need to figure out is the followings:
- Origin layer Id
- Destination layer id
- Primary key in the origin layer (field name that acts as a primary key)
- Foreign key in the destination layer.
You just need to replace these in the example json I sent you.
I have added some comments below.
https://url/ArcGIS/rest/admin/services/<serviceName>/FeatureServer/addToDefinition
{
"layers" : [
{
"id" : 0,
"relationships" : [
{
"id" : 1,
"name" : "myRel", // <name> for your relationshp. Any name is accepted
"relatedTableId" : 1, // (table or related layer Id)
"cardinality" : "esriRelCardinalityOneToMany",
"role" : "esriRelRoleOrigin",
"keyField" : "<PrimaryKey>", // Origin primary key like GlobalId if the relationship based on globalId
"composite" : <true | false> // Not sure if you need composite but set it to false if you do not need it
}
]
},
{
"id" : 1,
"relationships" : [
{
"id" : 1,
"name" : "myRel", // use the same name you defined above for the relationship name.
"relatedTableId" : 0, // This is the layerId of the origin
"cardinality" : "esriRelCardinalityOneToMany",
"role" : "esriRelRoleDestination",
"keyField" : "<ForignKey>",
"composite" : <true | false> // // Not sure if you need composite but set it to false if you do not need it
}
]
}
]
}