Quartic SDK documentation¶
Quartic SDK is Quartic.ai’s external software development kit (SDK) which allows users to use the assets, tags, and other intelligence of the Quartic AI Platform externally. Using the Quartic SDK, third party developers can build custom applications. Quartic SDK supports two kinds of authentication: Basic Authentication and OAuth2.0. In Basic Authentication, the user must pass the parameters of username and password; and in OAuth2.0, the client token.
Contents:
- Quick start
- Basic Functionality
- GraphQL Client
- API Client
- GraphQL documentation
- Q.Platform
- Queries
- Mutations
- AhattributeCreate
- AhattributeDelete
- AhattributeUpdate
- AhentityCreate
- AhattributeDelete
- AhentityUpdate
- AhentityattributevalueCreate
- AhentityattributevalueDelete
- AhentityattributevalueUpdate
- AhentitytemplateCreate
- AhentitytemplateDelete
- AhentitytemplateUpdate
- AssetCreate
- AssetDelete
- AssetUpdate
- AssetOperationCreate
- AssetOperationDelete
- AssetOperationUpdate
- AssetcomponentCreate
- AssetcomponentDelete
- AssetcomponentUpdate
- DuplicateProcedureUpdate
- ManualprocedurebatchCreate
- ManualprocedurebatchDelete
- ManualprocedurebatchUpdate
- ProductCreate
- ProductDelete
- ProductUpdate
- Q.Data/Qnnect
- Q.Intelligence
- Queries
- Mutations
- ProcedureCreate
- ProcedureDelete
- ProcedureUpdate
- ProcedureStepCreate
- ProcedureStepDelete
- ProcedureStepUpdate
- ProcedurestepbatchCreate
- ProcedurestepbatchDelete
- ProcedurestepbatchUpdate
- ProcedurestepcomponentCreate
- ProcedurestepcomponentUpdate
- StepcontrolstrategyCreate
- StepcontrolstrategyDelete
- StepcontrolstrategyUpdate
- Q.Applications
- Others
- Model Creation
- Changelog
- API Reference
Installation¶
Install using pip
:
pip install quartic-sdk
…or follow the following steps to install it from the source:
git clone https://github.com/Quarticai/QuarticSDK/
python setup.py install
Example¶
Here’s an example on how the Quartic SDK can be used:
GraphQLClient¶
# Assuming that the Quartic.ai server is hosted at `https://test.quartic.ai/`,
# with the login credentials as username and password is "testuser" and `testpassword respectively,
# then use GraphqlClient in the following format.
from quartic_sdk import GraphqlClient
client = GraphqlClient(url='https://test.quartic.ai/', username='testuser', password='testpassword')
# Executing Query by:
query='''
query MyQuery {
Site {
id
name
}
}
'''
result = client.execute_query(query=query)
# To execute query asynchronously use the function below.
# You should see the following result:
{'data': {'Site': [{'id': '1', 'name': 'quartic'}, {'id': '8', 'name': 'ABC site 1'}, {'id': '12', 'name': 'XYC 123'}]}
async def execute_graphql_query():
query='''
query MyQuery {
Site {
id
name
}
}
'''
resp = await client.execute_async_query(query=query)
return resp
# Note: The above function will return a coroutine object.
# Example to upload a file.
query = '''
mutation($file: Upload!,$edge_connector: Int!,$date_format: DateTime!) {
uploadTelemetryCsv(
file: $file,
fileName: "123",
edgeConnector: $edge_connector,
dateFormat: $date_format
)
{
taskId
status
}
}
'''
variables = {
'file': open('<path/to/file>', 'rb'),
'edge_connector': 'edgeConnector Id',
'date_format': 'DatTime format'
}
response = client.execute_query(query=query, variables=variables)