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

Atlas Entities API

You can use the Atlas Entities API to create, read, update, and delete multiple entities with a single request.

Summary:

  • Base resource name: v2/entities

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

Create or Update Entities

Request:

POST /v2/entities

Description:

Creates new entities or updates existing entities. An existing entity is referenced by its GUID or by a unique attribute such as qualifiedName. Any associations such as Classifications or Business Terms must be assigned using the applicable API.

Method Signature:

@POST
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public EntityMutationResponse createOrUpdate(List<AtlasEntity> entities) throws AtlasBaseException {

Example Request:

POST /v2/entities

Example Request Body:

The body for this POST request registers multiple spark_dataframe entities.

[{
  "typeName": "spark_dataframe",
  "attributes" : {
     "qualifiedName" : "dataframe_jobID_1234",
     "name" : "dataframe_1",
    "source" : "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/source_1",
    "destination" : "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/destination_1"
  },
  "classifications": [

  ]
 
},
{
  "typeName": "spark_dataframe",
  "attributes" : {

     "qualifiedName" : "dataframe_jobID_9349",
     "name" : "dataframe_2",
    "source" : "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/source_2",
    "destination" : "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/destination_2"
  },
  "classifications": [

  ]
 
}
]

Example Response:

{
  "entitiesMutated": {
    "CREATE_OR_UPDATE": [
      {
        "guid": "4d6e5368-609a-4ba9-9153-6dcf4759de0a"
      },
      {
        "guid": "fbe78388-0eed-4439-b738-5fd1a2f9db68"
      }
    ]
  }
}

Update Entities

Request:

PUT /v2/entities

Description:

Updates the specified entities. Any associations such as Classifications or Business Terms must be assigned using the applicable API. Null updates are supported, for example, setting optional attributes to Null.

Method Signature:

@PUT
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public EntityMutationResponse update(List<AtlasEntity> entities) throws AtlasBaseException {

Example Request:

PUT /v2/entities

Example Request Body:

[{
  "typeName": "spark_dataframe",
  "attributes" : {
     "qualifiedName" : "dataframe_jobID_1234",
     "name" : "updated_dataframe_1",
    "source" : "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/source_1",
    "destination" : "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/destination_1"
  },
  "classifications": [

  ]
 
},
{
  "typeName": "spark_dataframe",
  "attributes" : {

     "qualifiedName" : "dataframe_jobID_9349",
     "name" : "updated_dataframe_2",
    "source" : "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/source_2",
    "destination" : "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/destination_2"
  },
  "classifications": [

  ]
 
}
]

Example Response:

{
  "entitiesMutated": {
    "CREATE_OR_UPDATE": [
      {
        "guid": "4d6e5368-609a-4ba9-9153-6dcf4759de0a"
      },
      {
        "guid": "fbe78388-0eed-4439-b738-5fd1a2f9db68"
      }
    ]
  }
}

Get Entities Definitions

Request:

GET /v2/entities/guids?guid=list<guid>

Description:

Returns the Entity definitions referenced by the GUIDs passed in the request.

Method Signature:

@GET
@Path("/guids")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public AtlasEntity.AtlasEntities getById(@QueryParam("guid") List<String> guids) throws AtlasBaseException {

Example Request:

GET v2/entities/guids?guid=fbe78388-0eed-4439-b738-5fd1a2f9db68&guid=fbe78388-0eed-4439-b738-5fd1a2f9db68

Example Response:

{
  "list": [
    {
      "typeName": "spark_dataframe",
      "attributes": {
        "source": "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/source_1",
        "description": null,
        "qualifiedName": "dataframe_jobID_1234",
        "name": "updated_dataframe_1",
        "owner": null,
        "destination": "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/destination_1"
      },
      "guid": "4d6e5368-609a-4ba9-9153-6dcf4759de0a"
    },
    {
      "typeName": "spark_dataframe",
      "attributes": {
        "source": "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/source_2",
        "description": null,
        "qualifiedName": "dataframe_jobID_9349",
        "name": "updated_dataframe_2",
        "owner": null,
        "destination": "hdfs://vimal-fenton-4-1.openstacklocal:8020/apps/hive/warehouse/destination_2"
      },
      "guid": "fbe78388-0eed-4439-b738-5fd1a2f9db68"
    }
  ],
  "startIndex": 0,
  "pageSize": 0,
  "totalCount": 0
}

Delete Entities

Request:

DELETE /v2/entities/guids?guid=list<guid>

Description:

Deletes the entities referenced by the GUIDs passed in the request.

Method Signature:

@DELETE
@Path("/guids")
@Consumes(Servlets.JSON_MEDIA_TYPE)
@Produces(Servlets.JSON_MEDIA_TYPE)
public EntityMutationResponse deleteById(@QueryParam("guid") final List<String> guids) throws AtlasBaseException {

Example Request:

DELETE /v2/entities/guids?guid=4d6e5368-609a-4ba9-9153-6dcf4759de0a&guid=fbe78388-0eed-4439-b738-5fd1a2f9db68 

Example Response:

{
  "entitiesMutated": {
    "DELETE": [
      {
        "guid": "4d6e5368-609a-4ba9-9153-6dcf4759de0a"
      },
      {
        "guid" : "fbe78388-0eed-4439-b738-5fd1a2f9db68"
      }
    ]
  }
}