URL:
https://<kgserver_replicas>/create
Methods:
POST
Version Introduced:
12.1

Description

The create operation creates a replica definition based on a knowledge graph service. The operation returns a replica that clients can download and persist in a local database. The sync feature must be enabled in order to execute the create operation. The owner of the knowledge graph service and administrators of the ArcGIS Enterprise organization can enable the sync feature by using the updateFeature operation.

Any user can create a replica of a knowledge graph service. However, the portal user type, in combination with the capabilities of the knowledge graph service, determine the types of replicas that can be created. The following table provides the various combinations of portal user type and knowledge graph service capabilities, and the resulting replicas that can be created.

Service CapabilityPortal User TypeReplica SyncDirection Types

Query

Viewer

DOWNLOAD_ONLY, SNAPSHOT

Query

Contributor

DOWNLOAD_ONLY, SNAPSHOT

Query, Editing, and one of Create, Update, Delete

Contributor

DOWNLOAD_ONLY, SNAPSHOT, UPLOAD_ONLY, BIDIRECTIONAL

The difference between the replicas created by different user types allows owners and administrators to sync edits and manage data while providing read-only access to other users. Owners of a knowledge graph service and administrative clients can create a replica of a knowledge graph service regardless of the knowledge graph service capabilities. The user who executes the createReplica operation is assigned ownership of the replica. Users can view, synchronize and unregister replicas they own.

Request parameters

ParameterDetails

requestedReplicaName

(Optional)

The name of the replica on the server. The replica name is unique per knowledge graph service. If not specified, a replica name will be assigned and returned in the CreateReplicaResponse. If specified, but the replica_name already exists on the server, a unique name will be returned in the response using the given replica_name as a base (that is, MyReplica may be returned as MyReplica_0 if there is already a replica named MyReplica on the server)."

replicaId

(Optional)

The replica_id is a unique identifier for the replica. If not specified, a new replica_id will be generated.

replicaDefinition

(Required)

Defines how a new replica will be created. The replicaDefinition parameter can be used to create a new replica based on an existing replica definition using reference_replica or based on data to include in the replica defined when using replicaFilters.

values: replicaFilters | referenceReplica

syncDirection

(Required)

Defines the direction of synchronization of edits allowed for the replica.

The syncDirection parameter is constrained based on portal identities. Viewers can create replicas with syncDirection download, non-administrative and non-owners require the query capability enabled on the service. Editors can create replicas with syncDirection bidirectional, download, and upload, non-administrative and non-owners require the query capability and create, delete, or update capabilities enabled on the service.

If the knowledge graph service does not have the editing capability enabled, only service owners and administrative clients can create replicas with syncDirection BIDIRECTIONAL and UPLOAD.

value: BIDIRECTIONAL | UPLOAD | DOWNLOAD

dataFormat

(Required)

The format of the replica data returned in the response. The only supported format is PBF.

async

(Optional)

If true, the request is processed as an asynchronous job, and a URL is returned that a client can visit to check the status of the job. The default is false .

Values: true | false

f

The response format. The default format is html.

Values: html | pbf

Example usage

The following is a sample request URL used to access the create operation for a knowledge graph service named FieldService:

https://organization.example.com/<context>/rest/services/Hosted/FieldService/KnowledgeGraphServer/replicas/create

The below example POST parameters use the replicaFilter to specify the entity and relationship types that will be added to the replica.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{
  "createReplicaRequest": {
   "replicaFilters": {
    "staticDefinition": {
     "entityTypes": [
      {
       "entityTypeReplicaDefinition": {
        "typeName": "Person"
       }
      },
      {
       "entityTypeReplicaDefinition": {
        "typeName": "Company"
       }
      }
     ],
     "relationshipTypes": [
      {
       "relationshipTypeReplicaDefinition": {
        "typeName": "WORKS_AT"
       }
      }
     ]
    }
   },
   "syncDirection": "BIDIRECTIONAL",
   "dataFormat": "PBF"
  }
 }

Example Response syntax

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
  {"createReplicaResult": {
      "replicaDataUrl": <url>
      "replicaId": <bytes>,
      "syncDate": <int64>, // milliseconds since epoch
      "replicaName": <string>,
      "syncDirection": BIDIRECTIONAL | UPLOAD | DOWNLOAD
      "replicaDataFormat": PBF
    }
  }

Example Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
  {"createReplicaResult": {
      "replicaDataUrl": "https://organization.example.com/<context>/rest/directories/arcgisoutput/Hosted/FieldService_KnowledgeGraphServer/_ags_kgs_151bced0-903e-4c56-a8ea-a7d5171d1457.zip",
      "replicaId": {5481F8D0-E519-46D8-9227-EEBEB551FE6E},
      "syncDate": 1775078735036,
      "replicaName": "KGS_33299f84-713e-4634-968d-a9174e1f02c2",
      "syncDirection": BIDIRECTIONAL
      "replicaDataFormat": PBF
    }
  }

Requests and responses

This operation can be performed by sending a PBF-formatted request and receiving a PBF-formatted response. The status of the operation can be queried using a PBF-formatted request. Details of the request and response parameters are provided in the appropriate .proto files.

PBF Request

Create a PBF-formatted request to perform this operation based on the CreateReplicaRequest.proto file.

PBF Response

When executing this operation asynchronously, create a PBF-formatted response to query the status of the operation based on the AsyncStatusResponse.proto file.

Once the operation is complete, download the replica using the replica_data_url in the PBF-formatted response based on the CreateReplicaResponse.proto file.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.