Managing Connectors
Get Import Status
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 /layar/liveSource/{connectorId}/jobStatus
endpoint as shown below.
Pro Tip
By this point you may be noticing that for each endpoint, we are creating variables before forwarding it onto the Response module. It's always a good idea to plan out what variables are needed before putting together the Response.
statusUri = f'{envUrl}/layar/liveSource/{connectorId}/jobStatus'
body = {
'id' : connectorId
}
importStatus = requests.get(statusUri,
headers = header,
json = body
)
print(importStatus.text) #Optional
Get Source Documents
Once the connector has completed importing you can review all the documents contained within by using the /layar/liveSource/{connectorId}/sourceDocuments
endpoint. This endpoint requires the connectorId
variable and can accept parameters to limit the number of documents to return or offset the beginning of the returned documents.
conDocUri = f'{envUrl}/layar/liveSource/{connectorId}/sourceDocuments'
body = {
'id' : connectorId,
'rows' : 50,
'start' : 50
}
documents = requests.get(conDocUri,
headers = header
json = body
)
pprint(documents) #Optional
Delete Connectors
If you would like to delete a connector you can use the /layar/liveSource/{connectorId}
endpoint and your connectorId
.
PLEASE USE CAUTION
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.
delConUri = f'{envUrl}/layar/liveSource/{connectorId}'
body = {
'id' : connectorId
}
response = requests.delete(delConUri,
headers = header,
json = body
)
pprint(response) #Optional. The response will not have any content but you can print the response type to make sure the connector was deleted successfully.
Updated 9 months ago
Now that we know how to manage our Connectors we can learn how to upload specific documents.