Package: losant-rest
Losant Python REST API ClientTheLosantREST API client provides a simple way to use the comprehensive Losant API. You can authenticate either as a Losant device or with your user account, and have access to all the functionality of the Losant platform.This client works with both Python 2.7 and 3. It usesRequestsunder the covers for the actual HTTP communication.InstallationThe latest stable version is available in the Python Package Index (PyPi) and can be installed usingpipinstalllosant-restExampleBelow is a high-level example of using the Losant Python REST API client to authenticate against the Losant Platform and report state for a device.fromlosantrestimportClientfromanalogimportAnalogSensorclient=Client()creds={'deviceId':'my-device-id','key':'my-app-access-key','secret':'my-app-access-secret'}response=client.auth.authenticate_device(credentials=creds)client.auth_token=response['token']app_id=response['applicationId']state={'data':{'temperature':AnalogSensor.read()}}response=client.device.send_state(deviceId='my-device-id',applicationId=app_id,deviceState=state)print(response)""" {'success': True} """API DocumentationClientA client is a single api instance. By default, it is unauthenticated, but can be given an access token to perform authenticated requests.ConstructorClient(auth_token=None,url="https://api.losant.com")TheClient()constructor takes the following arguments:auth_tokenThe access token to be used for authentication - by default there is no access token. An access token can be acquired through any of theAuthmethods, or can be created for a particular application throughapplication_api_tokens.urlThe url of the Losant API - by defaulthttps://api.losant.com.Propertiesauth_tokenThe access token can be accessed or changed after Client creation through this property.urlThe api base url can be accessed or changed after Client creation through this property.ResourcesEach of the following is a property on the client object, and returns a wrapper for the actions against that particular resource. See each resource documentation file for more information.applicationContains all of the actions that can be performed against a singleApplication, which include things like getting info on an application or modifying an application.applicationsContains all of the actions that can be performed against the set ofApplicationsthat the currently authenticated user has access to - such as listing the applications or creating a new application.application_api_tokenContains all the actions that can be performed against a singleApi Tokenbelonging to an application - for instance, getting info on a single token or revoking a token.application_api_tokensContains all of the actions that can be performed against the collection ofApi Tokensbelonging to an Application - such as listing all tokens or creating a new token.application_keyContains all the actions that can be performed against a singleApplication Key- for instance, getting info on a single key or revoking a key.application_keysContains all of the actions that can be performed against the collection ofApplication Keysbelonging to an Application - such as listing all keys or creating a new key.authContains the actions used for authenticating against the api, either as a user or as a device. The result of authentication calls contain the auth_token needed for authenticated calls - see the examples for more details.dashboardContains all of the actions that can be performed against a singleDashboard, which include things like getting info on a dashboard or modifying a dashboard.dashboardsContains all of the actions that can be performed against the set ofDashboardsthat the currently authenticated user has access to - such as listing the dashboards or creating a new dashboard.dataContains the actions for querying against historical Device data across an Application.data_tableContains all the actions that can be performed against a singleData Table- for instance, getting info on a single data table or modifying the columns of a data table.data_tablesContains all of the actions that can be performed against the collection ofData Tablesbelonging to an Application - such as listing all data tables or creating a new data table.data_table_rowContains all the actions that can be performed against a single row inside of aData Table- for instance, getting the contents of a row, or modifying a row.data_table_rowsContains all of the actions that can be performed against the collection of rows that make up aData Table- such as querying for rows in that table, or adding a new row to the table.deviceContains all the actions that can be performed against a singleDevice- for instance, getting info on a single device or reporting the current state of a device.devicesContains all of the actions that can be performed against the collection ofDevicesbelonging to an Application - such as listing all devices or sending a command to a set of devices.device_recipeContains all the actions that can be performed against a singleDevice Recipe, which include things like removing a device recipe or creating a device from a device recipe.device_recipesContains all the actions that can be performed against the collection ofDevice Recipesbelonging to an Application - such as listing recipes or creating a new recipe.edge_deploymentsContains all the actions that can be performed against the collection ofEdge Deploymentsbelonging to an Application - such as listing deployments or creating a new deployment.eventContains all the actions that can be performed against a singleEvent, such as commenting on or changing the state of an event.eventsContains all the actions that can be performed against the collection ofEventsbelonging to an Application - such as listing open events or creating a new event.experienceContains all the actions that can be performed against an applicationExperience, such as bootstrapping or clearing resources.experience_domainContains all the actions that can be performed against a singleExperience Domain, such as updating SSL certificate information.experience_domainsContains all the actions that can be performed against the collection ofExperience Domainsbelonging to an Application - such as listing domains or creating a new domain.experience_endpointContains all the actions that can be performed against a singleExperience Endpoint, such as updating route information.experience_endpointsContains all the actions that can be performed against the collection ofExperience Endpointsbelonging to an Application - such as listing endpoints or creating a new endpoint.experience_groupContains all the actions that can be performed against a singleExperience Group, such as updating member information.experience_groupsContains all the actions that can be performed against the collection ofExperience Groupsbelonging to an Application - such as listing groups or creating a new group.experience_slugContains all the actions that can be performed against a singleExperience Slug, such as changing the associated version.experience_slugsContains all the actions that can be performed against the collection ofExperience Slugsbelonging to an Application - such as listing slugs or creating a new slug.experience_userContains all the actions that can be performed against a singleExperience User, such as changing their email or password.experience_usersContains all the actions that can be performed against the collection ofExperience Usersbelonging to an Application - such as listing users or creating a new user.experience_versionContains all the actions that can be performed against a singleExperience Version, such as modifying the description.experience_versionsContains all the actions that can be performed against the collection ofExperience Versionsbelonging to an Application - such as listing versions or creating a new versions.experience_viewContains all the actions that can be performed against a singleExperience View, such as modifying the body template.experience_viewsContains all the actions that can be performed against the collection ofExperience Viewsbelonging to an Application - such as listing views or creating a new view.fileContains all the actions that can be performed against a singleFile, such as moving, renaming, or deleting.filesContains all the actions that can be performed against the collection ofFilesbelonging to an Application - such as listing files or uploading a new file.flowContains all the actions that can be performed against a singleWorkflow, such as enabling or disabling a workflow, or triggering a virtual button in the workflow.flowsContains all the actions that can be performed against the collection ofWorkflowsbelonging to an Application - such as listing the workflows or creating a new workflow.flow_versionContains all the actions that can be performed against a singleWorkflow Version, such as enabling or disabling a workflow version, or updating the version notes.flow_versionsContains all the actions that can be performed against the collection ofWorkflow Versionsbelonging to a Workflow - such as listing the versions or creating a new version.meContains the actions for operating against the currently authenticatedUsersuch as changing the password or linking against external services.integrationContains all the actions that can be performed against a singleIntegration, which include things like removing an integration or updating integration configuration.integrationsContains all the actions that can be performed against the collection ofIntegrationsbelonging to an Application - such as listing integrations or creating a new integration.orgContains all the actions that can be performed against a singleOrganization, things like inviting a user to the organization, or modifying the organization.orgsContains all of the actions that can be performed against the set ofOrganizationsthat the currently authenticated user has access to - such as listing the organizations or creating a new organization.webhookContains all the actions that can be performed against a singleWebhook, for instance modifying the verification settings or removing the webhook.webhooksContains all the actions that can be performed against the collection ofWebhooksbelonging to an Application - such as listing the webhooks or creating a new webhook.Copyright (c) 2023 Losant IoT, Inchttps://www.losant.com