Modify the information provided for a specific Twitter Connector object.
Update a specific Twitter connector's record details.
Twitter Connectors Only
The ConnectorApi class only pertains to Twitter connectors, whereas the LiveSourceApi class covers all other available Layar connectors.
Python SDK
Endpoint Method
Authentication
Before running your API calls, remember to authenticate!
Import Dependencies
Make sure at the top of your script you've got the relevant dependencies:
# import dependencies
import layar_api
from layar_api.rest import ApiException
from pprint import pprint
Instantiate API & Make Request
The only input you will need to provide in the request body is the id
, which is the Layar ID for the connector you're interested in getting the details for. To find this ID programmatically, you can use the search_connectors endpoint.
# Instantiate API endpoint
api_instance = layar_api.ConnectorApi(layar_api.ApiClient(configuration))
# Provide Parameters for Request Body
id = 'id_example' # Layar ID for the Connector
# Run the update_connector API call
try:
api_response = api_instance.get_connector(id)
pprint(api_response)
except ApiException as e:
print("Exception when calling ConnectorApi->get_connector: %s\n" % e)
You're all set to run your script!
Check for Updates
To view the most updated methods for the Layar Python SDK, please review the documentation for the update_connector endpoint of the ConnectorApi.
Response
You should expect to see a list of different properties associated with the Twitter Connector you identified in the request body. The property (or properties) you changed as part of this API call you be reflected in the response, and those properties should be changed accordingly.
For example:
# Before Making the Update Connector API Call
{'connector_type': 'TWITTER',
'created_by_user': 25000,
'date_indexed': datetime.datetime(2021, 11, 9, 13, 4, 10, 78000, tzinfo=tzutc()),
'id': 'AX0EzH3jz-8jqgm_ta5d',
'name': 'Multiple Sclerosis',
'keywords': ['MS','multiple sclerosis','@MSSociety']
}
# After Making the API Call
{'connector_type': 'TWITTER',
'created_by_user': 25000,
'date_indexed': datetime.datetime(2021, 11, 9, 13, 4, 10, 78000, tzinfo=tzutc()),
'id': 'AX0EzH3jz-8jqgm_ta5d',
'name': 'MS Twitter Connector',
'keywords': ['multiple sclerosis','#mssurvivor']
}
See the Github Connector object documentation here, or read the Connector Object Properties section below to learn more about the different properties.
Connector Object Properties
Please reference the Cortex Domain Object page for more information about the Connector object.