Delete artifact

Example - Delete an artifact via your connector

Last update: 2024-02-01

This request deletes an artifact on a custom connector using a connection to the connector. It uses a pre-established connection from the examples request to our connector.

The following operations are demonstrated:

  1. Load environment variables (your connector configs) from a .env file.

  2. Establish a connection to your TSG connector.

  3. Deletes the artifact from your connector.

Important

  • Ensure that the required environment variables (Your Connector API_KEY, CONNECTOR_ID, ACCESS_URL and AGENT_ID) are set in the .env file before using this request.

  • The connector API_KEY can be retrieved by loging into the TSG connector UI and navigating to the ‘API Keys’ tab.

Execute the code below to delete an artifact from your connector.

Ensure that the required parameters are specified before executing the request:

  • artifact_id: The id of the artifact.

 1if __name__ == "__main__":
 2    from loguru import logger
 3    from dotenv import dotenv_values
 4    from tsg_client.controllers import TSGController
 5
 6    # Comment the line below to enable internal logger:
 7    logger.disable("")
 8
 9    # Load environment variables:
10    config = dotenv_values('.env')
11
12    # Connect to our TSG connector:
13    conn = TSGController(
14        api_key=config['API_KEY'],
15        connector_id=config['CONNECTOR_ID'],
16        access_url=config['ACCESS_URL'],
17        agent_id=config['AGENT_ID']
18    )
19
20    # Specify the required parameters:
21    artifact_id = "<artifact_id>"
22
23    # Post artifact on our connector:
24    conn.delete_artifact(artifact_id)