Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > RightScale API 1.5 > Overview > Parameters

Parameters

Table of Contents

Overview

Parameters are the key for any API call. For every call, unless there are no parameters involved, there is a table that defines all the required and optional parameters. The table has various columns that describe the characteristics of a parameter.

  • name: This describes the name which should be passed with the parameter.
  • required: If 'yes', this parameter is mandatory and cannot be skipped. If the parameter is a second level parameter (defined below), the condition applies only if the first level parameter is passed.
  • type: Different types include 'String', 'Array', 'Hash'. The examples provided below describe how to pass different types of parameters. (Note that it may vary depending on the client used to invoke the API.)
  • values: Denotes if the parameter is restricted to only a set of values. For example, in the 'index' action for 'Instances' resource, the parameter 'view' has the 'values' column to be ['default', 'extended', 'full'], meaning any other value passed will result in a ParameterError. A '*' denotes that the value can be anything.
  • regexp: Specifies if the value of the parameter needs to match a regular expression. A '*' denotes that the value can be anything.
  • blank?: If 'yes', this parameter can take a blank string as a value. If 'no', the parameter cannot be blank.
  • description: Describes what the parameter means and how it is used.
  • Examples: To illustrate on how to pass parameters, we use 'curl', a built-in tool on most unix and mac osX based machines. Note that if you are using a custom library in python, ruby etc., the usage differs.

Parameters

String

  • The simplest of all types and can be passed as mentioned in the documentation. e.g.

 

 name  type

 param1

 String

 param2

 String

 

Array

  • The parameter takes in an array of values. e.g.

 

 name  type
 param1  Array
 param2  Array

 

  • curl ... -d param1[]=value1 -d param1[]=value2 -d param2[]=value3 ...
  • The above command will post 'value1' and 'value2' as an array for 'param1' and 'value3' for 'param2'.

Hash

  • The parameter is a hash and is not necessarily passed on its own. It is usually passed in with the keys that are inside the hash. A common occurrence is as:

 name  type
 param1  Hash
 param1 [a]  String
 param1 [b]  String

 

  • curl ... -d param1[a]=value1 -d param1[b]=value2 ...


Here 'param1' is a first level parameter and 'param1[a]', 'param1[b]' are second level parameters.
Another example including both second level parameters and different types:

 name  type
 param1  Hash
 param1 [a]  String
 param1 [b]  Array
 param1 [c]  Hash
 param1 [c][d]  String

 

  • curl ... -d param1[a]=value1 -d param1[b][]=value2 -d param1[b][]=value3 -d param1[c][d]=value4 ...

See also

 

You must to post a comment.
Last modified
23:17, 16 May 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.