Manage your fleet with Viam's fleet management API
The fleet management API allows you to manage your machine fleet with code the same way you can do in the web UI. With it you can
- create and manage organizations, locations, and individual machines
- manage permissions and authorization
- create and manage fragments
The fleet management API supports the following methods:
| Method Name | Description |
|---|---|
GetUserIDByEmail | Get the ID of a user by email. |
CreateOrganization | Create an organization. |
ListOrganizations | List the organizations the user is an authorized user of. |
GetOrganizationsWithAccessToLocation | Get all organizations that have access to a location. |
ListOrganizationsByUser | List the organizations a user belongs to. |
GetOrganization | Retrieve the organization object for the requested organization containing the organization’s ID, name, public namespace, and more. |
GetOrganizationNamespaceAvailability | Check the availability of an organization namespace. |
UpdateOrganization | Updates organization details. |
DeleteOrganization | Delete an organization. |
ListOrganizationMembers | List the members and invites of the organization that you are currently authenticated to. |
CreateOrganizationInvite | Create an organization invite and send it by email. |
UpdateOrganizationInviteAuthorizations | Update (add or remove) the authorizations attached to an organization invite that has already been created. |
DeleteOrganizationMember | Remove a member from the organization you are currently authenticated to. |
DeleteOrganizationInvite | Delete a pending organization invite to the organization you are currently authenticated to. |
ResendOrganizationInvite | Resend a pending organization invite email. |
GetOrganizationMetadata | Gets the user-defined metadata for an organization. |
UpdateOrganizationMetadata | Updates the user-defined metadata for an organization. |
CreateLocation | Create and name a location under the organization you are currently authenticated to. |
GetLocation | Get a location by its location ID. |
UpdateLocation | Change the name of a location and/or assign a parent location to a location. |
DeleteLocation | Delete a location. |
ListLocations | Get a list of all locations under the organization you are currently authenticated to. |
ShareLocation | Share a location with an organization. |
UnshareLocation | Stop sharing a location with an organization. |
LocationAuth | Get a location’s LocationAuth (location secret or secrets). |
CreateLocationSecret | Create a new location secret. |
DeleteLocationSecret | Delete a location secret. |
GetLocationMetadata | Get the user-defined metadata for a location. |
UpdateLocationMetadata | Update the user-defined metadata for a location. |
GetRobot | Get a machine by its ID. |
GetRobotAPIKeys | Gets the API keys for the machine. |
GetRobotParts | Get a list of all the parts under a specific machine. |
GetRobotPart | Get a specific machine part including its part config, part address, and other information. |
GetRobotPartLogs | Get the logs associated with a specific machine part. |
GetRobotPartByNameAndLocation | Query a specific robot part by name and location id. |
TailRobotPartLogs | Get an asynchronous iterator that receives live machine part logs. |
GetRobotPartHistory | Get a list containing the history of a machine part. |
UpdateRobotPart | Change the name of and assign an optional new configuration to a machine part. |
NewRobotPart | Create a new machine part. |
DeleteRobotPart | Delete the specified machine part. |
MarkPartAsMain | Mark a machine part as the main part of a machine. |
MarkPartForRestart | Mark a specified machine part for restart. |
CreateRobotPartSecret | Create a machine part secret. |
DeleteRobotPartSecret | Delete a machine part secret. |
ListRobots | Get a list of all machines in a specified location. |
NewRobot | Create a new machine. |
UpdateRobot | Update an existing machine’s name and/or location. |
DeleteRobot | Delete a specified machine. |
GetRobotMetadata | Gets the user-defined metadata for a machine. |
GetRobotPartMetadata | Gets the user-defined metadata for a machine part. |
UpdateRobotMetadata | Updates the user-defined metadata for a machine. |
UpdateRobotPartMetadata | Updates the user-defined metadata for a machine part. |
ListFragments | Get a list of fragments in the organization you are currently authenticated to. |
ListMachineFragments | Get a list of top level and nested fragments for a machine, as well as additionally specified fragment IDs. |
ListMachineSummaries | Lists machine summaries for an organization, optionally filtered by fragment IDs, location IDs, and limit. |
GetFragment | Get a fragment by ID. |
CreateFragment | Create a new private fragment. |
UpdateFragment | Update a fragment name and its config and/or visibility. |
DeleteFragment | Delete a fragment. |
GetFragmentHistory | Get fragment history. |
AddRole | Add a role under the organization you are currently authenticated to. |
RemoveRole | Remove a role under the organization you are currently authenticated to. |
ChangeRole | Changes an existing role to a new role. |
ListAuthorizations | List all authorizations (owners and operators) of a specific resource (or resources) within the organization you are currently authenticated to. |
CheckPermissions | Check if the organization, location, or robot your ViamClient is authenticated to is permitted to perform some action or set of actions on the resource you pass to the method. |
GetRegistryItem | Get metadata about a registry item (a module, training script, or ML model) by registry item ID. |
CreateRegistryItem | Create a registry item. |
UpdateRegistryItem | Update a registry item. |
ListRegistryItems | List the registry items in an organization. |
DeleteRegistryItem | Delete a registry item. |
CreateModule | Create a module under the organization you are currently authenticated to. |
UpdateModule | Update the documentation URL, description, models, entrypoint, and/or the visibility of a module. |
UploadModuleFile | Upload a module file. |
GetModule | Get a module by its ID. |
ListModules | List the modules under the organization you are currently authenticated to. |
CreateKey | Create a new API key. |
DeleteKey | Delete an API key. |
RotateKey | Rotate an API key. |
ListKeys | List all keys for the organization that you are currently authenticated to. |
RenameKey | RenameKey renames an API key and returns its ID and name. |
CreateKeyFromExistingKeyAuthorizations | Create a new API key with an existing key’s authorizations. |
GetAppContent | Retrieve the app content for an organization. |
GetAppBranding | Retrieves the app branding for an organization or app. |
Establish a connection
To use the fleet management API, you need to instantiate a ViamClient and then instantiate a AppClient.
You need an API key and API key ID at least Machine operator permissions to use the fleet management API. To get an API key (and corresponding ID), use the web UI to the Viam CLI.
import asyncio
from viam.rpc.dial import DialOptions, Credentials
from viam.app.viam_client import ViamClient
async def connect() -> ViamClient:
dial_options = DialOptions(
credentials=Credentials(
type="api-key",
# TODO: Replace "<API-KEY>" (including brackets) with your API key
payload='<API-KEY>',
),
# TODO: Replace "<API-KEY-ID>" (including brackets) with your API key
# ID
auth_entity='<API-KEY-ID>'
)
return await ViamClient.create_from_dial_options(dial_options)
async def main():
# Make a ViamClient
async with await connect() as viam_client:
# Instantiate an AppClient called "cloud"
# to run fleet management API methods on
cloud = viam_client.app_client
if __name__ == '__main__':
asyncio.run(main())
package main
import (
"context"
"go.viam.com/rdk/app"
"go.viam.com/rdk/logging"
)
func main() {
logger := logging.NewDebugLogger("client")
ctx := context.Background()
// TODO: Replace "<API-KEY>" (including brackets) with your machine's API key
// TODO: Replace "<API-KEY-ID>" (including brackets) with your machine's
// API key ID
viamClient, err := app.CreateViamClientWithAPIKey(
ctx, app.Options{}, "<API-KEY>", "<API-KEY-ID>", logger)
if err != nil {
logger.Fatal(err)
}
defer viamClient.Close()
appClient := viamClient.AppClient()
}
async function connect(): Promise<VIAM.ViamClient> {
// TODO: Replace "<API-KEY-ID>" (including brackets) with your machine's
const API_KEY_ID = "<API-KEY-ID>";
// TODO: Replace "<API-KEY>" (including brackets) with your machine's API key
const API_KEY = "<API-KEY>";
const opts: VIAM.ViamClientOptions = {
serviceHost: "https://app.viam.com:443",
credentials: {
type: "api-key",
authEntity: API_KEY_ID,
payload: API_KEY,
},
};
const client = await VIAM.createViamClient(opts);
return client;
}
const viamClient = await connect();
const appClient = appClient.appClient;
Once you have instantiated an AppClient, you can run the following API methods against the AppClient object (named fleet in the examples).
API
GetUserIDByEmail
Get the ID of a user by email.
Parameters:
email(str) (required): The email of the user.
Returns:
- (str): : The ID of the user.
Example:
id = await cloud.get_user_id_by_email("youremail@email.com")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.email(string)
Returns:
Example:
userID, err := cloud.GetUserIDByEmail(context.Background(), "test@example.com")
For more information, see the Go SDK Docs.
Parameters:
email(string) (required): The email address of the user.
Returns:
- (Promise
): The user’s ID.
Example:
// This method is used internally only. To obtain a user's ID, use the listOrganizationsByUser method.
const members = await appClient.listOrganizationMembers(
'<YOUR-ORGANIZATION-ID>'
);
For more information, see the TypeScript SDK Docs.
CreateOrganization
Create an organization.
Parameters:
name(str) (required): The name of the organization.
Returns:
- (viam.proto.app.Organization): : The created organization.
Example:
organization = await cloud.create_organization("name")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.name(string)
Returns:
- (*Organization)
- (error): An error, if one occurred.
Example:
organization, err := cloud.CreateOrganization(context.Background(), "testOrganization")
For more information, see the Go SDK Docs.
Parameters:
name(string) (required): The name of the new organization.
Returns:
- (Promise<undefined | Organization>): The new organization.
For more information, see the TypeScript SDK Docs.
ListOrganizations
List the organizations the user is an authorized user of.
Parameters:
- None.
Returns:
- (List[viam.proto.app.Organization]): : The list of organizations.
Example:
org_list = await cloud.list_organizations()
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.
Returns:
- ([]*Organization)
- (error): An error, if one occurred.
Example:
organizations, err := cloud.ListOrganizations(context.Background())
For more information, see the Go SDK Docs.
Parameters:
- None.
Returns:
- (Promise<Organization[]>): The organization list.
Example:
const organizations = await appClient.listOrganizations();
For more information, see the TypeScript SDK Docs.
GetOrganizationsWithAccessToLocation
Get all organizations that have access to a location.
Parameters:
location_id(str) (required): The ID of the location.
Returns:
- (List[viam.proto.app.OrganizationIdentity]): : The list of organizations.
Example:
org_list = await cloud.get_organizations_with_access_to_location("location-id")
For more information, see the Python SDK Docs.
Parameters:
locationId(string) (required): The ID of the location to query.
Returns:
- (Promise<OrganizationIdentity[]>): The list of locations with access to the requested location.
Example:
const organizations =
await appClient.getOrganizationsWithAccessToLocation(
'<YOUR-LOCATION-ID>'
);
For more information, see the TypeScript SDK Docs.
ListOrganizationsByUser
List the organizations a user belongs to.
Parameters:
user_id(str) (required): The ID of the user. You can retrieve this with the get_user_id_by_email() method.
Returns:
- (List[viam.proto.app.OrgDetails]): : The list of organizations.
Example:
org_list = await cloud.list_organizations_by_user("<YOUR-USER-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.userID(string)
Returns:
- ([]*OrgDetails)
- (error): An error, if one occurred.
Example:
organizations, err := cloud.ListOrganizationsByUser(context.Background(), "1234a56b-1234-1a23-1234-a12bcd3ef4a5")
For more information, see the Go SDK Docs.
Parameters:
userId(string) (required): The ID of the user to query.
Returns:
- (Promise<OrgDetails[]>): The list of locations the requested user has access to.
For more information, see the TypeScript SDK Docs.
GetOrganization
Retrieve the organization object for the requested organization containing the organization’s ID, name, public namespace, and more.
Parameters:
org_id(str) (required): The ID of the organization to query. You can retrieve this from the organization settings page.
Returns:
- (viam.proto.app.Organization): : The requested organization.
Raises:
- (GRPCError): If the provided org_id is invalid, or not currently authed to.
Example:
org = await cloud.get_organization("<YOUR-ORG-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)
Returns:
- (*Organization)
- (error): An error, if one occurred.
Example:
organization, err := cloud.GetOrganization(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization.
Returns:
- (Promise<undefined | Organization>): Details about the organization, if it exists.
Example:
const organization = await appClient.getOrganization(
'<YOUR-ORGANIZATION-ID>'
);
For more information, see the TypeScript SDK Docs.
GetOrganizationNamespaceAvailability
Check the availability of an organization namespace.
Parameters:
public_namespace(str) (required): Organization namespace to check. Namespaces can only contain lowercase alphanumeric and dash characters.
Returns:
- (bool): : True if the provided namespace is available.
Raises:
- (GRPCError): If an invalid namespace (for example, “”) is provided.
Example:
available = await cloud.get_organization_namespace_availability(
public_namespace="my-cool-organization")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.namespace(string)
Returns:
Example:
available, err := cloud.GetOrganizationNamespaceAvailability(context.Background(), "test-namespace")
For more information, see the Go SDK Docs.
Parameters:
namespace(string) (required): The namespace to query for availability.
Returns:
- (Promise
): A boolean indicating whether or not the namespace is available.
Example:
const isAvailable =
await appClient.getOrganizationNamespaceAvailability('name');
For more information, see the TypeScript SDK Docs.
UpdateOrganization
Updates organization details.
Parameters:
org_id(str) (required): The ID of the organization to update.name(str) (optional): If provided, updates the org’s name.public_namespace(str) (optional): If provided, sets the org’s namespace if it hasn’t already been set.region(str) (optional): If provided, updates the org’s region.cid(str) (optional): If provided, update’s the org’s CRM ID.default_fragments(List[viam.proto.app.FragmentImport]) (optional)
Returns:
- (viam.proto.app.Organization): : The updated organization.
Raises:
- (GRPCError): If the org’s namespace has already been set, or if the provided namespace is already taken.
Example:
organization = await cloud.update_organization(
org_id="<YOUR-ORG-ID>",
name="Artoo's Org",
public_namespace="artoo"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)opts(*UpdateOrganizationOptions)
Returns:
- (*Organization)
- (error): An error, if one occurred.
Example:
name := "tests-name"
organization, err := cloud.UpdateOrganization(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
&UpdateOrganizationOptions{
Name: &name,
})
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The id of the organization to update.name(string) (optional): Optional name to update the organization with.publicNamespace(string) (optional): Optional namespace to update the organization with.region(string) (optional): Optional region to update the organization with.cid(string) (optional): Optional CRM ID to update the organization with.defaultFragments(FragmentImportList) (optional): Optional default fragments to set for the organization.
Returns:
- (Promise<undefined | Organization>): The updated organization details.
Example:
const organization = await appClient.updateOrganization(
'<YOUR-ORGANIZATION-ID>',
'newName'
);
For more information, see the TypeScript SDK Docs.
DeleteOrganization
Delete an organization.
Parameters:
org_id(str) (required): The ID of the organization. You can obtain your organization ID from the organization settings page.
Returns:
- None.
Example:
await cloud.delete_organization("<YOUR-ORG-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteOrganization(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The id of the organization to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteOrganization('<YOUR-ORGANIZATION-ID>');
For more information, see the TypeScript SDK Docs.
ListOrganizationMembers
List the members and invites of the organization that you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the organization to list members of. You can obtain your organization ID from the organization settings page.
Returns:
- (Tuple[List[app.OrganizationMember], List[app.OrganizationInvite]]): : A tuple containing two lists; the first [0] of organization members, and the second [1] of organization invites.
Example:
member_list, invite_list = await cloud.list_organization_members("<YOUR-ORG-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)
Returns:
- ([]*OrganizationMember)
- ([]*OrganizationInvite)
- (error): An error, if one occurred.
Example:
members, invites, err := cloud.ListOrganizationMembers(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The id of the organization to query.
Returns:
- (Promise<ListOrganizationMembersResponse>): An object containing organization members, pending invites, and org ID.
Example:
const members = await appClient.listOrganizationMembers(
'<YOUR-ORGANIZATION-ID>'
);
For more information, see the TypeScript SDK Docs.
CreateOrganizationInvite
Create an organization invite and send it by email.
Parameters:
org_id(str) (required): The ID of the organization to create an invite for. You can obtain your organization ID from the organization settings page.email(str) (required): The email address to send the invite to.authorizations(List[viam.proto.app.Authorization]) (optional): Specifications of the authorizations to include in the invite. If not provided, full owner permissions will be granted.send_email_invite(bool) (required): Whether or not an email should be sent to the recipient of an invite. The user must accept the email to be added to the associated authorizations. When set to false, the user automatically receives the associated authorization on the next login of the user with the associated email address.
Returns:
- (app.OrganizationInvite): : The organization invite.
Raises:
- (GRPCError): if an invalid email is provided, or if the user is already a member of the org.
Example:
await cloud.create_organization_invite("<YOUR-ORG-ID>", "youremail@email.com")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDemail(string)authorizations([]*Authorization)opts(*CreateOrganizationInviteOptions)
Returns:
- (*OrganizationInvite)
- (error): An error, if one occurred.
Example:
func boolPtr(b bool) *bool {
return &b
}
invite, err := cloud.CreateOrganizationInvite(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"test@example.com",
[]*Authorization{&Authorization{}},
&app.CreateOrganizationInviteOptions{
SendEmailInvite: boolPtr(true),
})
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The id of the organization to create the invite for.email(string) (required): The email address of the user to generate an invite for.authorizations(Authorization) (required): The authorizations to associate with the new invite.sendEmailInvite(boolean) (optional): Bool of whether to send an email invite (true) or automatically add a user. Defaults to true.
Returns:
- (Promise<undefined | OrganizationInvite>): The organization invite.
Example:
const auth = new VIAM.appApi.Authorization({
authorizationType: 'role',
authorizationId: 'organization_operator',
organizationId: '<YOUR-ORGANIZATION-ID>',
resourceId: '<YOUR-RESOURCE-ID>', // The resource to grant access to
resourceType: 'organization', // The type of resource to grant access to
identityId: '<YOUR-USER-ID>', // The user id of the user to grant access to (optional)
roleId: 'owner', // The role to grant access to
identityType: 'user',
});
const invite = await appClient.createOrganizationInvite(
'<YOUR-ORGANIZATION-ID>',
'youremail@email.com',
[auth]
);
For more information, see the TypeScript SDK Docs.
UpdateOrganizationInviteAuthorizations
Update (add or remove) the authorizations attached to an organization invite that has already been created. If an invitation has only one authorization and you want to remove it, delete the invitation instead of using this method.
Parameters:
org_id(str) (required): The ID of the organization that the invite is for. You can obtain your organization ID from the organization settings page.email(str) (required): Email of the user the invite was sent to.add_authorizations(List[viam.proto.app.Authorization]) (optional): Optional list of authorizations to add to the invite.remove_authorizations(List[viam.proto.app.Authorization]) (optional): Optional list of authorizations to remove from the invite.
Returns:
- (app.OrganizationInvite): : The updated invite.
Raises:
- (GRPCError): If no authorizations are passed or if an invalid combination of authorizations is passed (for example an authorization to remove when the invite only contains one authorization).
Example:
from viam.proto.app import Authorization
auth = Authorization(
authorization_type="role",
authorization_id="location_owner",
resource_type="location", # "robot", "location", or "organization"
resource_id="012456lni0", # machine id, location id or org id
identity_id="",
organization_id="<YOUR-ORG-ID>",
identity_type=""
)
update_invite = await cloud.update_organization_invite_authorizations(
org_id="<YOUR-ORG-ID>",
email="notarealemail@viam.com",
add_authorizations=[auth]
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDemail(string)addAuthorizationsremoveAuthorizations([]*Authorization)
Returns:
- (*OrganizationInvite)
- (error): An error, if one occurred.
Example:
invite, err := cloud.UpdateOrganizationInviteAuthorizations(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"test@example.com",
[]*app.Authorization{
AuthorizationType: "role",
AuthorizationID: "location_owner",
ResourceType: "location",
ResourceID: LOCATION_ID,
OrganizationID: ORG_ID,
IdentityID: "",
},
[]*app.Authorization{})
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The id of the organization.email(string) (required): The email address associated with the invite.addAuthsList(Authorization) (required): List of authorizations to add to the invite.removeAuthsList(Authorization) (required): List of authorizations to remove from the invite.
Returns:
- (Promise<undefined | OrganizationInvite>): The organization invite.
Example:
const auth = new VIAM.appApi.Authorization({
authorizationType: 'role',
authorizationId: 'organization_operator',
organizationId: '<YOUR-ORGANIZATION-ID>',
resourceId: '<YOUR-RESOURCE-ID>', // The resource to grant access to
resourceType: 'organization', // The type of resource to grant access to
identityId: '<YOUR-USER-ID>', // The user id of the user to grant access to (optional)
roleId: 'owner', // The role to grant access to
identityType: 'user',
});
const invite = await appClient.updateOrganizationInviteAuthorizations(
'<YOUR-ORGANIZATION-ID>',
'youremail@email.com',
[auth],
[]
);
For more information, see the TypeScript SDK Docs.
DeleteOrganizationMember
Remove a member from the organization you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the org to remove the user from. You can obtain your organization ID from the organization settings page.user_id(str) (required): The ID of the user to remove.
Returns:
- None.
Example:
member_list, invite_list = await cloud.list_organization_members(org_id="<YOUR-ORG-ID>")
first_user_id = member_list[0].user_id
await cloud.delete_organization_member(org_id="org_id", user_id=first_user_id)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDuserID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteOrganizationMember(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"1234a56b-1234-1a23-1234-a12bcd3ef4a5")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization.userId(string) (required): The ID of the user.
Returns:
- (Promise
)
Example:
await appClient.deleteOrganizationMember(
'<YOUR-ORGANIZATION-ID>',
'<YOUR-USER-ID>'
);
For more information, see the TypeScript SDK Docs.
DeleteOrganizationInvite
Delete a pending organization invite to the organization you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the organization that the invite to delete was for. You can obtain your organization ID from the organization settings page.email(str) (required): The email address the pending invite was sent to.
Returns:
- None.
Raises:
- (GRPCError): If no pending invite is associated with the provided email address.
Example:
await cloud.delete_organization_invite("<YOUR-ORG-ID>", "youremail@email.com")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDemail(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteOrganizationInvite(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"test@example.com")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization.email(string) (required): The email associated with the invite to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteOrganizationInvite(
'<YOUR-ORGANIZATION-ID>',
'youremail@email.com'
);
For more information, see the TypeScript SDK Docs.
ResendOrganizationInvite
Resend a pending organization invite email.
Parameters:
org_id(str) (required): The ID of the organization that the invite to resend was for. You can obtain your organization ID from the organization settings page.email(str) (required): The email address associated with the invite.
Returns:
- (app.OrganizationInvite): : The organization invite sent.
Raises:
- (GRPCError): If no pending invite is associated with the provided email address.
Example:
org_invite = await cloud.resend_organization_invite("<YOUR-ORG-ID>", "youremail@email.com")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDemail(string)
Returns:
- (*OrganizationInvite)
- (error): An error, if one occurred.
Example:
invite, err := cloud.ResendOrganizationInvite(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2", "test@example.com")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization.email(string) (required): The email associated with the invite to resend.
Returns:
- (Promise<undefined | OrganizationInvite>): The invite.
Example:
const invite = await appClient.resendOrganizationInvite(
'<YOUR-ORGANIZATION-ID>',
'youremail@email.com'
);
For more information, see the TypeScript SDK Docs.
GetOrganizationMetadata
Gets the user-defined metadata for an organization.
Parameters:
org_id(str) (required): The ID of the organization with which the user-defined metadata is associated. You can obtain your organization ID from the organization settings page.
Returns:
- (Mapping[str, Any]): : The user-defined metadata converted from JSON to a Python dictionary.
Example:
metadata = await cloud.get_organization_metadata(org_id="<YOUR-ORG-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.organizationID(string)
Returns:
- (map[string]interface{})
- (error): An error, if one occurred.
Example:
metadata, err := cloud.GetOrganizationMetadata(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the organization.
Returns:
- (Promise<Record<string, JsonValue»): The metadata associated with the organization.
Example:
const metadata = await appClient.getOrganizationMetadata(
'<YOUR-ORGANIZATION-ID>'
);
For more information, see the TypeScript SDK Docs.
UpdateOrganizationMetadata
Updates the user-defined metadata for an organization. User-defined metadata is billed as data.
Parameters:
org_id(str) (required)metadata(Mapping[str, Any]) (required): The user-defined metadata to upload as a Python dictionary.
Returns:
- None.
Example:
await cloud.update_organization_metadata(org_id="<YOUR-ORG-ID>", metadata={
"TEST_API_KEY": "ABC123",
})
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.organizationID(string)data(interface{})
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.UpdateOrganizationMetadata(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
map[string]interface{}{
"key": "value",
},
)
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the organization.data(Record) (required): The metadata to update.
Returns:
- (Promise
)
Example:
await appClient.updateOrganizationMetadata('<YOUR-ORGANIZATION-ID>', {
key: 'value',
});
For more information, see the TypeScript SDK Docs.
CreateLocation
Create and name a location under the organization you are currently authenticated to. Optionally, put the new location under a specified parent location.
Parameters:
org_id(str) (required): The ID of the organization to create the location under. You can obtain your organization ID from the organization settings page.name(str) (required): Name of the location.parent_location_id(str) (optional): Optional parent location to put the location under. Defaults to a root-level location if no location ID is provided.
Returns:
- (viam.proto.app.Location): : The newly created location.
Raises:
- (GRPCError): If either an invalid name (for example, “”), or parent location ID (for example, a nonexistent ID) is passed.
Example:
my_new_location = await cloud.create_location(org_id="<YOUR-ORG-ID>", name="Robotville", parent_location_id="111ab12345")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDname(string)opts(*CreateLocationOptions)
Returns:
- (*Location)
- (error): An error, if one occurred.
Example:
locationID := "ab1c2d3e45"
err := cloud.CreateLocation(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"test-location",
&app.CreateLocationOptions{
ParentLocationID: &locationID,
})
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to create the location under.name(string) (required): The name of the location to create.parentLocationId(string) (optional): Optional name of a parent location to create the new location under.
Returns:
- (Promise<undefined | Location>): The location object.
Example:
const location = await appClient.createLocation(
'<YOUR-ORGANIZATION-ID>',
'name'
);
For more information, see the TypeScript SDK Docs.
GetLocation
Get a location by its location ID.
Parameters:
location_id(str) (optional): ID of the location to get. Defaults to the location ID provided at AppClient instantiation.
Returns:
- (viam.proto.app.Location): : The location.
Raises:
- (GRPCError): If an invalid location ID is passed or if one isn’t passed and there was no location ID provided at AppClient instantiation.
Example:
location = await cloud.get_location(location_id="123ab12345")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationID(string)
Returns:
- (*Location)
- (error): An error, if one occurred.
Example:
location, err := cloud.GetLocation(context.Background(), "ab1c2d3e45")
For more information, see the Go SDK Docs.
Parameters:
locId(string) (required): The ID of the location to query.
Returns:
- (Promise<undefined | Location>): The location object.
Example:
const location = await appClient.getLocation('<YOUR-LOCATION-ID>');
For more information, see the TypeScript SDK Docs.
UpdateLocation
Change the name of a location and/or assign a parent location to a location.
Parameters:
location_id(str) (required): ID of the location to update. Must be specified.name(str) (optional): Optional new name to be updated on the location. Defaults to the empty string “” (that is, the name doesn’t change).parent_location_id(str) (optional): Optional ID of new parent location to move the location under. Defaults to the empty string “” (that is, no new parent location is assigned).
Returns:
- (viam.proto.app.Location): : The newly updated location.
Raises:
- (GRPCError): If either an invalid location ID, name, or parent location ID is passed.
Example:
# The following line takes the location with ID "abc12abcde" and moves it to be a
# sub-location of the location with ID "xyz34xxxxx"
my_updated_location = await cloud.update_location(
location_id="abc12abcde",
name="",
parent_location_id="xyz34xxxxx",
)
# The following line changes the name of the location without changing its parent location
my_updated_location = await cloud.update_location(
location_id="abc12abcde",
name="Land Before Robots"
)
# The following line moves the location back up to be a top level location without changing its name
my_updated_location = await cloud.update_location(
location_id="abc12abcde",
name="",
parent_location_id=""
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationID(string)opts(*UpdateLocationOptions)
Returns:
- (*Location)
- (error): An error, if one occurred.
Example:
locationID := "ab1c2d3e45"
name := "test-name"
err := cloud.UpdateLocation(
context.Background(),
"ab1c2d3e45",
&app.UpdateLocationOptions{
Name: &name,
ParentLocationID: &locationID,
})
For more information, see the Go SDK Docs.
Parameters:
locId(string) (required): The ID of the location to update.name(string) (optional): Optional string to update the location’s name to.parentLocId(string) (optional): Optional string to update the location’s parent location to.region(string) (optional): Optional string to update the location’s region to.
Returns:
- (Promise<undefined | Location>): The location object.
Example:
const location = await appClient.updateLocation(
'<YOUR-LOCATION-ID>',
'newName'
);
For more information, see the TypeScript SDK Docs.
DeleteLocation
Delete a location.
Parameters:
location_id(str) (required): ID of the location to delete. Must be specified.
Returns:
- None.
Raises:
- (GRPCError): If an invalid location ID is passed.
Example:
await cloud.delete_location(location_id="abc12abcde")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteLocation(context.Background(), "ab1c2d3e45")
For more information, see the Go SDK Docs.
Parameters:
locId(string) (required): The ID of the location to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteLocation('<YOUR-LOCATION-ID>');
For more information, see the TypeScript SDK Docs.
ListLocations
Get a list of all locations under the organization you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the org to list locations for. You can obtain your organization ID from the organization settings page.
Returns:
- (List[viam.proto.app.Location]): : The list of locations.
Example:
locations = await cloud.list_locations("<YOUR-ORG-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)
Returns:
- ([]*Location)
- (error): An error, if one occurred.
Example:
locations, err := cloud.ListLocations(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to query.
Returns:
- (Promise<Location[]>): A list of locations under the organization.
Example:
const locations = await appClient.listLocations(
'<YOUR-ORGANIZATION-ID>'
);
For more information, see the TypeScript SDK Docs.
ShareLocation
Share a location with an organization.
Parameters:
organization_id(str) (required): The ID of the organization.location_id(str) (required): The ID of the location.
Returns:
- None.
Example:
await cloud.share_location("<YOUR-ORG-ID>", "<YOUR-LOCATION-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationIDorgID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.ShareLocation(context.Background(), "ab1c2d3e45", "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to share with.locId(string) (required): The ID of the location to share.
Returns:
- (Promise
)
Example:
await appClient.shareLocation(
'<OTHER-ORGANIZATION-ID>',
'<YOUR-LOCATION-ID>'
);
For more information, see the TypeScript SDK Docs.
UnshareLocation
Stop sharing a location with an organization.
Parameters:
organization_id(str) (required): The ID of the organization.location_id(str) (required): The ID of the location.
Returns:
- None.
Example:
await cloud.unshare_location("<YOUR-ORG-ID>", "<YOUR-LOCATION-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationIDorgID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.UnshareLocation(context.Background(), "ab1c2d3e45", "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to unshare with.locId(string) (required): The ID of the location to unshare.
Returns:
- (Promise
)
Example:
await appClient.unshareLocation(
'<OTHER-ORGANIZATION-ID>',
'<YOUR-LOCATION-ID>'
);
For more information, see the TypeScript SDK Docs.
LocationAuth
Get a location’s LocationAuth (location secret or secrets).
Parameters:
location_id(str) (optional): ID of the location to retrieve LocationAuth from. Defaults to the location ID provided at AppClient instantiation.
Returns:
- (viam.proto.app.LocationAuth): : The LocationAuth containing location secrets.
Raises:
- (GRPCError): If an invalid location ID is passed or if one isn’t passed and there was no location ID provided at AppClient instantiation.
Example:
loc_auth = await cloud.location_auth(location_id="123xy12345")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationID(string)
Returns:
- (*LocationAuth)
- (error): An error, if one occurred.
Example:
auth, err := cloud.LocationAuth(context.Background(), "ab1c2d3e45")
For more information, see the Go SDK Docs.
Parameters:
locId(string) (required): The ID of the location to retrieveLocationAuthfrom.
Returns:
- (Promise<undefined | LocationAuth>): The
LocationAuthfor the requested location.
Example:
const locationAuth = await appClient.locationAuth(
'<YOUR-LOCATION-ID>'
);
For more information, see the TypeScript SDK Docs.
CreateLocationSecret
Create a new location secret.
Parameters:
location_id(str) (optional): ID of the location to generate a new secret for. Defaults to the location ID provided at AppClient instantiation.
Returns:
- (viam.proto.app.LocationAuth): : The specified location’s LocationAuth containing the newly created secret.
Raises:
- (GRPCError): If an invalid location ID is passed or one isn’t passed and there was no location ID provided at AppClient instantiation.
Example:
new_loc_auth = await cloud.create_location_secret(location_id="123xy12345")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationID(string)
Returns:
- (*LocationAuth)
- (error): An error, if one occurred.
Example:
auth, err := cloud.CreateLocationSecret(context.Background(), "ab1c2d3e45")
For more information, see the Go SDK Docs.
Parameters:
locId(string) (required): The ID of the location to create aLocationAuthfor.
Returns:
- (Promise<undefined | LocationAuth>): The newly created
LocationAuth.
Example:
const locationAuth = await appClient.createLocationSecret(
'<YOUR-LOCATION-ID>'
);
For more information, see the TypeScript SDK Docs.
DeleteLocationSecret
Delete a location secret.
Parameters:
secret_id(str) (required): ID of the secret to delete.location_id(str) (optional): ID of the location to delete secret from. Defaults to the location ID provided at AppClient instantiation.
Returns:
- None.
Raises:
- (GRPCError): If either an invalid location ID or secret ID is passed or a location ID isn’t passed and there was no location ID provided at AppClient instantiation.
Example:
await cloud.delete_location_secret(
secret_id="abcd123-456-7890ab-cxyz98-989898xyzxyz",
location_id="123xy12345"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationIDsecretID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteLocationSecret(
context.Background(),
"ab1c2d3e45",
"a12bcd3e-a12b-1234-1ab2-abc123d4e5f6")
)
For more information, see the Go SDK Docs.
Parameters:
locId(string) (required): The ID of the location to delete theLocationAuthfrom.secretId(string) (required): The ID of the location secret to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteLocationSecret(
'<YOUR-LOCATION-ID>',
'<YOUR-SECRET-ID>'
);
For more information, see the TypeScript SDK Docs.
GetLocationMetadata
Get the user-defined metadata for a location.
Parameters:
location_id(str) (required): The ID of the location with which the user-defined metadata is associated. You can obtain your location ID from the location’s page.
Returns:
- (Mapping[str, Any]): : The user-defined metadata converted from JSON to a Python dictionary.
Example:
metadata = await cloud.get_location_metadata(location_id="<YOUR-LOCATION-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationID(string)
Returns:
- (map[string]interface{})
- (error): An error, if one occurred.
Example:
metadata, err := cloud.GetLocationMetadata(context.Background(), "ab1c2d3e45")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the location.
Returns:
- (Promise<Record<string, JsonValue»): The metadata associated with the location.
Example:
const metadata = await appClient.getLocationMetadata(
'<YOUR-LOCATION-ID>'
);
For more information, see the TypeScript SDK Docs.
UpdateLocationMetadata
Update the user-defined metadata for a location.
Parameters:
location_id(str) (required): The ID of the location with which to associate the user-defined metadata. You can obtain your location ID from the location’s page.metadata(Mapping[str, Any]) (required): The user-defined metadata converted from JSON to a Python dictionary.
Returns:
- None.
Example:
await cloud.update_location_metadata(location_id="<YOUR-LOCATION-ID>", metadata={
"TEST_API_KEY": "ABC123",
})
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationID(string)data(interface{})
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.UpdateLocationMetadata(
context.Background(),
"ab1c2d3e45",
map[string]interface{}{
"key": "value",
},
)
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the location.data(Record) (required): The metadata to update.
Returns:
- (Promise
)
Example:
await appClient.updateLocationMetadata('<YOUR-LOCATION-ID>', {
key: 'value',
});
For more information, see the TypeScript SDK Docs.
GetRobot
Get a machine by its ID.
Parameters:
robot_id(str) (required): ID of the machine to get. You can copy this value from the URL of the machine’s page.
Returns:
- (viam.proto.app.Robot): : The machine.
Raises:
- (GRPCError): If an invalid machine ID is passed.
Example:
machine = await cloud.get_robot(robot_id="1a123456-x1yz-0ab0-a12xyzabc")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)
Returns:
Example:
robot, err := cloud.GetRobot(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the robot.
Returns:
Example:
const robot = await appClient.getRobot('<YOUR-ROBOT-ID>');
For more information, see the TypeScript SDK Docs.
GetRobotAPIKeys
Gets the API keys for the machine.
Parameters:
robot_id(str) (required): The ID of the machine.
Returns:
- (List[viam.proto.app.APIKeyWithAuthorizations]): : The list of API keys.
Example:
api_keys = await cloud.get_robot_api_keys(robot_id="robot-id")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.robotID(string)
Returns:
- ([]*APIKeyWithAuthorizations)
- (error): An error, if one occurred.
Example:
keys, err := cloud.GetRobotAPIKeys(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
robotId(string) (required): The ID of the robot to get API keys for.
Returns:
- (Promise<APIKeyWithAuthorizations[]>): A list of the robot’s API keys.
Example:
const robotAPIKeys =
await appClient.getRobotAPIKeys('<YOUR-ROBOT-ID>');
For more information, see the TypeScript SDK Docs.
GetRobotParts
Get a list of all the parts under a specific machine.
Parameters:
robot_id(str) (required): ID of the machine to get parts from.
Returns:
- (List[RobotPart]): : The list of machine parts.
Raises:
- (GRPCError): If an invalid machine ID is passed.
Example:
list_of_parts = await cloud.get_robot_parts(
robot_id="1a123456-x1yz-0ab0-a12xyzabc"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.robotID(string)
Returns:
- ([]*RobotPart)
- (error): An error, if one occurred.
Example:
parts, err := cloud.GetRobotParts(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
robotId(string) (required): The ID of the robot to query.
Returns:
- (Promise<RobotPart[]>): The list of
RobotPartobjects associated with the robot.
Example:
const robotParts = await appClient.getRobotParts('<YOUR-ROBOT-ID>');
For more information, see the TypeScript SDK Docs.
GetRobotPart
Get a specific machine part including its part config, part address, and other information.
Parameters:
robot_part_id(str) (required): ID of the machine part to get. You can retrieve this value by navigating to the machine’s page, clicking on the part status dropdown, and clicking the copy icon next to Part ID.dest(str) (optional): Optional filepath to write the machine part’s config file in JSON format to.indent(int) (required): Size (in number of spaces) of indent when writing config to dest. Defaults to 4.
Returns:
- (RobotPart): : The machine part.
Raises:
- (GRPCError): If an invalid machine part ID is passed.
Example:
my_robot_part = await cloud.get_robot_part(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
)
# Get the part's config
machine_part_config = my_robot_part.robot_config
# Get the part's address
address = my_robot_part.fqdn
# Check if machine is live (last access time less than 10 sec ago)
if (time.time() - my_robot_part.last_access.timestamp()) <= 10:
print("Machine is live.")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)
Returns:
- (*RobotPart)
- (string)
- (error): An error, if one occurred.
Example:
part, config, err := cloud.GetRobotPart(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12",
)
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the requested robot part.
Returns:
- (Promise<GetRobotPartResponse>): The robot part and a its json config.
Example:
const robotPart = await appClient.getRobotPart('<YOUR-ROBOT-PART-ID>');
// Get the part's address
const address = robotPart.part.fqdn;
// Check if machine is live (last access time less than 10 sec ago)
if (
Date.now() - Number(robotPart.part.lastAccess.seconds) * 1000 <=
10000
) {
console.log('Machine is live');
}
For more information, see the TypeScript SDK Docs.
GetRobotPartLogs
Get the logs associated with a specific machine part.
Parameters:
robot_part_id(str) (required): ID of the machine part to get logs from.filter(str) (optional): Only include logs with messages that contain the string filter. Defaults to empty string “” (that is, no filter).dest(str) (optional): Optional filepath to write the log entries to.log_levels(List[str]) (required): List of log levels for which entries should be returned. Defaults to empty list, which returns all logs.num_log_entries(int) (required): Number of log entries to return. Passing 0 returns all logs. Defaults to 100. All logs or the first num_log_entries logs will be returned, whichever comes first.start(datetime.datetime) (optional): Optional start time for log retrieval. Only logs created after this time will be returned.end(datetime.datetime) (optional): Optional end time for log retrieval. Only logs created before this time will be returned.
Returns:
- (List[LogEntry]): : The list of log entries.
Raises:
- (GRPCError): If an invalid robot part ID is passed.
Example:
part_logs = await cloud.get_robot_part_logs(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22",
num_log_entries=20
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)opts(*GetRobotPartLogsOptions)
Returns:
- ([]*LogEntry)
- (string)
- (error): An error, if one occurred.
Example:
filter := ""
pageToken := ""
startTime := time.Now().Add(-720 * time.Hour)
endTime := time.Now()
limit := 5
source := ""
partLogs, _, err := cloud.GetRobotPartLogs(
ctx,
PART_ID,
&GetRobotPartLogsOptions{
Filter: &filter,
PageToken: &pageToken,
Levels: []string{"INFO", "WARN", "ERROR"},
Start: &startTime,
End: &endTime,
Limit: &limit,
Source: &source,
},
)
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the requested robot part.filter(string) (optional): Optional string to filter logs on.levels(string) (optional): Optional array of log levels to return. Defaults to returning all log levels.start(Date) (optional): Optional start time for log retrieval. Only logs created after this time will be returned.end(Date) (optional): Optional end time for log retrieval. Only logs created before this time will be returned.pageToken(string) (optional): Optional string indicating which page of logs to query. Defaults to the most recent.
Returns:
- (Promise<GetRobotPartLogsResponse>): The robot requested logs and the page token for the next page of logs.
Example:
const robotPartLogs = await appClient.getRobotPartLogs(
'<YOUR-ROBOT-PART-ID>'
);
For more information, see the TypeScript SDK Docs.
GetRobotPartByNameAndLocation
Query a specific robot part by name and location id.
Parameters:
name(string) (required): The name of the requested robot part.locationId(string) (required): The ID of the location of the requested robot part.
Returns:
- (Promise<GetRobotPartByNameAndLocationResponse>): The robot part.
Example:
const robotPart = await appClient.getRobotPartByNameAndLocation(
'<YOUR-ROBOT-PART-NAME>',
'<YOUR-LOCATION-ID>'
);
For more information, see the TypeScript SDK Docs.
TailRobotPartLogs
Get an asynchronous iterator that receives live machine part logs.
Parameters:
robot_part_id(str) (required): ID of the machine part to retrieve logs from.errors_only(bool) (required): Boolean specifying whether or not to only include error logs. Defaults to True.filter(str) (optional): Only include logs with messages that contain the string filter. Defaults to empty string “” (that is, no filter).
Returns:
- (viam.app._logs._LogsStream[List[LogEntry]]): : The asynchronous iterator receiving live machine part logs.
Example:
logs_stream = await cloud.tail_robot_part_logs(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)errorsOnly(bool)opts(*TailRobotPartLogsOptions)
Returns:
- (*RobotPartLogStream)
- (error): An error, if one occurred.
Example:
logFilter := "error"
stream, err := cloud.TailRobotPartLogs(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12",
true,
&app.TailRobotPartLogsOptions{
Filter: &logFilter,
},
)
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the requested robot part.queue(LogEntry) (required): A queue to put the log entries into.filter(string) (optional): Optional string to filter logs on.errorsOnly(boolean) (optional): Optional bool to indicate whether or not only error-level logs should be returned. Defaults to true.
Returns:
- (Promise
)
Example:
const robotPartLogs = await appClient.tailRobotPartLogs(
'<YOUR-ROBOT-PART-ID>'
);
For more information, see the TypeScript SDK Docs.
GetRobotPartHistory
Get a list containing the history of a machine part.
Parameters:
robot_part_id(str) (required): ID of the machine part to retrieve history from.
Returns:
- (List[RobotPartHistoryEntry]): : The list of the machine part’s history.
Raises:
- (GRPCError): If an invalid machine part ID is provided.
Example:
part_history = await cloud.get_robot_part_history(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)
Returns:
- ([]*RobotPartHistoryEntry)
- (error): An error, if one occurred.
Example:
history, err := cloud.GetRobotPartHistory(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the requested robot part.
Returns:
- (Promise<RobotPartHistoryEntry[]>): The list of the robot part’s history.
Example:
const robotPartHistory = await appClient.getRobotPartHistory(
'<YOUR-ROBOT-PART-ID>'
);
For more information, see the TypeScript SDK Docs.
UpdateRobotPart
Change the name of and assign an optional new configuration to a machine part. You can only change the name and configuration of the machine part, not the location.
Parameters:
robot_part_id(str) (required): ID of the robot part to update.name(str) (required): New name to be updated on the robot part.robot_config(Mapping[str, Any]) (optional): Optional new config represented as a dictionary to be updated on the machine part. The machine part’s config will remain as is (no change) if one isn’t passed.last_known_update(datetime.datetime) (optional): Optional time of the last known update to this part’s config. If provided, this will result in a GRPCError if the upstream config has changed since this time, indicating that the local config is out of date. Omitting this parameter will result in an overwrite of the upstream config.robot_config_json(str) (optional): Optional raw JSON string of the robot config, preserving user-defined key order. When set, this takes precedence over robot_config for storage purposes.
Returns:
- (RobotPart): : The newly updated robot part.
Raises:
- (GRPCError): If either an invalid machine part ID, name, or config is passed, or if the upstream config has changed since last_known_update.
Example:
my_machine_part = await cloud.update_robot_part(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.idname(string)robotConfig(interface{})
Returns:
- (*RobotPart)
- (error): An error, if one occurred.
Example:
robotConfig := map[string]interface{}{
"components": []map[string]interface{}{
{
"name": "camera-1",
"api": "rdk:component:camera",
"model": "rdk:builtin:fake",
"attributes": map[string]interface{}{},
},
},
}
part, err := cloud.UpdateRobotPart(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12",
"part_name",
map[string]interface{}{
"key": "value",
},
)
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the requested robot part.name(string) (required): The new name of the robot part.robotConfig(Struct) (required): The new config for the robot part.
Returns:
- (Promise<undefined | RobotPart>): The updated robot part.
Example:
const robotPart = await appClient.updateRobotPart(
'<YOUR-ROBOT-PART-ID>',
'newName'
);
For more information, see the TypeScript SDK Docs.
NewRobotPart
Create a new machine part.
Parameters:
robot_id(str) (required): ID of the machine to create a new part for. See Find machine ID for instructions on retrieving this value.part_name(str) (required): Name of the new part.
Returns:
- (str): : The new machine part’s ID.
Raises:
- (GRPCError): If either an invalid machine ID or name is passed.
Example:
new_part_id = await cloud.new_robot_part(
robot_id="1a123456-x1yz-0ab0-a12xyzabc", part_name="myNewSubPart"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.robotIDpartName(string)
Returns:
Example:
partID, err := cloud.NewRobotPart(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12",
"part_name")
For more information, see the Go SDK Docs.
Parameters:
robotId(string) (required): The ID of the robot to create a part for.partName(string) (required): The name for the new robot part.
Returns:
- (Promise
): The ID of the newly-created robot part.
Example:
const robotPartId = await appClient.newRobotPart(
'<YOUR-ROBOT-ID>',
'newPart'
);
For more information, see the TypeScript SDK Docs.
DeleteRobotPart
Delete the specified machine part.
Parameters:
robot_part_id(str) (required): ID of the machine part to delete. See Find part ID for instructions on retrieving this value.
Returns:
- None.
Raises:
- (GRPCError): If an invalid machine part ID is passed.
Example:
await cloud.delete_robot_part(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.partID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteRobotPart(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
partId(string) (required): The ID of the part to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteRobotPart('<YOUR-ROBOT-PART-ID>');
For more information, see the TypeScript SDK Docs.
MarkPartAsMain
Mark a machine part as the main part of a machine.
Parameters:
robot_part_id(str) (required): ID of the machine part to mark as main.
Returns:
- None.
Raises:
- (GRPCError): If an invalid machine part ID is passed.
Example:
await cloud.mark_part_as_main(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.partID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.MarkPartAsMain(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
partId(string) (required): The ID of the part to mark as main.
Returns:
- (Promise
)
Example:
await appClient.markPartAsMain('<YOUR-ROBOT-PART-ID>');
For more information, see the TypeScript SDK Docs.
MarkPartForRestart
Mark a specified machine part for restart.
Parameters:
robot_part_id(str) (required): ID of the machine part to mark for restart.
Returns:
- None.
Raises:
- (GRPCError): If an invalid machine part ID is passed.
Example:
await cloud.mark_part_for_restart(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.partID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.MarkPartForRestart(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
partId(string) (required): The ID of the part to mark for restart.
Returns:
- (Promise
)
Example:
await appClient.markPartForRestart('<YOUR-ROBOT-PART-ID>');
For more information, see the TypeScript SDK Docs.
CreateRobotPartSecret
Create a machine part secret.
Parameters:
robot_part_id(str) (required): ID of the machine part to create a secret for.
Returns:
- (RobotPart): : The machine part the new secret was generated for.
Raises:
- (GRPCError): If an invalid machine part ID is passed.
Example:
part_with_new_secret = await cloud.create_robot_part_secret(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.partID(string)
Returns:
- (*RobotPart)
- (error): An error, if one occurred.
Example:
part, err := cloud.CreateRobotPartSecret(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
partId(string) (required): The ID of the part to create a secret for.
Returns:
- (Promise<undefined | RobotPart>): The robot part object.
Example:
const robotPart = await appClient.createRobotPartSecret(
'<YOUR-ROBOT-PART-ID>'
);
For more information, see the TypeScript SDK Docs.
DeleteRobotPartSecret
Delete a machine part secret.
Parameters:
robot_part_id(str) (required): ID of the machine part to delete the secret from.secret_id(str) (required): ID of the secret to delete.
Returns:
- None.
Raises:
- (GRPCError): If an invalid machine part ID or secret ID is passed.
Example:
await cloud.delete_robot_part_secret(
robot_part_id="abc12345-1a23-1234-ab12-a22a22a2aa22",
secret_id="123xyz12-abcd-4321-12ab-12xy1xyz12xy")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.partIDsecretID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteRobotPartSecret(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12",
"a12bcd34-1234-12ab-1ab2-123a4567890b")
For more information, see the Go SDK Docs.
Parameters:
partId(string) (required): The ID of the part to delete a secret from.secretId(string) (required): The ID of the secret to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteRobotPartSecret(
'<YOUR-ROBOT-PART-ID>',
'<YOUR-SECRET-ID>'
);
For more information, see the TypeScript SDK Docs.
ListRobots
Get a list of all machines in a specified location.
Parameters:
location_id(str) (optional): ID of the location to retrieve the machines from. Defaults to the location ID provided at AppClient instantiation.
Returns:
- (List[viam.proto.app.Robot]): : The list of robots.
Raises:
- (GRPCError): If an invalid location ID is passed or one isn’t passed and there was no location ID provided at AppClient instantiation.
Example:
list_of_machines = await cloud.list_robots(location_id="123ab12345")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.locationID(string)
Returns:
- ([]*Robot)
- (error): An error, if one occurred.
Example:
robots, err := cloud.ListRobots(context.Background(), "ab1c2d3e45")
For more information, see the Go SDK Docs.
Parameters:
locId(string) (required): The ID of the location to list robots for.
Returns:
Example:
const robots = await appClient.listRobots('<YOUR-LOCATION-ID>');
For more information, see the TypeScript SDK Docs.
NewRobot
Create a new machine.
Parameters:
name(str) (required): Name of the new machine.location_id(str) (optional): ID of the location under which to create the machine. Defaults to the current authorized location.
Returns:
- (str): : The new robot’s ID.
Raises:
- (GRPCError): If an invalid location ID is passed or one isn’t passed and there was no location ID provided at AppClient instantiation.
Example:
new_machine_id = await cloud.new_robot(name="beepboop", location_id="my-location-id")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.namelocation(string)
Returns:
Example:
robotID, err := cloud.NewRobot(context.Background(), "robot_name", "ab1c2d3e45")
For more information, see the Go SDK Docs.
Parameters:
locId(string) (required): The ID of the location to create the robot in.name(string) (required): The name of the new robot.
Returns:
- (Promise
): The new robot’s ID.
Example:
const robotId = await appClient.newRobot(
'<YOUR-LOCATION-ID>',
'newRobot'
);
For more information, see the TypeScript SDK Docs.
UpdateRobot
Update an existing machine’s name and/or location.
You can change:
- The machine’s name (within the same location)
- The machine’s location (within the same organization)
- Both name and location simultaneously
Requirements for location changes:
- You must be an organization owner, or have owner permissions for both the current and destination locations
- The destination location must be within the same organization
- No other machine in the destination location can have the same name
Important
Moving a machine has several important implications:
- Machine address changes: The machine’s network address will change to
<machine-main-part-name>.<new-location-id>.viam.cloud. You’ll need to update any code that references the old address. - Permission changes: Access permissions will be updated. Users with access to the current location lose access, and users with access to the new location gain access to the machine.
- Data access: Users in the new location cannot access historical data from when the machine was in the previous location.
Parameters:
robot_id(str) (required): ID of the machine to update. See Find machine ID for instructions on retrieving this value.name(str) (required): New name to be updated on the machine.location_id(str) (optional): ID of the location under which the machine exists. Defaults to the location ID provided at AppClient instantiation.
Returns:
- (viam.proto.app.Robot): : The newly updated machine.
Raises:
- (GRPCError): If either an invalid machine ID, name, or location ID is passed or a location ID isn’t passed and there was no location ID provided at AppClient instantiation.
Example:
updated_robot = await cloud.update_robot(
robot_id="1a123456-x1yz-0ab0-a12xyzabc",
name="Orange-Robot",
location_id="23ab12345"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.idnamelocation(string)
Returns:
Example:
robot, err := cloud.UpdateRobot(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12", "robot_name", "ab1c2d3e45")
For more information, see the Go SDK Docs.
Parameters:
robotId(string) (required): The ID of the robot to update.locId(string) (required): The ID of the location where the robot is.name(string) (required): The name to update the robot to.
Returns:
Example:
const robot = await appClient.updateRobot(
'<YOUR-ROBOT-ID>',
'<YOUR-LOCATION-ID>',
'newName'
);
For more information, see the TypeScript SDK Docs.
DeleteRobot
Delete a specified machine.
Parameters:
robot_id(str) (required): ID of the machine to delete. See Find machine ID for instructions on retrieving this value.
Returns:
- None.
Raises:
- (GRPCError): If an invalid machine ID is passed.
Example:
await cloud.delete_robot(robot_id="1a123456-x1yz-0ab0-a12xyzabc")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteRobot(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the robot to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteRobot('<YOUR-ROBOT-ID>');
For more information, see the TypeScript SDK Docs.
GetRobotMetadata
Gets the user-defined metadata for a machine.
Parameters:
robot_id(str) (required): The ID of the robot with which the user-defined metadata is associated. You can obtain your robot ID from the machine page.
Returns:
- (Mapping[str, Any]): : The user-defined metadata converted from JSON to a Python dictionary.
Example:
metadata = await cloud.get_robot_metadata(robot_id="<YOUR-ROBOT-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.robotID(string)
Returns:
- (map[string]interface{})
- (error): An error, if one occurred.
Example:
metadata, err := cloud.GetRobotMetadata(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the robot.
Returns:
- (Promise<Record<string, JsonValue»): The metadata associated with the robot.
Example:
const metadata = await appClient.getRobotMetadata('<YOUR-ROBOT-ID>');
For more information, see the TypeScript SDK Docs.
GetRobotPartMetadata
Gets the user-defined metadata for a machine part.
Parameters:
robot_part_id(str) (required): The ID of the robot part with which the user-defined metadata is associated. You can obtain your robot part ID from the machine page.
Returns:
- (Mapping[str, Any]): : The user-defined metadata converted from JSON to a Python dictionary.
Example:
metadata = await cloud.get_robot_part_metadata(robot_part_id="<YOUR-ROBOT-PART-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.robotID(string)
Returns:
- (map[string]interface{})
- (error): An error, if one occurred.
Example:
metadata, err := cloud.GetRobotPartMetadata(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the robot part.
Returns:
- (Promise<Record<string, JsonValue»): The metadata associated with the robot part.
Example:
const metadata = await appClient.getRobotPartMetadata(
'<YOUR-ROBOT-PART-ID>'
);
For more information, see the TypeScript SDK Docs.
UpdateRobotMetadata
Updates the user-defined metadata for a machine. User-defined metadata is billed as data.
Parameters:
robot_id(str) (required): The ID of the robot with which to associate the user-defined metadata. You can obtain your robot ID from the machine page.metadata(Mapping[str, Any]) (required): The user-defined metadata converted from JSON to a Python dictionary.
Returns:
- None.
Example:
await cloud.update_robot_metadata(robot_id="<YOUR-ROBOT-ID>", metadata={
"TEST_API_KEY": "ABC123",
})
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.robotID(string)data(interface{})
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.UpdateRobotMetadata(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12",
map[string]interface{}{
"key": "value",
},
)
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the robot.data(Record) (required): The metadata to update.
Returns:
- (Promise
)
Example:
await appClient.updateRobotMetadata('<YOUR-ROBOT-ID>', {
key: 'value',
});
For more information, see the TypeScript SDK Docs.
UpdateRobotPartMetadata
Updates the user-defined metadata for a machine part. User-defined metadata is billed as data.
Parameters:
robot_part_id(str) (required)metadata(Mapping[str, Any]) (required): The user-defined metadata converted from JSON to a Python dictionary.
Returns:
- None.
Example:
await cloud.update_robot_part_metadata(robot_part_id="<YOUR-ROBOT-PART-ID>", metadata={
"TEST_API_KEY": "ABC123",
})
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.robotID(string)data(interface{})
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.UpdateRobotPartMetadata(
context.Background(),
"1ab2345c-a123-1ab2-1abc-1ab234567a12",
map[string]interface{}{
"key": "value",
},
)
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the robot part.data(Record) (required): The metadata to update.
Returns:
- (Promise
)
Example:
await appClient.updateRobotPartMetadata('<YOUR-ROBOT-PART-ID>', {
key: 'value',
});
For more information, see the TypeScript SDK Docs.
ListFragments
Get a list of fragments in the organization you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the organization to list fragments for. You can obtain your organization ID from the organization settings page.show_public(bool) (required): Optional boolean specifying whether or not to only show public fragments. If True, only public fragments will return. If False, only private fragments will return. Defaults to True. Deprecated since version 0.25.0: Use visibilities instead.visibilities(List[Fragment]) (optional): List of FragmentVisibilities specifying which types of fragments to include in the results. If empty, by default only public fragments will be returned.
Returns:
- (List[Fragment]): : The list of fragments.
Example:
fragments_list = await cloud.list_fragments(org_id="org-id", visibilities=[])
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)showPublic(bool)fragmentVisibility([]FragmentVisibility)
Returns:
- ([]*Fragment)
- (error): An error, if one occurred.
Example:
fragments, err := cloud.ListFragments(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
true,
[]app.FragmentVisibility{app.FragmentVisibilityPublic},
)
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to list fragments for.publicOnly(boolean) (optional): Optional, deprecated boolean. Use fragmentVisibilities instead. If true then only public fragments will be listed. Defaults to true.fragmentVisibility(FragmentVisibility) (optional)
Returns:
- (Promise<Fragment[]>): The list of fragment objects.
Example:
const fragments = await appClient.listFragments(
'<YOUR-ORGANIZATION-ID>'
);
For more information, see the TypeScript SDK Docs.
ListMachineFragments
Get a list of top level and nested fragments for a machine, as well as additionally specified fragment IDs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.machineID(string)additionalIDs([]string)
Returns:
- ([]*Fragment)
- (error): An error, if one occurred.
Example:
fragments, err := cloud.ListMachineFragments(context.Background(), "1ab2345c-a123-1ab2-1abc-1ab234567a12", []string{})
For more information, see the Go SDK Docs.
Parameters:
machineId(string) (required): The machine ID used to filter fragments defined in a machine’s parts. Also returns any fragments nested within the fragments defined in parts.additionalFragmentIds(string) (optional): Additional fragment IDs to append to the response. Useful when needing to view fragments that will be provisionally added to the machine alongside existing fragments.
Returns:
- (Promise<Fragment[]>): The list of top level and nested fragments for a machine, as well as additionally specified fragment IDs.
Example:
const fragments = await appClient.listMachineFragments(
'<YOUR-MACHINE-ID>'
);
For more information, see the TypeScript SDK Docs.
ListMachineSummaries
Lists machine summaries for an organization, optionally filtered by fragment IDs, location IDs, and limit.
Parameters:
organizationId(string) (required): The ID of the organization.fragmentIds(string) (optional): Optional list of fragment IDs to filter machines.locationIds(string) (optional): Optional list of location IDs to filter machines.limit(number) (optional): Optional max number of machines to return.
Returns:
- (Promise<LocationSummary[]>): The list of location summaries.
Example:
const summaries = await appClient.listMachineSummaries(
'orgId',
['frag1'],
['loc1'],
10
);
For more information, see the TypeScript SDK Docs.
GetFragment
Get a fragment by ID.
Parameters:
fragment_id(str) (required): ID of the fragment to get.version(str) (optional): Optional specification of the fragment version to get (revision or tag).
Returns:
- (Fragment): : The fragment.
Raises:
- (GRPCError): If an invalid fragment ID is passed.
Example:
# Get a fragment and print its name and when it was created.
the_fragment = await cloud.get_fragment(
fragment_id="12a12ab1-1234-5678-abcd-abcd01234567")
print("Name: ", the_fragment.name, "\nCreated on: ", the_fragment.created_on)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.idversion(string)
Returns:
- (*Fragment)
- (error): An error, if one occurred.
Example:
fragment, err := cloud.GetFragment(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2", "")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the fragment to look up.
Returns:
- (Promise<undefined | Fragment>): The requested fragment.
Example:
const fragment = await appClient.getFragment(
'12a12ab1-1234-5678-abcd-abcd01234567'
);
For more information, see the TypeScript SDK Docs.
CreateFragment
Create a new private fragment.
Parameters:
org_id(str) (required): The ID of the organization to create the fragment within. You can obtain your organization ID from the organization settings page.name(str) (required): Name of the fragment.config(Mapping[str, Any]) (optional): Optional Dictionary representation of new config to assign to specified fragment. Can be assigned by updating the fragment.
Returns:
- (Fragment): : The newly created fragment.
Raises:
- (GRPCError): If an invalid name is passed.
Example:
new_fragment = await cloud.create_fragment(org_id="org-id", name="cool_smart_machine_to_configure_several_of")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDname(string)config(map[string]interface{})opts(*CreateFragmentOptions)
Returns:
- (*Fragment)
- (error): An error, if one occurred.
Example:
fragmentConfig := map[string]interface{}{
"components": []map[string]interface{}{
{
"name": "camera-1",
"api": "rdk:component:camera",
"model": "rdk:builtin:fake",
"attributes": map[string]interface{}{},
},
},
}
fragment, err := cloud.CreateFragment(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"My Fragment",
fragmentConfig,
&app.CreateFragmentOptions{Visibility: &app.FragmentVisibilityPublic},
)
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to create the fragment under.name(string) (required): The name of the new fragment.config(Struct) (required): The new fragment’s config.
Returns:
- (Promise<undefined | Fragment>): The newly created fragment.
Example:
const fragment = await appClient.createFragment(
'<YOUR-ORGANIZATION-ID>',
'newFragment'
);
For more information, see the TypeScript SDK Docs.
UpdateFragment
Update a fragment name and its config and/or visibility.
Parameters:
fragment_id(str) (required): ID of the fragment to update.name(str) (required): New name to associate with the fragment.config(Mapping[str, Any]) (optional): Optional Dictionary representation of new config to assign to specified fragment. Not passing this parameter will leave the fragment’s config unchanged.public(bool) (optional): Boolean specifying whether the fragment is public. Not passing this parameter will leave the fragment’s visibility unchanged. A fragment is private by default when created. Deprecated since version 0.25.0: Use visibility instead.visibility(Fragment) (optional): Optional FragmentVisibility list specifying who should be allowed to view the fragment. Not passing this parameter will leave the fragment’s visibility unchanged. A fragment is private by default when created.last_known_update(datetime.datetime) (optional): Optional time of the last known update to this fragment’s config. If provided, this will result in a GRPCError if the upstream config has changed since this time, indicating that the local config is out of date. Omitting this parameter will result in an overwrite of the upstream config.
Returns:
- (Fragment): : The newly updated fragment.
Raises:
- (GRPCError): if an invalid ID, name, or config is passed, or if the upstream fragment config has changed since last_known_update.
Example:
updated_fragment = await cloud.update_fragment(
fragment_id="12a12ab1-1234-5678-abcd-abcd01234567",
name="better_name")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.idname(string)config(map[string]interface{})opts(*UpdateFragmentOptions)
Returns:
- (*Fragment)
- (error): An error, if one occurred.
Example:
fragmentConfig := map[string]interface{}{
"components": []map[string]interface{}{
{
"name": "camera-1",
"api": "rdk:component:camera",
"model": "rdk:builtin:fake",
"attributes": map[string]interface{}{},
},
},
}
fragment, err := cloud.UpdateFragment(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"My Fragment",
fragmentConfig,
&app.UpdateFragmentOptions{Visibility: &app.FragmentVisibilityPublic})
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the fragment to update.name(string) (required): The name to update the fragment to.config(Struct) (required): The config to update the fragment to.makePublic(boolean) (optional): Optional, deprecated boolean specifying whether the fragment should be public or not. If not passed, the visibility will be unchanged. Fragments are private by default when created.visibility(FragmentVisibility) (optional): Optional FragmentVisibility specifying the updated fragment visibility. If not passed, the visibility will be unchanged. If visibility is not set and makePublic is set, makePublic takes effect. If makePublic and visibility are set, they must not be conflicting. If neither is set, the fragment visibility will remain unchanged.
Returns:
- (Promise<undefined | Fragment>): The updated fragment.
Example:
const fragment = await appClient.updateFragment(
'12a12ab1-1234-5678-abcd-abcd01234567',
'better_name'
);
For more information, see the TypeScript SDK Docs.
DeleteFragment
Delete a fragment.
Parameters:
fragment_id(str) (required): ID of the fragment to delete.
Returns:
- None.
Raises:
- (GRPCError): If an invalid fragment ID is passed.
Example:
await cloud.delete_fragment(
fragment_id="12a12ab1-1234-5678-abcd-abcd01234567")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteFragment(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the fragment to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteFragment('12a12ab1-1234-5678-abcd-abcd01234567');
For more information, see the TypeScript SDK Docs.
GetFragmentHistory
Get fragment history.
Parameters:
id(str) (required): ID of the fragment to fetch history for.page_token(str | None) (optional): the page token for the fragment history collection.page_limit(int) (optional): the number of fragment history documents to return in the result. The default page limit is 10.
Returns:
- (List[FragmentHistoryEntry]): : A list of documents with the fragment history.
Raises:
- (GRPCError): if an invalid fragment id, page token or page limit is passed.
Example:
fragment_history = await cloud.get_fragment_history(
id = "12a12ab1-1234-5678-abcd-abcd01234567",
page_token = "pg-token",
page_limit = 10
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)opts(*GetFragmentHistoryOptions)
Returns:
- ([]*FragmentHistoryEntry)
- (string)
- (error): An error, if one occurred.
Example:
limit := 10
history, token, err := cloud.GetFragmentHistory(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
&app.GetFragmentHistoryOptions{PageLimit: &limit})
For more information, see the Go SDK Docs.
AddRole
Add a role under the organization you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the organization to create the role in. You can obtain your organization ID from the organization settings page.identity_id(str) (required): ID of the entity the role belongs to (for example, a user ID).role(Literal[‘owner’] | Literal[‘operator’]) (required): The role to add (either"owner"or"operator").resource_type(Literal[‘organization’] | Literal[’location’] | Literal[‘robot’]) (required): The type of the resource to add the role to (either"organization","location", or"robot"). Must match the type of theresource_id’s resource.resource_id(str) (required): ID of the resource the role applies to (the ID of either an organization, location, or machine.).
Returns:
- None.
Raises:
- (GRPCError): If either an invalid identity ID, role ID, resource type, or resource ID is passed.
Example:
await cloud.add_role(
org_id="<YOUR-ORG-ID>",
identity_id="abc01234-0123-4567-ab12-a11a00a2aa22",
role="owner",
resource_type="location",
resource_id="111ab12345"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDidentityID(string)role(AuthRole)resourceType(AuthResourceType)resourceID(string)
Returns:
- (error): An error, if one occurred.
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to create the role under.entityId(string) (required): The ID of the entity the role belongs to (for example a user ID).role(string) (required): The role to add (“owner” or “operator”).resourceType(string) (required): The type of resource to create the role for (“robot”, “location”, or “organization”).resourceId(string) (required): The ID of the resource the role is being created for.
Returns:
- (Promise
)
Example:
await appClient.addRole(
'<YOUR-ORGANIZATION-ID>',
'<YOUR-USER-ID>',
'owner',
'robot',
'<YOUR-ROBOT-ID>'
);
For more information, see the TypeScript SDK Docs.
RemoveRole
Remove a role under the organization you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the organization the role exists in. You can obtain your organization ID from the organization settings page.identity_id(str) (required): ID of the entity the role belongs to (for example, a user ID).role(Literal[‘owner’] | Literal[‘operator’]) (required): The role to remove.resource_type(Literal[‘organization’] | Literal[’location’] | Literal[‘robot’]) (required): Type of the resource the role is being removed from. Must match resource_id.resource_id(str) (required): ID of the resource the role applies to (that is, either an organization, location, or robot ID).
Returns:
- None.
Raises:
- (GRPCError): If either an invalid identity ID, role ID, resource type, or resource ID or is passed.
Example:
await cloud.remove_role(
org_id="<YOUR-ORG-ID>",
identity_id="abc01234-0123-4567-ab12-a11a00a2aa22",
role="owner",
resource_type="location",
resource_id="111ab12345"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.authorization(*Authorization)
Returns:
- (error): An error, if one occurred.
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to remove the role from.entityId(string) (required): The ID of the entity the role belongs to (for example a user ID).role(string) (required): The role to remove (“owner” or “operator”).resourceType(string) (required): The type of resource to remove the role from (“robot”, “location”, or “organization”).resourceId(string) (required): The ID of the resource the role is being removes from.
Returns:
- (Promise
)
Example:
await appClient.removeRole(
'<YOUR-ORGANIZATION-ID>',
'<YOUR-USER-ID>',
'owner',
'robot',
'<YOUR-ROBOT-ID>'
);
For more information, see the TypeScript SDK Docs.
ChangeRole
Changes an existing role to a new role.
Parameters:
organization_id(str) (required): ID of the organization.old_identity_id(str) (required): ID of the entity the role belongs to (for example, a user ID).old_role(Literal[‘owner’] | Literal[‘operator’]) (required): The role to be changed.old_resource_type(Literal[‘organization’] | Literal[’location’] | Literal[‘robot’]) (required): Type of the resource the role is added to. Must match old_resource_id.old_resource_id(str) (required): ID of the resource the role applies to (that is, either an organization, location, or robot ID).new_identity_id(str) (required): New ID of the entity the role belongs to (for example, a user ID).new_role(Literal[‘owner’] | Literal[‘operator’]) (required): The new role.new_resource_type(Literal[‘organization’] | Literal[’location’] | Literal[‘robot’]) (required): Type of the resource to add role to. Must match new_resource_id.new_resource_id(str) (required): New ID of the resource the role applies to (that is, either an organization, location, or robot ID).
Returns:
- None.
Example:
await cloud.change_role(
organization_id="<YOUR-ORG-ID>",
old_identity_id="abc01234-0123-4567-ab12-a11a00a2aa22",
old_role="operator",
old_resource_type="location",
old_resource_id="111ab12345",
new_identity_id="abc01234-0123-4567-ab12-a11a00a2aa22",
new_role="owner",
new_resource_type="organization",
new_resource_id="abc12345"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.oldAuthorization(*Authorization)newOrgIDnewIdentityID(string)newRole(AuthRole)newResourceType(AuthResourceType)newResourceID(string)
Returns:
- (error): An error, if one occurred.
For more information, see the Go SDK Docs.
Parameters:
oldAuthorization(Authorization) (required): The existing authorization.newAuthorization(Authorization) (required): The new authorization to change to.
Returns:
- (Promise
)
Example:
const oldAuth = new VIAM.appApi.Authorization({
authorizationType: 'role',
authorizationId: 'organization_owner',
organizationId: '<YOUR-ORGANIZATION-ID>',
resourceId: '<YOUR-RESOURCE-ID>', // The resource to grant access to
resourceType: 'organization', // The type of resource to grant access to
identityId: '<USER-ID>', // The user id of the user to grant access to (optional)
roleId: 'owner', // The role to grant access to
identityType: 'user',
});
const newAuth = new VIAM.appApi.Authorization({
authorizationType: 'role',
authorizationId: 'organization_operator',
organizationId: '<YOUR-ORGANIZATION-ID>',
resourceId: '<YOUR-RESOURCE-ID>', // The resource to grant access to
resourceType: 'organization', // The type of resource to grant access To
identityId: '<USER-ID>', // The user id of the user to grant access to (optional)
roleId: 'operator', // The role to grant access to
identityType: 'user',
});
await appClient.changeRole(oldAuth, newAuth);
For more information, see the TypeScript SDK Docs.
ListAuthorizations
List all authorizations (owners and operators) of a specific resource (or resources) within the organization you are currently authenticated to. If no resource IDs are provided, all resource authorizations within the organizations are returned.
Parameters:
org_id(str) (required): The ID of the organization to list authorizations for.resource_ids(List[str]) (optional): IDs of the resources to retrieve authorizations from. If None, defaults to all resources.
Returns:
- (List[viam.proto.app.Authorization]): : The list of authorizations.
Raises:
- (GRPCError): If an invalid resource ID is passed.
Example:
list_of_auths = await cloud.list_authorizations(
org_id="<YOUR-ORG-ID>",
resource_ids=["1a123456-x1yz-0ab0-a12xyzabc"])
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)resourceIDs([]string)
Returns:
- ([]*Authorization)
- (error): An error, if one occurred.
Example:
err := cloud.ListAuthorizations(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
[]string{"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2"},
)
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to list authorizations for.resourceIds(string) (optional): Optional list of IDs of resources to list authorizations for. If not provided, all resources will be included.
Returns:
- (Promise<Authorization[]>): The list of authorizations.
For more information, see the TypeScript SDK Docs.
CheckPermissions
Check if the organization, location, or robot your ViamClient is authenticated to is permitted to perform some action or set of actions on the resource you pass to the method.
Parameters:
permissions(List[viam.proto.app.AuthorizedPermissions]) (required): the permissions to validate (for example, “read_organization”, “control_robot”).
Returns:
- (List[viam.proto.app.AuthorizedPermissions]): : The permissions argument, with invalid permissions filtered out.
Raises:
- (GRPCError): If the list of permissions to validate is empty.
Example:
from viam.proto.app import AuthorizedPermissions
# Check whether the entity you're currently authenticated to has permission to control and/or
# read logs from robots in the "organization-identifier123" org
permissions = [AuthorizedPermissions(resource_type="organization",
resource_id="<YOUR-ORG-ID>",
permissions=["control_robot",
"read_robot_logs"])]
filtered_permissions = await cloud.check_permissions(permissions)
Valid arguments for permissions are as follows:
For more information about managing permissions, see Role-Based Access Control.
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.permissions([]*AuthorizedPermissions)
Returns:
- ([]*AuthorizedPermissions)
- (error): An error, if one occurred.
Example:
err := cloud.CheckPermissions(
context.Background(),
[]*app.AuthorizedPermissions{
{
ResourceType: app.AuthResourceTypeLocation,
ResourceID: "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
Permissions: []string{"control_robot", "read_robot_logs"},
},
},
)
For more information, see the Go SDK Docs.
Parameters:
permissions(AuthorizedPermissions) (required): A list of permissions to check.
Returns:
- (Promise<AuthorizedPermissions[]>): A filtered list of the authorized permissions.
For more information, see the TypeScript SDK Docs.
GetRegistryItem
Get metadata about a registry item (a module, training script, or ML model) by registry item ID.
Parameters:
item_id(str) (required): The ID of the registry item. This is the namespace and name of the item in the form namespace:name. For example, Viam’s csi-cam-pi module’s item ID would be viam:csi-cam-pi. You can also use org-id:name. For example, abc01234-0123-4567-ab12-a11a00a2aa22:training-script.include_markdown_documentation(bool) (required)
Returns:
- (viam.proto.app.RegistryItem): : The registry item.
Example:
item = await cloud.get_registry_item("item-id")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.itemID(string)
Returns:
- (*RegistryItem)
- (error): An error, if one occurred.
Example:
registryItem, err := cloud.GetRegistryItem(context.Background(), "namespace:name")
For more information, see the Go SDK Docs.
Parameters:
itemId(string) (required): The ID of the item to get.
Returns:
- (Promise<undefined | RegistryItem>): The requested item.
Example:
const registryItem = await appClient.getRegistryItem(
'<YOUR-REGISTRY-ITEM-ID>'
);
For more information, see the TypeScript SDK Docs.
CreateRegistryItem
Create a registry item.
Parameters:
organization_id(str) (required): The organization to create the registry item under.name(str) (required): The name of the registry item, which must be unique within your org.type(viam.proto.app.packages.PackageType.ValueType) (required): The type of the item in the registry.
Returns:
- None.
Example:
from viam.proto.app.packages import PackageType
await cloud.create_registry_item("<YOUR-ORG-ID>", "name", PackageType.PACKAGE_TYPE_ML_MODEL)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDname(string)packageType(PackageType)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.CreateRegistryItem(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"registry_item_name",
app.PackageTypeMLModel)
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to create the registry item under.name(string) (required): The name of the registry item.type(PackageType) (required): The type of the item in the registry.
Returns:
- (Promise
)
Example:
await appClient.createRegistryItem(
'<YOUR-ORGANIZATION-ID>',
'newRegistryItemName',
5
);
For more information, see the TypeScript SDK Docs.
UpdateRegistryItem
Update a registry item.
Parameters:
item_id(str) (required): The ID of the registry item, containing either the namespace and module name (for example, my-org:my-module) or organization ID and module name (org-id:my-module).type(viam.proto.app.packages.PackageType.ValueType) (required): The type of the item in the registry.description(str) (required): The description of the registry item.visibility(viam.proto.app.Visibility.ValueType) (required): The visibility of the registry item.
Returns:
- None.
Example:
from viam.proto.app.packages import PackageType
from viam.proto.app import Visibility
await cloud.update_registry_item(
"your-namespace:your-name",
PackageType.PACKAGE_TYPE_ML_TRAINING,
"description",
Visibility.VISIBILITY_PUBLIC
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.itemID(string)packageType(PackageType)description(string)visibility(Visibility)opts(*UpdateRegistryItemOptions)
Returns:
- (error): An error, if one occurred.
Example:
siteURL := "https://example.com"
err := cloud.UpdateRegistryItem(
context.Background(),
"namespace:name",
app.PackageTypeMLModel,
"description",
app.VisibilityPrivate,
&app.UpdateRegistryItemOptions{URL: &siteURL},
)
For more information, see the Go SDK Docs.
Parameters:
itemId(string) (required): The ID of the registry item to update.type(PackageType) (required): The PackageType to update the item to.description(string) (required): A description of the item.visibility(Visibility) (required): A visibility value to update to.
Returns:
- (Promise
)
Example:
await appClient.updateRegistryItem(
'<YOUR-REGISTRY-ITEM-ID>',
5, // Package: ML Model
'new description',
1 // Private
);
For more information, see the TypeScript SDK Docs.
ListRegistryItems
List the registry items in an organization.
Parameters:
organization_id(str) (required): The ID of the organization to return registry items for.types(List[viam.proto.app.packages.PackageType.ValueType]) (required): The types of registry items.visibilities(List[viam.proto.app.Visibility.ValueType]) (required): The visibilities of registry items.platforms(List[str]) (required): The platforms of registry items.statuses(List[viam.proto.app.RegistryItemStatus.ValueType]) (required): The types of the items in the registry.search_term(str) (optional): The search term of the registry items.page_token(str) (optional): The page token of the registry items.
Returns:
- (List[viam.proto.app.RegistryItem]): : The list of registry items.
Example:
from viam.proto.app.packages import PackageType
from viam.proto.app import Visibility, RegistryItemStatus
# List private, published ml training scripts in your organization
registry_items = await cloud.list_registry_items(
organization_id="<YOUR-ORG-ID>",
types=[PackageType.PACKAGE_TYPE_ML_TRAINING],
visibilities=[Visibility.VISIBILITY_PRIVATE],
platforms=[""],
statuses=[RegistryItemStatus.REGISTRY_ITEM_STATUS_PUBLISHED]
)
# List public, published linux modules in all organizations
registry_items = await cloud.list_registry_items(
organization_id="",
types=[PackageType.PACKAGE_TYPE_MODULE],
visibilities=[Visibility.VISIBILITY_PUBLIC],
platforms=["linux/any"],
statuses=[RegistryItemStatus.REGISTRY_ITEM_STATUS_PUBLISHED]
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(*string)types([]PackageType)visibilities([]Visibility)platforms([]string)statuses([]RegistryItemStatus)opts(*ListRegistryItemsOptions)
Returns:
- ([]*RegistryItem)
- (error): An error, if one occurred.
Example:
organizationID := "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2"
searchTerm := ""
pageToken := ""
namespaces := []string{}
items, err := cloud.ListRegistryItems(
context.Background(),
&organizationID,
[]app.PackageType{app.PackageTypeModule},
[]app.Visibility{app.VisibilityPublic},
[]string{"linux/any"},
[]app.RegistryItemStatus{app.RegistryItemStatusPublished},
&app.ListRegistryItemsOptions{
SearchTerm: &searchTerm,
PageToken: &pageToken,
PublicNamespaces: namespaces,
},
)
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to query registry items for.types(PackageType) (required): A list of types to query. If empty, will not filter on type.visibilities(Visibility) (required): A list of visibilities to query for. If empty, will not filter on visibility.platforms(string) (required): A list of platforms to query for. If empty, will not filter on platform.statuses(RegistryItemStatus) (required): A list of statuses to query for. If empty, will not filter on status.searchTerm(string) (optional): Optional search term to filter on.pageToken(string) (optional): Optional page token for results. If not provided, will return all results.
Returns:
- (Promise<RegistryItem[]>): The list of registry items.
Example:
const registryItems = await appClient.listRegistryItems(
'<YOUR-ORGANIZATION-ID>',
[], // All package types
[1], // Private packages
[],
[1] // Active packages
);
For more information, see the TypeScript SDK Docs.
DeleteRegistryItem
Delete a registry item.
Parameters:
item_id(str) (required): The ID of the deleted registry item, containing either the namespace and module name (for example, my-org:my-module) or organization ID and module name (org-id:my-module).
Returns:
- None.
Example:
await cloud.delete_registry_item("your-namespace:your-name")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.itemID(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteRegistryItem(context.Background(), "namespace:name")
For more information, see the Go SDK Docs.
Parameters:
itemId(string) (required): The ID of the item to delete.
Returns:
- (Promise
)
Example:
await appClient.deleteRegistryItem('<YOUR-REGISTRY-ITEM-ID>');
For more information, see the TypeScript SDK Docs.
CreateModule
Create a module under the organization you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the organization to create the module under. You can obtain your organization ID from the organization settings page.name(str) (required): The name of the module. Must be unique within your organization.
Returns:
Raises:
- (GRPCError): If an invalid name (for example, “”) is passed.
Example:
new_module = await cloud.create_module(org_id="org-id", name="cool_new_hoverboard_module")
print("Module ID:", new_module[0])
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgIDname(string)
Returns:
Example:
moduleID, url, err := cloud.CreateModule(
context.Background(),
"a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2",
"module_name",
)
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to create the module under.name(string) (required): The name of the module.
Returns:
- (Promise<CreateModuleResponse>): The module ID and a URL to its detail page.
Example:
const module = await appClient.createModule(
'<YOUR-ORGANIZATION-ID>',
'newModule'
);
For more information, see the TypeScript SDK Docs.
UpdateModule
Update the documentation URL, description, models, entrypoint, and/or the visibility of a module.
Parameters:
module_id(str) (required): ID of the module being updated, containing either the namespace and module name (for example, my-org:my-module) or organization ID and module name (org-id:my-module).url(str) (required): The url to reference for documentation and code (NOT the url of the module itself).description(str) (required): A short description of the module that explains its purpose.models(List[viam.proto.app.Model]) (optional): list of models that are available in the module.entrypoint(str) (required): The executable to run to start the module program.public(bool) (required): The visibility that should be set for the module. Defaults to False (private).
Returns:
- (str): : The URL of the newly updated module.
Raises:
- (GRPCError): If either an invalid module ID, URL, list of models, or organization ID is passed.
Example:
from viam.proto.app import Model
model = Model(
api="rdk:component:base",
model="my-group:cool_new_hoverboard_module:wheeled"
)
url_of_my_module = await cloud.update_module(
module_id="my-group:cool_new_hoverboard_module",
url="https://docsformymodule.viam.com",
models=[model],
description="A base to support hoverboards.",
entrypoint="exec"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.moduleID(string)visibility(Visibility)urldescription(string)models([]*Model)apps([]*App)entrypoint(string)opts(*UpdateModuleOptions)
Returns:
Example:
model := &app.Model{
API: "rdk:service:generic",
Model: "docs-test:new_test_module:test_model",
}
app := &app.App{
Name: "app_name",
Type: "app_type",
Entrypoint: "entrypoint",
}
firstRun := "first_run.sh"
url, err := cloud.UpdateModule(
context.Background(),
"namespace:name",
app.VisibilityPublic,
"https://example.com",
"description",
[]*app.Model{model},
[]*app.App{app},
"entrypoint",
&app.UpdateModuleOptions{FirstRun: &firstRun},
)
For more information, see the Go SDK Docs.
Parameters:
moduleId(string) (required): The ID of the module to update.visibility(Visibility) (required): The visibility to set for the module.url(string) (required): The url to reference for documentation, code, etc.description(string) (required): A short description of the module.models(Model) (required): A list of models available in the module.entrypoint(string) (required): The executable to run to start the module program.
Returns:
- (Promise
): The module URL.
Example:
const module = await appClient.updateModule(
'<YOUR-MODULE-ID>',
1,
'https://example.com',
'new description',
[{ model: 'namespace:group:model1', api: 'rdk:component:generic' }],
'entrypoint'
);
For more information, see the TypeScript SDK Docs.
UploadModuleFile
Upload a module file.
Parameters:
module_file_info(viam.proto.app.ModuleFileInfo) (required): Relevant metadata.file(bytes) (required): Bytes of file to upload.
Returns:
- (str): : URL of uploaded file.
Example:
from viam.proto.app import ModuleFileInfo
module_file_info = ModuleFileInfo(
module_id = "sierra:cool_new_hoverboard_module",
version = "1.0.0",
platform = "darwin/arm64"
)
file_id = await cloud.upload_module_file(
module_file_info=module_file_info,
file=b"<file>"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.fileInfo(ModuleFileInfo)file([]byte)
Returns:
Example:
moduleFileInfo := app.ModuleFileInfo{
ModuleID: "namespace:name",
Version: "1.0.0",
Platform: "darwin/arm64",
}
fileURL, err := cloud.UploadModuleFile(context.Background(), fileInfo, []byte("empty.txt"))
For more information, see the Go SDK Docs.
GetModule
Get a module by its ID.
Parameters:
module_id(str) (required): ID of the module being retrieved, containing either the namespace and module name (for example, my-org:my-module) or organization ID and module name (org-id:my-module).
Returns:
- (viam.proto.app.Module): : The module.
Raises:
- (GRPCError): If an invalid module ID is passed.
Example:
the_module = await cloud.get_module(module_id="my-group:my-cool-modular-base")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.moduleID(string)
Returns:
Example:
module, err := cloud.GetModule(context.Background(), "namespace:name")
For more information, see the Go SDK Docs.
Parameters:
moduleId(string) (required): The ID of the module.
Returns:
- (Promise<undefined | Module>): The requested module.
Example:
const module = await appClient.getModule('<YOUR-MODULE-ID>');
For more information, see the TypeScript SDK Docs.
ListModules
List the modules under the organization you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the organization to list modules for. You can obtain your organization ID from the organization settings page.
Returns:
- (List[viam.proto.app.Module]): : The list of modules.
Example:
modules_list = await cloud.list_modules("<YOUR-ORG-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.opts(*ListModulesOptions)
Returns:
- ([]*Module)
- (error): An error, if one occurred.
Example:
orgID := "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2"
modules, err := cloud.ListModules(context.Background(), &app.ListModulesOptions{OrgID: &orgID})
For more information, see the Go SDK Docs.
Parameters:
organizationId(string) (required): The ID of the organization to query.
Returns:
- (Promise<Module[]>): The organization’s modules.
Example:
const modules = await appClient.listModules('<YOUR-ORGANIZATION-ID>');
For more information, see the TypeScript SDK Docs.
CreateKey
Create a new API key.
Parameters:
org_id(str) (required): The ID of the organization to create the key for. You can obtain your organization ID from the organization settings page.authorizations(List[APIKeyAuthorization]) (required): A list of authorizations to associate with the key.name(str) (optional): A name for the key. If None, defaults to the current timestamp.
Returns:
Raises:
- (GRPCError): If the authorizations list is empty.
Example:
from viam.app.app_client import APIKeyAuthorization
auth = APIKeyAuthorization(
role="owner",
resource_type="robot",
resource_id="your-machine-id123"
)
api_key, api_key_id = cloud.create_key(
org_id="<YOUR-ORG-ID>",
authorizations=[auth],
name="my_key"
)
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)keyAuthorizations([]APIKeyAuthorization)name(string)
Returns:
For more information, see the Go SDK Docs.
Parameters:
authorizations(Authorization) (required): The list of authorizations to provide for the API key.name(string) (optional): An optional name for the key. If none is passed, defaults to present timestamp.
Returns:
- (Promise<CreateKeyResponse>): The new key and ID.
For more information, see the TypeScript SDK Docs.
DeleteKey
Delete an API key.
Parameters:
id(str) (required): The ID of the API key.
Returns:
- None.
Example:
await cloud.delete_key("key-id")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)
Returns:
- (error): An error, if one occurred.
Example:
err := cloud.DeleteKey(context.Background(), "a1bcdefghi2jklmnopqrstuvw3xyzabc")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the key to delete.
Returns:
- (Promise<DeleteKeyResponse>)
Example:
await appClient.deleteKey('<YOUR-KEY-ID>');
For more information, see the TypeScript SDK Docs.
RotateKey
Rotate an API key.
Parameters:
id(str) (required): The ID of the key to be rotated.
Returns:
Example:
key, id = await cloud.rotate_key("key-id")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.id(string)
Returns:
Example:
id, key, err := cloud.RotateKey(context.Background(), "a1bcdefghi2jklmnopqrstuvw3xyzabc")
For more information, see the Go SDK Docs.
Parameters:
id(string) (required): The ID of the key to rotate.
Returns:
- (Promise<RotateKeyResponse>): The updated key and ID.
Example:
const key = await appClient.rotateKey('<YOUR-KEY-ID>');
For more information, see the TypeScript SDK Docs.
ListKeys
List all keys for the organization that you are currently authenticated to.
Parameters:
org_id(str) (required): The ID of the organization to list API keys for. You can obtain your organization ID from the organization settings page.
Returns:
- (List[viam.proto.app.APIKeyWithAuthorizations]): : The existing API keys and authorizations.
Example:
keys = await cloud.list_keys(org_id="<YOUR-ORG-ID>")
For more information, see the Python SDK Docs.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.orgID(string)
Returns:
- ([]*APIKeyWithAuthorizations)
- (error): An error, if one occurred.
Example:
keys, err := cloud.ListKeys(context.Background(), "a1b2c345-abcd-1a2b-abc1-a1b23cd4561e2")
For more information, see the Go SDK Docs.
Parameters:
orgId(string) (required): The ID of the organization to query.
Returns:
- (Promise<APIKeyWithAuthorizations[]>): The list of API keys.
Example:
const keys = await appClient.listKeys('<YOUR-ORGANIZATION-ID>');
For more information, see the TypeScript SDK Docs.
RenameKey
RenameKey renames an API key and returns its ID and name.
Parameters:
ctx(Context): A Context carries a deadline, a cancellation signal, and other values across API boundaries.idname(string)
Returns:
Example:
_, name, err := cloud.RenameKey(context.Background(), "a1bcdefghi2jklmnopqrstuvw3xyzabc", "new_name")
For more information, see the Go SDK Docs.
CreateKeyFromExistingKeyAuthorizations
Create a new API key with an existing key’s authorizations.
Parameters:
id(str) (required): the ID of the API key to duplication authorizations from.
Returns:
Example:
api_key, api_key_id = await cloud.create_key_from_existing_key_authorizations(
id="INSERT YOUR API KEY ID")
For more information, see the Python SDK Docs.
Parameters:
id(string) (required): The ID of the key to duplicate.
Returns:
- (Promise<CreateKeyFromExistingKeyAuthorizationsResponse>): The new key and ID.
Example:
const key =
await appClient.createKeyFromExistingKeyAuthorizations(
'<YOUR-KEY-ID>'
);
For more information, see the TypeScript SDK Docs.
GetAppContent
Retrieve the app content for an organization.
Parameters:
publicNamespace(string) (required): The public namespace of the organization.name(string) (required): The name of the app.
Returns:
- (Promise<GetAppContentResponse>): The blob path and entrypoint of the app content.
Example:
const appContent = await appClient.getAppContent(
'<YOUR-PUBLIC-NAMESPACE>',
'<YOUR-APP-NAME>'
);
For more information, see the TypeScript SDK Docs.
GetAppBranding
Retrieves the app branding for an organization or app.
Parameters:
publicNamespace(string) (required): The public namespace of the organization.name(string) (required): The name of the app.
Returns:
- (Promise<GetAppBrandingResponse>): The branding information for the app.
Example:
const branding = await appClient.getAppBranding(
'<YOUR-PUBLIC-NAMESPACE>',
'<YOUR-APP-NAME>'
);
For more information, see the TypeScript SDK Docs.
Find part ID
To copy the ID of your machine part, select the part status dropdown to the right of your machine’s location and name on the top of its page and click the copy icon next to Part ID:

Find machine ID
To copy the ID of your machine, click the … (Actions) button in the upper-right corner of your machine’s page, then click Copy machine ID:
Was this page helpful?
Glad to hear it! If you have any other feedback please let us know:
We're sorry about that. To help us improve, please tell us what we can do better:
Thank you!