Data Governance
Also available as:
PDF
loading table of contents...

Entity Type API

  • Base resource name: v2/types/entitydef

  • Full URL: http://<atlas-server-host:port>/api/atlas/v2/types/entitydef

Register Entity Type

Request:

POST /v2/types/entitydef 

Description:

This request is used to register an Entity type with the Atlas type system.

Method Signature:

@POST
@Path("/entitydef")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEntityDef createEntityDef(AtlasEntityDef entityDef) throws AtlasBaseException { 

Example Request:

POST /v2/types/entitydef 

Example Request Body:

{
    "name": "spark_dataframe",
    "superTypes": [
        "DataSet"
    ],
    "typeVersion": "1.0",
    "attributeDefs": [
        {
            "name": "source",
            "typeName": "string",
            "cardinality": "SINGLE",
            "isIndexable": false,
            "isOptional": false,
            "isUnique": false
        },
        {
            "name": "destination",
            "typeName": "string",
            "cardinality": "SINGLE",
            "isIndexable": false,
            "isOptional": true,
            "isUnique": false
        }
    ]
}

Example Response:

{
  "category": "ENTITY",
  "guid": "fd47c0e9-7a06-488a-9831-8ebc92d7f332",
  "createTime": 1482130414242,
  "updateTime": 1482130414242,
  "version": 1,
  "name": "spark_dataframe",
  "typeVersion": "1.0",
  "attributeDefs": [
    {
      "name": "source",
      "typeName": "string",
      "isOptional": false,
      "cardinality": "SINGLE",
      "valuesMinCount": 1,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    },
    {
      "name": "destination",
      "typeName": "string",
      "isOptional": true,
      "cardinality": "SINGLE",
      "valuesMinCount": 1,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    }
  ],
  "superTypes": [
    "DataSet"
  ]
}
Get Entity Type Definition Using Name

Request:

GET /v2/types/entitydef/name/{name}

Description:

Returns the definition of the Entity type with the given name.

Method Signature:

@GET
@Path("/entitydef/name/{name}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEntityDef getEntityDefByName(@PathParam("name") String name) throws AtlasBaseException {

Example Request:

GET /v2/types/entitydef/name/spark_dataframe

Example Response:

{
  "category": "ENTITY",
  "guid": "fd47c0e9-7a06-488a-9831-8ebc92d7f332",
  "createTime": 1482130414242,
  "updateTime": 1482130414242,
  "version": 1,
  "name": "spark_dataframe",
  "typeVersion": "1.0",
  "attributeDefs": [
    {
      "name": "source",
      "typeName": "string",
      "isOptional": false,
      "cardinality": "SINGLE",
      "valuesMinCount": 1,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    },
    {
      "name": "destination",
      "typeName": "string",
      "isOptional": true,
      "cardinality": "SINGLE",
      "valuesMinCount": 1,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    }
  ],
  "superTypes": [
    "DataSet"
  ]
}
Get Entity Type Definition Using GUID

Request:

GET /v2/types/entitydef/guid/{guid}

Description:

Returns the definition of the Entity type by referencing its GUID.

Method Signature:

@GET
@Path("/entitydef/guid/{guid}")
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEnityDef getEntityDefByGuid(@PathParam("guid") String guid) throws AtlasBaseException { 

Example Request:

GET /v2/types/entitydef/guid/fd47c0e9-7a06-488a-9831-8ebc92d7f332

Example Response:

{
  "category": "ENTITY",
  "guid": "fd47c0e9-7a06-488a-9831-8ebc92d7f332",
  "createTime": 1482130414242,
  "updateTime": 1482130414242,
  "version": 1,
  "name": "spark_dataframe",
  "typeVersion": "1.0",
  "attributeDefs": [
    {
      "name": "source",
      "typeName": "string",
      "isOptional": false,
      "cardinality": "SINGLE",
      "valuesMinCount": 1,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    },
    {
      "name": "destination",
      "typeName": "string",
      "isOptional": true,
      "cardinality": "SINGLE",
      "valuesMinCount": 1,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    }
  ],
  "superTypes": [
    "DataSet"
  ]
}
Update Entity Type Using Name

Request:

PUT /v2/types/entitydef/name/{name}

Description:

This request is used to update an Entity type definition by referencing its name.

Method Signature:

@PUT
@Path("/entitydef/name/{name}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public AtlasEntityDef updateEntityDefByName(@PathParam("name") String name, AtlasEntityDef entityDef) throws Exception { 

Example Request:

PUT /v2/types/entitydef/name/spark_dataframe

Example Request Body:

{
    "name": "spark_dataframe",
    "superTypes": [
        "DataSet"
    ],
    "typeVersion": "1.0",
    "attributeDefs": [
        {
            "name": "source",
            "typeName": "string",
            "cardinality": "SINGLE",
            "isIndexable": false,
            "isOptional": false,
            "isUnique": false
        },
        {
            "name": "destination",
            "typeName": "string",
            "cardinality": "SINGLE",
            "isIndexable": false,
            "isOptional": true,
            "isUnique": false
        },
        {
        	"name": "num_partitions",
            "typeName": "int",
            "cardinality": "SINGLE",
            "isIndexable": false,
            "isOptional": true,
            "isUnique": false
        }
    ]
}

Example Response:

{
  "category": "ENTITY",
  "guid": "fd47c0e9-7a06-488a-9831-8ebc92d7f332",
  "createTime": 1482130414242,
  "updateTime": 1482135739983,
  "version": 2,
  "name": "spark_dataframe",
  "description": "spark_dataframe",
  "typeVersion": "1.0",
  "attributeDefs": [
    {
      "name": "source",
      "typeName": "string",
      "isOptional": false,
      "cardinality": "SINGLE",
      "valuesMinCount": 1,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    },
    {
      "name": "destination",
      "typeName": "string",
      "isOptional": true,
      "cardinality": "SINGLE",
      "valuesMinCount": 0,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    },
    {
      "name": "num_partitions",
      "typeName": "int",
      "isOptional": true,
      "cardinality": "SINGLE",
      "valuesMinCount": 0,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    }
  ],
  "superTypes": [
    "DataSet"
  ]
}
Update Entity Type Using GUID

Request:

PUT /v2/types/entitydef/guid/{guid}

Description:

This request is used to update an Entity type by referencing its GUID.

Method Signature:

@PUT
@Path("/entitydef/guid/{guid}")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public AtlasEntityDef updateEntityDefByGuid(@PathParam("guid") String guid, AtlasEntityDef entityDef) throws Exception {

Example Request:

PUT /v2/types/entitydef/guid/fd47c0e9-7a06-488a-9831-8ebc92d7f332

Example Response:

{
  "category": "ENTITY",
  "guid": "fd47c0e9-7a06-488a-9831-8ebc92d7f332",
  "createTime": 1482130414242,
  "updateTime": 1482135739983,
  "version": 2,
  "name": "spark_dataframe",
  "description": "spark_dataframe",
  "typeVersion": "1.0",
  "attributeDefs": [
    {
      "name": "source",
      "typeName": "string",
      "isOptional": false,
      "cardinality": "SINGLE",
      "valuesMinCount": 1,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    },
    {
      "name": "destination",
      "typeName": "string",
      "isOptional": true,
      "cardinality": "SINGLE",
      "valuesMinCount": 0,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    },
    {
      "name": "num_partitions",
      "typeName": "int",
      "isOptional": true,
      "cardinality": "SINGLE",
      "valuesMinCount": 0,
      "valuesMaxCount": 1,
      "isUnique": false,
      "isIndexable": false
    }
  ],
  "superTypes": [
    "DataSet"
  ]
}
Delete Entity Type Definition Using Name

Request:

DELETE /v2/types/entitydef/name/{name}

Description:

Deletes an Entity type definition by referencing its name.

Method Signature:

@DELETE
@Path("/entitydef/name/{name}")
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public void deleteEntityDef(@PathParam("name") String name) throws Exception { 

Example Request:

DELETE /v2/types/entitydef/name/spark_dataframe
Delete Entity Type Definition Using GUID

Request:

DELETE /v2/types/entitydef/guid/{guid}

Description:

Deletes an Entity type definition by referencing its GUID.

Method Signature:

@DELETE
@Path("/entitydef/guid/{guid}")
@Produces(Servlets.JSON_MEDIA_TYPE)
@Experimental
public void deleteEntityDefByGuid(@PathParam("guid") String guid) throws Exception {

Example Request:

DELETE /v2/types/entitydef/guid/fd47c0e9-7a06-488a-9831-8ebc92d7f332
Get All Entity Type Definitions

Request:

GET /v2/types/entitydef

Description:

Returns all Entity type definitions.

Method Signature:

@GET
@Path("/entitydef")
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEntityDefs searchEntityDefs() throws AtlasBaseException { 

Example Request:

GET /v2/types/entitydef

Example Response:

This request returns an extremely long response – not shown here due to space constraints.