Skip to end of metadata
Go to start of metadata

The UI on GadgetKeeper allows for three basic operations on methods:

A REST API tool, such as API Explorer provides additional operations for methods, such as get/set method details, etc. See Method Operations with REST API for more information.

Create Method

A new method for a "thing" can be created by clicking "New" in the "Methods" section of the thing. A dialog box opens with the following settings

Field Required Description Dialog
Name                           
x

Method name.

  • Must be unique within a thing.
  • Can contain: The page Constraint - thing method name does not exist.

 

   
Type x

Method type:

Request Data Type
  Method request data type (input argument to script function)
Response Data Type   Method response data type (return argument from script function)
Private   If set, then method can be only called from methods/function/triggers of the same thing.
Description   Method description.

 



Icon

After a method has been created, it can be edited anytime by:

  1. Selecting the method in the "Methods" section of the "thing"
  2. Clicking "Edit" in the details panel. A similar dialog box will open with the retained settings:

 

Code Method Script

All script methods must have a script function provided for it, as explained in Method Script.

The name of the function must be the same as the method's name

Call Method

Methods can be called to perform any of the possible interactions on GadgetKeeper, plus they can interact with external services, such as Twitter. There are many ways to call or execute a method, as explained in Create and Execute Method. They can be called by UI , REST API, script function, or  dashboard widget. The "Call method" dialog box on the UI is explained here. To open the dialog box for "Call Method":

  1. Select the method in the "Methods" section of the "thing"
  2. Click "Call" in the details panel
 Field Required Description  Dialog
Arguments  

If an input (Request) argument is required for the method's script function, it must be entered in the text area with the same "Request Data Type" that was defined in the Create/Edit Method dialog box

 

Result  

If an output (Response) argument is returned from the method's script function, it will  show up in the "Result" text area after "Call" is clicked to execute the script function. The returned value will have the same "Response Data Type" that was defined in the Create/Edit Method dialog box

 

 

 

Icon

This example shows how "Hello World" can be given an the input (Request) argument for the updateStatus(string) function. When this function is called, it sends the string to an external service API, so no output "Response" will be returned for display in the "Result" text area

 

 

 

 

 

 

 

 

  • No labels