Skip to content

Latest commit

 

History

History
1155 lines (952 loc) · 22.8 KB

entity-mapping.md

File metadata and controls

1155 lines (952 loc) · 22.8 KB

Entity Mapping API

API Backend for mapping source entity into target entities

Quick Start

# List available operations
epilot entity-mapping

# Call an operation
epilot entity-mapping storeConfig

Common Flags

Flag Description
-p key=value Set a named parameter
-d '{...}' Request body JSON
-H 'Key: Value' Custom header
-t, --token <token> Bearer token for authentication
--profile <name> Use a named profile
-s, --server <url> Override server base URL
-i, --include Include response headers in output
--json Output raw JSON (no formatting)
-v, --verbose Verbose output (show request details)
--jsonata <expr> JSONata expression to transform response
--definition <file> Override OpenAPI spec file/URL
--guided Prompt for all parameters interactively
--no-interactive Disable interactive prompts

Operations

mappings

storeConfig

Store new MappingConfig

POST /v1/mappings

Parameters

Name In Type Required Description
with_id query string No Whether ids are part of the body or not

Request Body

Sample Call

epilot entity-mapping storeConfig

With request body:

epilot entity-mapping storeConfig \
  -d '{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}'

Using stdin pipe:

cat body.json | epilot entity-mapping storeConfig

With JSONata filter:

epilot entity-mapping storeConfig --jsonata '$'
Sample Response
{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}

getConfig

Get latest version of a mapping config by id

GET /v1/mappings/{id}

Parameters

Name In Type Required Description
id path string Yes Mapping Config Id

Sample Call

epilot entity-mapping getConfig \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47

Using positional args for path parameters:

epilot entity-mapping getConfig 70542580-2b38-4bfc-af8d-bb90102f9f47

With JSONata filter:

epilot entity-mapping getConfig -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 --jsonata '$'
Sample Response
{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}

deleteConfig

Delete entity mapping config

DELETE /v1/mappings/{id}

Parameters

Name In Type Required Description
id path string Yes Mapping Config Id

Sample Call

epilot entity-mapping deleteConfig \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47

Using positional args for path parameters:

epilot entity-mapping deleteConfig 70542580-2b38-4bfc-af8d-bb90102f9f47

With JSONata filter:

epilot entity-mapping deleteConfig -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 --jsonata '$'
Sample Response
{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}

getAllVersions

Get all version of MappingConfig

GET /v1/mappings/{id}/versions

Parameters

Name In Type Required Description
id path string Yes Mapping Config Id

Sample Call

epilot entity-mapping getAllVersions \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47

Using positional args for path parameters:

epilot entity-mapping getAllVersions 70542580-2b38-4bfc-af8d-bb90102f9f47

With JSONata filter:

epilot entity-mapping getAllVersions -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 --jsonata 'configs'
Sample Response
{
  "configs": [
    {
      "id": "string",
      "source": {},
      "targets": [],
      "created_at": "1970-01-01T00:00:00.000Z",
      "updated_at": "1970-01-01T00:00:00.000Z",
      "created_by": {},
      "last_updated_by": {},
      "org_id": "66",
      "version": 2
    }
  ]
}

storeNewVersion

Store new version of MappingConfig

POST /v1/mappings/{id}/versions

Parameters

Name In Type Required Description
id path string Yes Mapping Config Id

Request Body

Sample Call

epilot entity-mapping storeNewVersion \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47

With request body:

epilot entity-mapping storeNewVersion \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 \
  -d '{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}'

Using positional args for path parameters:

epilot entity-mapping storeNewVersion 70542580-2b38-4bfc-af8d-bb90102f9f47

Using stdin pipe:

cat body.json | epilot entity-mapping storeNewVersion -p id=70542580-2b38-4bfc-af8d-bb90102f9f47

With JSONata filter:

epilot entity-mapping storeNewVersion -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 --jsonata '$'
Sample Response
{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}

getConfigVersion

Get specific version of a mapping config by id & version

GET /v1/mappings/{id}/versions/{version}

Parameters

Name In Type Required Description
id path string Yes Mapping Config Id
version path number Yes Version to be loaded

Sample Call

epilot entity-mapping getConfigVersion \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 \
  -p version=3

Using positional args for path parameters:

epilot entity-mapping getConfigVersion 70542580-2b38-4bfc-af8d-bb90102f9f47 3

With JSONata filter:

epilot entity-mapping getConfigVersion -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 -p version=3 --jsonata '$'
Sample Response
{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}

executeMapping

Execute entity mapping based on a config

POST /v1/mappings:execute

Parameters

Name In Type Required Description
preview_mode query boolean No True, if you want to preview the entities which will result

Request Body

Sample Call

epilot entity-mapping executeMapping

With request body:

epilot entity-mapping executeMapping \
  -d '{
  "source_ref": {
    "entity_id": "string",
    "entity_schema": "submission"
  },
  "loop_ref": {
    "entity_id": "string",
    "entity_schema": "submission"
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ]
}'

Using stdin pipe:

cat body.json | epilot entity-mapping executeMapping

With JSONata filter:

