LogoLogo
HomeSupportCommunity
  • Introduction
    • Overview
    • Get Started
      • Platforms & Packages
      • Use Cases
    • Glossary of Terms
  • Software
    • Bluetooth Wifi Onboarding Package (r3onboard)
    • Device Package
      • Supported Platforms
      • Installation
      • Usage
    • NPM Package
    • CLI
      • Supported Platforms
      • Installation
    • Docker
      • Remote.It Agent
      • Remote.it Docker Extension
    • Desktop
      • Installation
    • Web Portal & Mobile
    • Custom Solutions
  • Features
    • Services
      • SSH
      • RDP and VNC
      • SMB and CIFS
      • HTTP/S
      • Database
      • Redis
      • UDP
      • Gaming
      • VPN
    • Connection Options
      • LAN Sharing
      • Jump Service
      • Peer-2-Peer & Proxy
    • Logging
    • Organizations
  • Developer Tools
    • Authentication
    • API
      • Using Developer Tools
      • Usage
        • Devices and Services
        • Event Logs
        • Connections
        • Access Keys
        • Device Sharing
        • Custom Attributes
        • Scripting
    • CLI Usage
    • Webhooks
      • Slack Integration
    • Docker
    • Device Scripting
    • Zero-Trust AWS Access
      • AWS RDS (Postgres and MySQL)
    • Zero Trust Azure Cloud Access
    • Zero Trust Google Cloud Access
  • OEM & Bulk Provisioning
    • Overview
    • Auto Registration into Your Account
      • Create a Product
      • Production Image
      • Field Production
    • Registration into a User's Account
Powered by GitBook
On this page
  • Add/Update Attribute
  • Category and Status Fields
  • Remove Attribute
  • Set Multiple Attributes
  • Retrieve Attributes

Was this helpful?

  1. Developer Tools
  2. API
  3. Usage

Custom Attributes

Attributes can be added to Users, Devices and Services. Attributes can have overrides defined by context. This is used for your own custom metadata.

Add/Update Attribute

Parameter
Data Type
Description

name

String

required

Name of attribute

value

String

required

Value of attribute null to remove

serviceId

String

required

The userId, deviceId or serviceId the attribute is assigned to

context

String

defined context of the attribute. Allows for override of attribute value for the same name

mutation {
  setAttribute(
    name: "CustomAttribute",
    value: "ValueOfAttribute",
    serviceId: "80:00:00:00:12:34:56:78",
    context: "CustomContext"
  )
}

Query Response

{
  "data": {
    "setAttribute": "ValueOfAttribute"
  }
}

Category and Status Fields

We have reserved names of remote.it Device attributes which will be displayed on the Web Portal and Desktop UIs. These attributes are for Category and Status fields. The UI currently can display Category A-E and Status A-E. These must be set against the Device ID (also known as the Bulk Service's "Service ID" of the remote.it Device). The convention for the name is $remoteit.categoryA for category attributes and $remoteit.statusA for status attributes. The convention is the same for removing and retrieving these attributes.

Example Category Mutation

mutation {
  setAttribute(
    name: "$remoteit.categoryA",
    value: "my category A value",
    serviceId: "80:00:00:00:12:34:56:78",
  )
}

Remove Attribute

mutation {
  setAttribute(
    name: "CustomAttribute",
    value: null,
    serviceId: "80:00:00:00:12:34:56:78",
  )
}

Set Multiple Attributes

This method shows how to update multiple attributes on a single device by passing in a JSON formatted variables.

#Query
mutation UpdateMultipleAttributes($attributes: Object!, $serviceId: String!) {
	setAttributes(attributes: $attributes, serviceId: $serviceId)
}

#Variables
{
  "attributes": {
    "$remoteit": {
      "categoryA": "Uptime: 1h, 06m",
      "categoryB": "Version: 1.0",
      "categoryC": "Serial Number: x292jsu2",
      "categoryD": "MAC: AUWS83729A"
    },
    "MoreJsonAttributes": {
      "version": "1.0"
    },
    "StringAttribute": "newvalue"
  },
  "serviceId": "80:00:00:00:01:12:12:12"
}

Retrieve Attributes

{
  login {
    attributes #User Attributes
    devices{
      items{
        attributes #Device Attributes
        services{ 
          attributes(context: "customContext") #Service Attributes
        }
      }			
    }
  }
}

Query Response

{
  "data": {
    "login": {
      "attributes": { #User Attributes
	"newAttribute": "CustomAttributeValue",
	},
     "devices": {
	"items": [
	{
	"attributes": { #Device Attributes
	  "newAttribute": "CustomAttributeValue"
	},
	"services": [
	{
	  "attributes": { #Service Attributes
	     "newAttribute": "ContextAttributeValue"
	   }
	},...]						
	}
	]
      }
    }
  }
}
PreviousDevice SharingNextScripting

Last updated 3 years ago

Was this helpful?