The REST API provides the following methods for managing variables:

GET /admin/variables

URI

GET /admin/variables

Description

Returns a list of all variables and their values.

All encrypted values are returned as "********".

Request Header

Accept: application/json, text/html

Accept: application/vnd.orchestral.rhapsody.6_0+json

The parameters overrideValue and overridden are not applicable to versions of Rhapsody before Rhapsody 6.2.3. Therefore, they are not returned when using this Accept header.

Accept: application/vnd.orchestral.rhapsody.6_2_3+json

Request Body

Empty.

Response Status 200 OK - operation successful.

Response Body

text/html displays a JSP with all the variables in a table; application/json returns a JSON representation of the variables, for example:

{
  "data":{
    "variables":[
      {
        "value":"********",
        "encrypted":true,
        "name":"var10",
		"overrideValue": "********",
		"overridden": false
      },
      {
        "value":"abcde",
        "encrypted":false,
        "name":"var11",
		"overrideValue": "defghi",
		"overridden": true
      },
      {
        "value":"12345",
        "encrypted":false,
        "name":"var12",
		"overrideValue": "67890",
		"overridden": false
      }
    ]
  },
  "error":null
}	

Access Rights

'Read variables REST API'.

PUT /admin/variables

URI

PUT /admin/variables

Description

Replaces all existing variables in the engine with the variables and their attributes (values and encryption status) you provide. An optional commit comment can be provided.

This method should only be used to modify variables for set-up purposes only; it does not update any dependent components referencing those variables. We strongly recommend against modifying Rhapsody variables dynamically (at run-time) via the REST API.

It is recommended you use HTTPS when sending the plain text values of variables that are to be encrypted.

Request Header



Content-Type: application/json
CSRF Protection Enabled    

Accept: application/vnd.orchestral.rhapsody.6_0+json
Content-Type: application/vnd.orchestral.rhapsody.6_0+json

CSRF Protection Enabled

The parameters overrideValue and overridden are not applicable to versions of Rhapsody before Rhapsody 6.2.3. Therefore, any attempt to use them to make a request using this Accept header in earlier versions would result in a response error.

Accept: application/vnd.orchestral.rhapsody.6_2_3+json
Content-Type: application/vnd.orchestral.rhapsody.6_2_3+json
 
CSRF Protection Enabled

Request Parameter

commitComment - a string containing the comment to use for the commit. If a commit comment is passed as a request parameter in the URL and present in the request body, then the former overrides the latter.

Request Body

An array of variables, for example:

{
    "variables":[    
      {
	    "name":"database_password",
        "value": "pa55w0rd",
        "encrypted": true,
		"overrideValue": "alt_pa55w0rd",
		"overridden": true
       },
       {
		 "name":"_DbServ",
         "value": "devsql2005",
         "encrypted": false,
		 "overrideValue": "prodsql2005",
		 "overridden": true
       },
       {
		 "name":"_userpass",
         "value": "servicedelivery",
         "encrypted": false,
		 "overrideValue": "",
		 "overridden": false
       }
     ],
    "commitComment":"myComment"  
}

Response Status

200 OK - operation successful.
500 Internal Server Error - the variables could not be modified because a Rhapsody IDE session has them checked out.

Response Body Empty.

Access Rights

'Write variables REST API'.
'Locker Edit' (for all lockers where the modified variables are used in the engine).

GET /admin/variables/<name>

URI

GET /admin/variables/<name>

Description

Returns the value of the named variable.

All encrypted values are returned as "********".

Request Header

Accept: application/json

Accept: application/vnd.orchestral.rhapsody.6_0+json

The parameters overrideValue and overridden are not applicable to versions of Rhapsody before Rhapsody 6.2.3. Therefore, they are not returned when using this Accept header.


Accept: application/vnd.orchestral.rhapsody.6_2_3+json

Request Body

Empty.

Response Status

200 OK - operation successful.

Response Body
{
  "data:
   {
    "name":"database_password",
    "value": "********",
    "encrypted": true,
    "overrideValue": "********",
    "overridden": false
   },
  "error":null
}

Access Rights

'Read variables REST API'.

PUT /admin/variables/<name>

URI

PUT /admin/variables/<name>

Description

Updates the parameters (the value and encryption status) of the named variable as specified. If the variable does not exist, a new variable is created with the data provided. An optional commit comment can be provided.

This method should only be used to modify variables for set-up purposes only; it does not update any dependent components referencing those variables. We strongly recommend against modifying Rhapsody variables dynamically (at run-time) via the REST API.

It is recommended you use HTTPS when sending the plain text values of variables that are to be encrypted.

Request Header

Content-Type:application/json
CSRF Protection Enabled

Accept: application/vnd.orchestral.rhapsody.6_0+json
Content-Type: application/vnd.orchestral.rhapsody.6_0+json

CSRF Protection Enabled

The parameters overrideValue and overridden are not applicable to versions of Rhapsody before Rhapsody 6.2.3. Therefore, any attempt to use them to make a request using this Accept header results in a response error.

Accept: application/vnd.orchestral.rhapsody.6_2_3+json
Content-Type: application/vnd.orchestral.rhapsody.6_2_3+json
 
CSRF Protection Enabled

Request Body

A variable object, for example:

{
    "value": "pa55w000rd",
    "encrypted": true,
    "commitComment":"myComment",
	"overrideValue": "alt_pa55w000rd",
	"overridden": true
}

Response Status

200 OK - operation successful.
500 Internal Server Error - the variables could not be modified because a Rhapsody IDE session has them checked out.

Response Body Empty.

Access Rights

'Write variables REST API'.
'Locker edit' (for all lockers where the modified variables are used in the engine).