epilot entity-mapping executeMapping --jsonata 'mapped_entities'
Sample Response
{
  "mapped_entities": [
    {
      "_id": "string",
      "_schema": "string",
      "_title": "string",
      "_org": "string",
      "_tags": ["string"],
      "_created_at": "string",
      "_updated_at": "string",
      "required": {}
    }
  ],
  "failures": [
    {
      "target": {},
      "error": {}
    }
  ],
  "warnings": [
    {
      "explanation": "string",
      "context": "string",
      "id": "string"
    }
  ]
}

searchConfigs

Search mapping configs

POST /v1/mappings:search

Request Body

Sample Call

epilot entity-mapping searchConfigs \
  -d '{"source":{"type":"journey","config":{"journey_id":"string"}}}'

Using stdin pipe:

cat body.json | epilot entity-mapping searchConfigs

With JSONata filter:

epilot entity-mapping searchConfigs --jsonata '$'
Sample Response
{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}

queryMappingHistory

Get the Mapping History

GET /v1/mappings/history

Parameters

Name In Type Required Description
from query string (datetime) No filter the history from this date on
to query string (datetime) No filter the history to this date on
targetEntityId query string (uuid) No
sourceEntityId query string (uuid) No

Sample Call

epilot entity-mapping queryMappingHistory

With JSONata filter:

epilot entity-mapping queryMappingHistory --jsonata 'results[0]'
Sample Response
{}

executeRelations

Execute relation mapping between source entity and target entities

POST /v1/relations:execute

Request Body

Sample Call

epilot entity-mapping executeRelations

With request body:

epilot entity-mapping executeRelations \
  -d '{
  "source_ref": {
    "entity_id": "string",
    "entity_schema": "submission"
  },
  "target": {
    "main_entity_ref": {
      "entity_id": "string",
      "entity_schema": "submission"
    },
    "relation_attributes": [
      {
        "target": "string",
        "target_tags": ["string"],
        "target_tags_include_source": false,
        "target_entity_tags": ["string"],
        "override_with_source_filter": false,
        "source_filter": {
          "limit": 0,
          "schema": "string",
          "attribute": "string",
          "relation_tag": "string",
          "tag": "string",
          "self": false
        },
        "related_to": {},
        "mode": "append",
        "origin": "system_recommendation"
      }
    ],
    "linkback": {
      "attribute": "mapped_entities",
      "relation_tags": ["string"]
    }
  },
  "additional_relations": [
    {
      "entity_id": "string",
      "attribute": "string"
    }
  ]
}'

Using stdin pipe:

cat body.json | epilot entity-mapping executeRelations

With JSONata filter:

epilot entity-mapping executeRelations --jsonata 'relations'
Sample Response
{
  "relations": [
    {
      "source_entity_id": "string",
      "target_entity_id": "string",
      "relation_attr": "string",
      "tags": ["string"]
    }
  ]
}

getMappingConfig

Get latest version of a mapping config by id V2

GET /v2/mappings/{id}

Parameters

Name In Type Required Description
id path string Yes Mapping Config Id

Sample Call

epilot entity-mapping getMappingConfig \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47

Using positional args for path parameters:

epilot entity-mapping getMappingConfig 70542580-2b38-4bfc-af8d-bb90102f9f47

With JSONata filter:

epilot entity-mapping getMappingConfig -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 --jsonata '$'
Sample Response
{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}

putMappingConfig

Stores new version of entity mapping config

PUT /v2/mappings/{id}

Parameters

Name In Type Required Description
id path string Yes Mapping Config Id

Request Body

Sample Call

epilot entity-mapping putMappingConfig \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47

With request body:

epilot entity-mapping putMappingConfig \
  -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 \
  -d '{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}'

Using positional args for path parameters:

epilot entity-mapping putMappingConfig 70542580-2b38-4bfc-af8d-bb90102f9f47

Using stdin pipe:

cat body.json | epilot entity-mapping putMappingConfig -p id=70542580-2b38-4bfc-af8d-bb90102f9f47

With JSONata filter:

epilot entity-mapping putMappingConfig -p id=70542580-2b38-4bfc-af8d-bb90102f9f47 --jsonata '$'
Sample Response
{
  "id": "string",
  "source": {
    "type": "journey",
    "config": {
      "journey_id": "string"
    }
  },
  "targets": [
    {
      "id": "string",
      "name": "string",
      "allow_failure": true,
      "target_schema": "string",
      "target_unique": ["string"],
      "use_uniqueness_criteria": false,
      "loop_config": {},
      "conditionMode": "oneOf",
      "conditions": [],
      "mapping_attributes": [],
      "relation_attributes": [],
      "linkback_relation_attribute": "mapped_entities",
      "linkback_relation_tags": ["string"],
      "graph_context": []
    }
  ],
  "created_at": "1970-01-01T00:00:00.000Z",
  "updated_at": "1970-01-01T00:00:00.000Z",
  "created_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "last_updated_by": {
    "type": "user",
    "org_id": "string",
    "user_id": "string"
  },
  "org_id": "66",
  "version": 2
}