Usage

General syntax

ubidots <command> <subcommand> <argument> [options]

Available commands

config

This command configures the CLI's cloud settings required to connect with your Ubidots account. This means that you must run this command prior to any other. It will prompt you for:

  • API domain: Leave the default value unless you are on a private Ubidots deployment.

  • Authentication method: The authentication method that you'd like to use.

  • Access token: A valid Ubidots token.

ubidots config

API Domain [https://industrial.api.ubidots.com]: 
Authentication Method [TOKEN]: 
Access Token [*******************************pPem]: 

> [DONE]: Configuration saved successfully.

This configuration will be saved at $HOME/.ubidots_cli/config.yaml. You can check it by running cat:

cat $HOME/.ubidots_cli/config.yaml

access_token: <ubidots-token> 
api_domain: https://industrial.api.ubidots.com
auth_method: X-Auth-Token

devices

This command allows you to perform CRUD operations over devices in Ubidots. Its subcommands are:

Usage: ubidots devices [OPTIONS] COMMAND [ARGS]...                             
                                                                                
 Device management and operations.                                              
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                  │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ add        Adds a new device.                                                │
│ delete     Deletes a specific device using its id or label.                  │
│ get        Retrieves a specific device using its id or label.                │
│ list       Lists all available devices.                                      │
│ update     Update a device.                                                  │
╰──────────────────────────────────────────────────────────────────────────────╯

1. Create a device

Create a device in your Ubidots account.

Usage: ubidots devices add [OPTIONS] LABEL                                     
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
  label      TEXT  The label for the device. [required]                       │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --name                TEXT  The name of the device.                          
 --description         TEXT  A brief description of the device.               
 --organization        TEXT  The organization associated with the device. Its 
                             id or ['~label' | \~label].                      
 --tags                TEXT  Comma-separated tags for the device. e.g.        
                             tag1,tag2,tag3                                   
 --properties          TEXT  Device properties in JSON format. [default: {}]  
 --help                      Show this message and exit.                      
╰──────────────────────────────────────────────────────────────────────────────╯

2. Get device

Retrieve a device from Ubidots.

Usage: ubidots devices get [OPTIONS]                                           
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --id            TEXT  Unique identifier for the device. If both id and       
                       label are provided, the id takes precedence.           
 --label         TEXT  Descriptive label identifier for the device.           
                       Ignored if id is provided.                             
 --fields        TEXT  Comma-separated fields to process. e.g.                
                       field1,field2,field3                                   
                       [default: id,label,name]                               
 --help                Show this message and exit.                            
╰──────────────────────────────────────────────────────────────────────────────╯

3. Update device

Update a device in your Ubidots account.

Update an existing device settings on Ubidots.

 Usage: ubidots devices update [OPTIONS]                                        
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --id                  TEXT  Unique identifier for the device. If both id     
                             and label are provided, the id takes precedence. 
 --label               TEXT  Descriptive label identifier for the device.     
                             Ignored if id is provided.                       
 --new-label           TEXT  The label for the device.                        
 --new-name            TEXT  The name of the device.                          
 --description         TEXT  A brief description of the device.               
 --organization        TEXT  The organization associated with the device. Its 
                             id or ['~label' | \~label].                      
 --tags                TEXT  Comma-separated tags for the device. e.g.        
                             tag1,tag2,tag3                                   
 --properties          TEXT  Device properties in JSON format. [default: {}]  
 --help                      Show this message and exit.                      
╰──────────────────────────────────────────────────────────────────────────────╯

4. Delete a device

Delete a device from your Ubidots account.

 Usage: ubidots devices delete [OPTIONS]                                        
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --id           TEXT  Unique identifier for the device. If both id and        
                      label are provided, the id takes precedence.            
 --label        TEXT  Descriptive label identifier for the device.            
                      Ignored if id is provided.                              
 --help               Show this message and exit.                             
╰──────────────────────────────────────────────────────────────────────────────╯

This command permanently deletes the device, just like removing it through the platform, thus special care is advised.

5. List all devices

Retrieve all devices from your Ubidots account.

 Usage: ubidots devices list [OPTIONS]                                                                 
                                                                                                       
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────╮
 --fields           TEXT          Comma-separated fields to process * e.g. field1,field2,field3. *   
                                  Available fields: (id, label, name, createdAt, description,        
                                  isActive, lastActivity, organization, location, tags, url,         
                                  variables, variablesCount, properties). For more details, visit    │
                                  the documentation at:                                              
                                  https://docs.ubidots.com/reference/device-object                   
                                  [default: id,label,name]                                           
 --filter           TEXT          Filter results by attributes. e.g.                                 
                                  'key1=val1&key2__in=val20,val21' or                                
                                  key1=val1\&key2__in=val20,val21                                    
 --sort-by          TEXT          Attribute to sort the result set by.                               
 --page-size        INTEGER       Defines the page number to be retrieved.                           
 --page             INTEGER       Defines how many items per page are retrieved.                     
 --format           [table|json]  [default: table]                                                   
 --help                           Show this message and exit.                                        
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯

variables

This command allows you to perform CRUD operations over variables in Ubidots. Its subcommands are:

Usage: ubidots variables [OPTIONS] COMMAND [ARGS]...                           
                                                                                
 Variable management and operations.                                            
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --help          Show this message and exit.                                  
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
 add         Adds a new variable.                                             
 delete      Deletes a specific variable using its id                         
 get         Retrieves a specific variable using its id.                      
 list        Lists all available variables.                                   
 update      Update a variable.                                               
╰──────────────────────────────────────────────────────────────────────────────╯

1. Create a variable

Create a new variable in a given device in Ubidots.

 Usage: ubidots variables add [OPTIONS] DEVICE [LABEL] [NAME]                   
                                                                                
╭─ Arguments ──────────────────────────────────────────────────────────────────╮
      device      TEXT     The device associated with the variable. Its id or 
                           ['~label'|\~label].                                
                           [required]                                         │
      label       [LABEL]  The label for the variable.                        │
      name        [NAME]   The name of the variable.                          │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Options ────────────────────────────────────────────────────────────────────╮
 --description                 TEXT             A brief description of the    
                                                variable.                     
 --type                        [raw|synthetic]  The type of variable.         
                                                [default: raw]                
 --unit                        TEXT             The unit of measurement that  
                                                represents the variable.      
 --synthetic-expression        TEXT             If the variable is of type    
                                                'synthetic', this is the      
                                                corresponding synthetic       
                                                expression used to calculate  
                                                its value.                    
 --tags                        TEXT             Comma-separated tags for the  
                                                variable. e.g. tag1,tag2,tag3 
 --properties                  TEXT             Device properties in JSON     
                                                format.                       
                                                [default: {}]                 
 --min                         INTEGER          Lowest value allowed.         
 --max                         INTEGER          Highest value allowed.        
 --help                                         Show this message and exit.   
╰──────────────────────────────────────────────────────────────────────────────╯

2. Get a variable

Retrieve a variable from Ubidots.

 Usage: ubidots variables get [OPTIONS]                                         
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
    --id            TEXT  Unique identifier for the variable. [required]      │
    --fields        TEXT  Comma-separated fields to process. e.g.             
                          field1,field2,field3                                
                          [default: id,label,name]                            
    --help                Show this message and exit.                         
╰──────────────────────────────────────────────────────────────────────────────╯

3. Update a variable

Update a variable in Ubidots.

 Usage: ubidots variables update [OPTIONS]                                      
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
    --id                          TEXT             Unique identifier for      
                                                   the variable.              
                                                   [required]                 │
    --new-label                   TEXT             The label for the          
                                                   variable.                  
    --new-name                    TEXT             The name of the variable.  
    --description                 TEXT             A brief description of the 
                                                   variable.                  
    --type                        [raw|synthetic]  The type of variable.      
                                                   [default: raw]             
    --unit                        TEXT             The unit of measurement    
                                                   that represents the        
                                                   variable.                  
    --synthetic-expression        TEXT             If the variable is of type 
                                                   'synthetic', this is the   
                                                   corresponding synthetic    
                                                   expression used to         
                                                   calculate its value.       
    --tags                        TEXT             Comma-separated tags for   
                                                   the variable. e.g.         
                                                   tag1,tag2,tag3             
    --properties                  TEXT             Device properties in JSON  
                                                   format.                    
                                                   [default: {}]              
    --min                         INTEGER          Lowest value allowed.      
    --max                         INTEGER          Highest value allowed.     
    --help                                         Show this message and      
                                                   exit.                      
╰──────────────────────────────────────────────────────────────────────────────╯

4. Delete a variable

Delete a variable from your Ubidots account.

 Usage: ubidots variables delete [OPTIONS]                                      
                                                                                
╭─ Options ────────────────────────────────────────────────────────────────────╮
    --id          TEXT  Unique identifier for the variable. [required]        │
    --help              Show this message and exit.                           
╰──────────────────────────────────────────────────────────────────────────────╯

This command permanently deletes the variable, just like removing it through the platform, thus special care is advised.

5. List all variables

List all variables on your Ubidots account

 Usage: ubidots variables list [OPTIONS]                                                               
                                                                                                       
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────╮
 --fields           TEXT          Comma-separated fields to process * e.g. field1,field2,field3. *   
                                  Available fields: (id, label, name, createdAt,                     
                                  syntheticExpression, description, device, lastActivity, lastValue, 
                                  properties, tags, type, unit, url, valuesUrl). For more details,   │
                                  visit the documentation at:                                        
                                  https://docs.ubidots.com/reference/variable-object                 
                                  [default: id,label,name]                                           
 --filter           TEXT          Filter results by attributes. e.g.                                 
                                  'key1=val1&key2__in=val20,val21' or                                
                                  key1=val1\&key2__in=val20,val21                                    
 --sort-by          TEXT          Attribute to sort the result set by.                               
 --page-size        INTEGER       Defines the page number to be retrieved.                           
 --page             INTEGER       Defines how many items per page are retrieved.                     
 --format           [table|json]  [default: table]                                                   
 --help                           Show this message and exit.                                        
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯

functions

This command allows you to:

  • Perform CRUD operations over UbiFunctions in Ubidots.

  • Set up a local development environment for UbiFunctions.

It's subcommands are:

Usage: ubidots functions [OPTIONS] COMMAND [ARGS]...                          
                                                                               
 Tool for managing and deploying functions.                                    
                                                                               
╭─ Options ───────────────────────────────────────────────────────────────────╮
 --help          Show this message and exit.                                 
╰─────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────╮
 add       Adds a new function.                                              
 delete    Deletes a specific function using its id or label.                
 get       Retrieves a specific function using its id or label.              
 list      Lists all available functions.                                    
 update    Update a function.                                                
╰─────────────────────────────────────────────────────────────────────────────╯

1. Create a function

Create an UbiFunction in your Ubidots account.

 Usage: ubidots functions add [OPTIONS] NAME                                   
                                                                               
╭─ Arguments ─────────────────────────────────────────────────────────────────╮
     name      TEXT  The name of the function. [required]                    │
╰─────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────╮
 --label                       TEXT                   The label for the      
                                                      function.              
 --runtime                     [python3.9:lite|pytho  The runtime for the    
                               n3.9:base|python3.9:f  function.              
                               ull|python3.11:lite|p  [default:              
                               ython3.11:base|python  nodejs20.x:lite]       
                               3.11:full|nodejs20.x:                         
                               lite|nodejs20.x:base]                         
 --raw            --no-raw                            Flag to determine if   
                                                      the output should be   
                                                      in raw format.         
                                                      [default: no-raw]      
 --token                       TEXT                   Optional               
                                                      authentication token   
                                                      to invoke the          
                                                      function.              
 --methods                     TEXT                   The HTTP methods the   
                                                      function will respond  
                                                      to.                    
                                                      [default: GET]         
 --cors           --no-cors                           Flag to enable         
                                                      Cross-Origin Resource  
                                                      Sharing (CORS) for the │
                                                      function.              
                                                      [default: no-cors]     
 --cron                        TEXT                   Cron expression to     
                                                      schedule the function  
                                                      for periodic           
                                                      execution.             
                                                      [default: * * * * *]   
 --environment                 TEXT                   environment in JSON    
                                                      format.                
                                                      [default: []]          │
 --help                                               Show this message and  
                                                      exit.                  
╰─────────────────────────────────────────────────────────────────────────────╯

2. Get an UbiFunction

Retrieve an UbiFunction from Ubidots.

 Usage: ubidots functions get [OPTIONS]                                        
                                                                               
╭─ Options ───────────────────────────────────────────────────────────────────╮
 --id            TEXT  Unique identifier for the function. If both id                               and label are provided, the id takes precedence.      
 --label         TEXT  Descriptive label identifier for the function.       
                       Ignored if id is provided.                            
 --fields        TEXT  Comma-separated fields to process. e.g.               
                       field1,field2,field3                                  
                       [default: id,label,name]                              
 --help                Show this message and exit.                           
╰─────────────────────────────────────────────────────────────────────────────╯

3. Update an UbiFunction

Update an existing UbiFunction in Ubidots.

 Usage: ubidots functions update [OPTIONS]                                                     
                                                                                               
╭─ Options ───────────────────────────────────────────────────────────────────────────────────╮
 --id                          TEXT                           Unique identifier for the      
                                                              function. If both id and label                                                               are provided, the id takes     
                                                              precedence.                    
 --label                       TEXT                           Descriptive label              
                                                              identifier for the             
                                                              function. Ignored if id is    
                                                              provided.                      
 --new-label                   TEXT                           The label for the device.      
 --new-name                    TEXT                           The name of the device.        
 --runtime                     [python3.9:lite|python3.9:bas  The runtime for the function.  
                               e|python3.9:full|python3.11:l  [default: nodejs20.x:lite]     
                               ite|python3.11:base|python3.1                                 
                               1:full|nodejs20.x:lite|nodejs                                 
                               20.x:base]                                                    
 --raw            --no-raw                                    Flag to determine if the       
                                                              output should be in raw        
                                                              format.                        
                                                              [default: no-raw]              
 --token                       TEXT                           Optional authentication token  
                                                              to invoke the function.        
 --methods                     TEXT                           The HTTP methods the function  
                                                              will respond to.               
                                                              [default: GET]                 
 --cors           --no-cors                                   Flag to enable Cross-Origin    
                                                              Resource Sharing (CORS) for
                                                              the function.                  
                                                              [default: no-cors]             
 --cron                        TEXT                           Cron expression to schedule    
                                                              the function for periodic      
                                                              execution.                     
                                                              [default: * * * * *]           
 --environment                 TEXT                           environment in JSON format.    
                                                              [default: []]                  │
 --help                                                       Show this message and exit.    
╰─────────────────────────────────────────────────────────────────────────────────────────────╯

4. Delete an UbiFunction

Delete an UbiFunction from your Ubidots account.

 Usage: ubidots functions delete [OPTIONS]                                                     
                                                                                               
╭─ Options ───────────────────────────────────────────────────────────────────────────────────╮
 --id           TEXT  Unique identifier for the function. If both id and label are          
                      provided, the id takes precedence.                                     
 --label        TEXT  Descriptive label **identifier** for the function. Ignored if id is    
                      provided.                                                              
 --help               Show this message and exit.                                            
╰─────────────────────────────────────────────────────────────────────────────────────────────╯

This command permanently deletes the UbiFunction, just like removing it through the platform, thus special care is advised.

5. List all UbiFunctions

List all UbiFunctions on your account.

 Usage: ubidots functions list [OPTIONS]                                                               
                                                                                                       
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────╮
 --fields           TEXT          Comma-separated fields to process * e.g. field1,field2,field3. *   
                                  Available fields: (url, id, label, name, isActive, createdAt,      
                                  serverless, triggers, environment, zipFileProperties).             │
                                  [default: id,label,name]                                           
 --filter           TEXT          Filter results by attributes. e.g.                                 
                                  'key1=val1&key2__in=val20,val21' or                                
                                  key1=val1\&key2__in=val20,val21                                    
 --sort-by          TEXT          Attribute to sort the result set by.                               
 --page-size        INTEGER       Defines the page number to be retrieved.                           
 --page             INTEGER       Defines how many items per page are retrieved.                     
 --format           [table|json]  [default: table]                                                   
 --help                           Show this message and exit.                                        
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯

Last updated