HomeGuidesRecipesAPI EndpointsRelease NotesCommunity
Log In

Managing Connectors


Excludes Twitter Connectors

Please note that these instructions are for all connector types except Twitter connectors, which have their own endpoint. To manage a Twitter connector, please see the page for Managing Twitter Connectors.

Using LiveSourceApi Methods

In order to create and manage your connectors (excluding Twitter), we'll be using the LiveSourceApi. Ensure you've followed the setup instructions in the Getting Started Guide and then instantiate the LiveSourceApi as shown below.

connectors = layar_api.LiveSourceApi(layar_api.ApiClient(configuration))

Get Import Status

If you have just finished Adding Connectors From the API the first thing you'll need to do before you can manage your connector is make sure it has finished importing. For this, we'll use the connectorId we received from the return object when we created the connector and the get_import_status method as shown below.

import_status = connectors.get_import_status(connector_id)
while import_status < 100:
  print("Import Status: " + import_status)
  import_status = connectors.get_import_status(connector_id)
  print("Connector import complete")

Get Source Documents

Once the connector has completed importing you can review all the documents contained within by using the get_source_document_url method. This method requires the connector ID and can accept parameters to limit the number of documents to return or offset the beginning of the returned documents.

rows = 50 #Optional. Limits the number of returned documents
offset = 50 #Optional. The start offset for the first returned document
source_documents = connectors.get_source_document_url(connector, rows=rows, offset=offset)
pprint(source_documents) #Optional

Delete Connectors

If you would like to delete a connector you can do so with the delete_feed method and your connector ID.



This method will delete your connector immediately and irreversibly. PLEASE make sure you have the right connector ID and you are 100% sure you want to delete the connector and all of its contents.

delete_connector = connectors.delete_feed(connector_id)
pprint(delete_connector) #Optional. The response will not have any content but you can print the response type to make sure the connector was deleted successfully.