A Method instance sub resource represents a method entity. Since methods always belong to some owner entity (i.e. app profile or device profile), they are usually accessed through their parent's path (you can access a property resource directly by id for some operations; see methods section).
Admin vs Data API
Methods resource represents different meanings when used from Admin and Data services APIs.
When used from Admin Services API, it represents the definition or metadata of a method. The user can create new methods, modify and delete existing ones through this service.
When used from Data Services API, it provides information about the execution performance of the device or app method - see Device State object.
Please note that when we say method we refer to the method definition created within a profile entity which is uniquely identified by an id. On the other had, when we say device or app method, we refer to the instance of this method created under an object which is uniquely identified by both its parent object's id and its definition's id.
|id||A 23 to 26 characters long string that uniquely identifies this property.|
|accountId||The unique id of the account that created this method.|
|name||A name that uniquely identifies the method among its siblings. Unlike other resources, method name cannot be used as slug since the name is only context sensitive.|
|friendlyName||Human friendly name of the method.|
|ownerId||The entity owning the method definition. Owner entity can be device profile, or app profile.|
|access||Can be either |
|methodImpl||Method implementation object. See below.|
|qualifiedName||A name that uniquely identifies this method within its owner account context. Qualified name is used in object method queries to eliminate name ambiguity.|
|locked||if locked, entity cannot be modified, deleted.|
|dateCreated||The date that this method was created in ISO 8601 format.|
|dateModified||The date that this method was modified in ISO 8601 format.|
See Writing Method Implementations for details.
Access Types Explained
Methods can be called from other methods, public methods can be called from external clients.
private method can be accessed from the methods of the same object. Child object cannot call its parent's private methods. It cannot be overriden by child object, nor be called by external clients.
protected method can be accessed from the methods of the same object. Child object can call its parent's protected methods. It can be overriden by child object, but it cannot be called by external clients.
public method can be accessed from the methods of the same object and its child. It can be overriden by child object. It can be executed by any external client with
Public methods can be called remotely to send commands to devices, or get aggregate data about the devices (e.g. dashboard).
Max Method Execution Time
Default method execution time is set to 5 seconds for standard accounts. If a method takes longer than the allowed time, or throws an exception, the method instance is automatically quarantined / disabled for its owning device or app. In such case you need to explicitly enable it to continue working. All method errors are listed under device/app log. Note that you can get more visibility about your method's sanity in the device/app log by turning your device/app status to debug while testing.