SAS Micro Analytic Service Media Types

application/vnd.sas.microanalytic.module

The application/vnd.sas.microanalytic.module media type describes the module that is returned by the SAS Micro Analytic Service when source code is posted or put to the module’s collection.
Here are the link relations for the application/vnd.sas.microanalytic.module media type.
Relationship
HTTP Method
Description
self
GET
A link to the individual module.
URI: SASMicroAnalyticService/rest/modules/{moduleId}
Media type: application/vnd.sas.microanalytic.module
up
GET
A link to the collection of modules.
URI: SASMicroAnalyticService/rest/modules
Media type: application/vnd.sas.collection
steps
GET
A link to the collection of steps. This is created when a module is compiled.
URI: SASMicroAnalyticService/rest/modules/{moduleId}/steps
Media type: application/vnd.sas.collection
source
GET
A link to the source code that was used to compile a module.
URI: SASMicroAnalyticService/rest/modules/{moduleId}/source
Media type: application/vnd.sas.microanalytic.module.source
update
PUT
A link to update a module.
URI: SASMicroAnalyticService/rest/modules/{moduleId}
Media type: application/vnd.sas.microanalytic.module
delete
DELETE
A link to remove a module.
URI: SASMicroAnalyticService/rest/modules/{moduleId}
The application/vnd.sas.microanalytic.module media type contains the following members.
Name
Type
Description
version
integer
The media type's schema version number. This representation is version 1.
id
string
A generated unique string identifying a module in an installation.
description
string
Text describing the rules and logic performed by the module. The description is specified in the POST or PUT request body and carried over.
name
string
The name associated with the module.
creationTimeStamp
string
The formatted time stamp that tells when the module was initially created.
modifiedTimeStamp
string
The formatted time stamp that tells when the module was last revised.
revision
integer
The revision number of the module. It is a whole number starting from one and increases by one each time the module is revised.
scope
string (ENUM)
The scope restricts how a module can be used. There are two possible values:
public
The module is available to be called outside another module.
private
The module can be called only from within another module.
steps
array of string
An array of step IDs in the module.
properties
array
The properties that were specified for the module. Here are the representation members:
name
string - The name of the property.
value
string - The value of this property.
warnings
object
Optional object, as described in application/vnd.sas.error. This is included if the compiling of this resource produces any warning.
links
array of link objects
Zero or more link objects. See the table above for a description of the link types.
Here is an example of application/vnd.sas.microanalytic.module+json:
{  
   "links":[  
      {  
         "method":"GET",
         "rel":"self",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 359fb21e-c65d-4b8d-81e0-216d95cb0825",
         "uri":"/modules/359fb21e-c65d-4b8d-81e0-216d95cb0825",
         "type":"application/vnd.sas.microanalytic.module"
      },
      {  
         "method":"GET",
         "rel":"up",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules",
         "uri":"/modules",
         "type":"application/vnd.sas.collection"
      },
      {  
         "method":"GET",
         "rel":"source",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 359fb21e-c65d-4b8d-81e0-216d95cb0825/source",
         "uri":"/modules/359fb21e-c65d-4b8d-81e0-216d95cb0825/source",
         "type":"application/vnd.sas.microanalytic.module.source"
      },
      {  
         "method":"GET",
         "rel":"steps",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 359fb21e-c65d-4b8d-81e0-216d95cb0825/steps",
         "uri":"/modules/359fb21e-c65d-4b8d-81e0-216d95cb0825/steps",
         "type":"application/vnd.sas.collection"
      },
      {  
         "method":"PUT",
         "rel":"update",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 359fb21e-c65d-4b8d-81e0-216d95cb0825",
         "uri":"/modules/359fb21e-c65d-4b8d-81e0-216d95cb0825",
         "type":"application/vnd.sas.microanalytic.module"
      },
      {  
         "method":"DELETE",
         "rel":"delete",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 359fb21e-c65d-4b8d-81e0-216d95cb0825",
         "uri":"/modules/359fb21e-c65d-4b8d-81e0-216d95cb0825"
      }
   ],
   "scope":"public",
   "description":"575",
   "id":"359fb21e-c65d-4b8d-81e0-216d95cb0825",
   "steps":[  
      "execute",
      "executeFinalRuleSets",
      "executeFirstDotRuleSets",
      "executeInitRuleSets",
      "executeLastDotRuleSets",
      "initRuleFiredRecording",
      "initializeLookupHash",
      "recordRuleFired",
      "resetRuleFiredHash",
      "term"
   ],
   "properties":[  
      {  
         "name":"connectionString",
         "value":"DRIVER=base;"
      }
   ],
   "revision":1,
   "creationTimeStamp":"2015-04-16T16:05:38.000-0400",
   "modifiedTimeStamp":"2015-04-16T16:05:38.000-0400",
   "name":"Rule575",
   "version":1
}

application/vnd.sas.microanalytic.module.definition

The application/vnd.sas.microanalytic.module.definition media type describes the resource that is used to define a revision of the SAS Micro Analytic Service module in the module’s collection. It is used in the request body of POST and PUT in the module’s collection.
The application/vnd.sas.microanalytic.module.definition media type contains the following members.
Name
Type
Description
version
integer
This media type's schema version number. This representation is version 1.
description
string
The text describing the logic of the module.
code
string
The source code. (For example, DS2 source code)
type
string
The source code type. In this version, the only valid value is text/vnd.sas.source.ds2.
properties
array
This can be used to define connection strings. If a property definition is not needed, this can be omitted or specified as an empty array. Here are the representation members:
name
string - The name of the property. It cannot contain spaces and must be unique. Version 1 allows only connectionString as the value.
value
string - The value of this property.
scope
string (ENUM)
The scope restricts how a module can be used. There are two possible values:
public
The module is available to be called outside another module.
private
The module can be called only from within another module.
Here is an example of application/vnd.sas.microanalytic.module.definition+json:
{
"version": "1",
"description": "Sample module",
"scope" : "public",
"type" : "text/vnd.sas.source.ds2",
"properties" : [],
"code" : "ds2_options sas;\n package sampleModule / overwrite=yes;
          \n \n method copy_charN_array(char(12) in_array[4], in_out char(12)
          out_array[4]);\n out_array := in_array;\n end;\n \n
          method copy_varchar_array(varchar(512) in_array[3],
          in_out varchar out_array[3]);\n out_array := in_array;\n end;\n \n
          method copy_int_array(int in_array[5], in_out int out_array[5]);\n
          out_array := in_array;\n end;\n \n method copy_float_array(double in_array[2],
          in_out double out_array[2]);\n out_array := in_array;\n end;\n \n
          method copy_bigint_array(bigint in_array[1], in_out bigint out_array[1]);\n
          out_array := in_array;\n end;\n \n method copy_arrays( char(12)
          in_charN_array[4],\n varchar(512) in_varchar_array[1],\n int in_int_array[5],
          \n double in_double_array[2], \n bigint in_bigint_array[1], \n
          in_out char(12)  out_charN_array[4],\n in_out varchar(512)
          out_varchar_array[1],\n in_out int out_int_array[5],\n
          in_out double out_double_array[2],\n in_out bigint out_bigint_array[1]);\n \n
          copy_charN_array(in_charN_array, out_charN_array);\n copy_int_array(in_int_array,
          out_int_array);\n copy_float_array(in_double_array, out_double_array);\n
          copy_bigint_array(in_bigint_array, out_bigint_array);\n \n end;\n \n
          endpackage;\n \n \n"
}
Note: There are many \n strings throughout the source code. They help to signal line breaks to the DS2 compiler. Line breaks are useful because, in JSON representation, the entire source code must be presented as one long string and the \n returns the line breaks to you. If there are errors, the compiler messages will not all refer to line 1. If your platform is UNIX or Linux, you can use the sed command to convert \n into a real line break character. Here is the pattern for the sed command: -e "s#\\n#\n#g".

application/vnd.sas.microanalytic.module.source

The application/vnd.sas.microanalytic.module.source media type describes the source code resource that is created by the SAS Micro Analytic Service when a POST or PUT is performed on the module’s collection.
Here are the link relations for the application/vnd.sas.microanalytic.module.source media type.
Relationship
HTTP Method
Description
self
GET
A link to the source code that was used to compile the module.
URI: SASMicroAnalyticService/rest//modules/{moduleId}/source
Media type: application/vnd.sas.microanalytic.module.source
up
GET
A link back to the module.
URI: SASMicroAnalyticService/rest//modules/{ModuleID}
Media type: application/vnd.sas.microanalytic.module
The application/vnd.sas.microanalytic.module.source media type contains the following members.
Name
Type
Description
version
integer
This media type's schema version number. This representation is version 1.
moduleId
string
A generated unique string identifying a module in an installation.
source
string
The source code used to create the module.
links
array of link objects
Zero or more link objects. See the table above for a description of the link types.
Here is an example of application/vnd.sas.microanalytic.module.source +json:
{  
   "moduleId":"36af8e3c-6a37-4494-a8e0-9cc96ad62232",
   "source":"ds2_options sas;\n package sampleModule / overwrite=yes; \n \n
    method copy_charN_array(char(12) in_array[4], in_out char(12)  out_array[4]);\n
    out_array := in_array;\n end;\n \n method copy_varchar_array(varchar(512) in_array[3],
    in_out varchar out_array[3]);\n out_array := in_array;\n end;\n \n
    method copy_int_array(int in_array[5], in_out int out_array[5]);\n out_array := in_array;\n
    end;\n \n method copy_float_array(double in_array[2], in_out double out_array[2]);\n
    out_array := in_array;\n end;\n \n method copy_bigint_array(bigint in_array[1],
    in_out bigint out_array[1]);\n out_array := in_array;\n end;\n \n method copy_arrays( char(12)
    in_charN_array[4],\n varchar(512) in_varchar_array[1],\n int in_int_array[5],
    \n double in_double_array[2], \n bigint in_bigint_array[1], \n in_out char(12)
    out_charN_array[4],\n in_out varchar(512) out_varchar_array[1],\n in_out int out_int_array[5],\n
    in_out double out_double_array[2],\n in_out bigint out_bigint_array[1]);\n \n
    copy_charN_array(in_charN_array, out_charN_array);\n copy_int_array(in_int_array, out_int_array);\n
    copy_float_array(in_double_array, out_double_array);\n copy_bigint_array(in_bigint_array,
    out_bigint_array);\n \n end;\n \n endpackage;\n \n \n",
   "links":[  
      {  
         "method":"GET",
         "rel":"self",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 36af8e3c-6a37-4494-a8e0-9cc96ad62232/source",
         "uri":"/modules/36af8e3c-6a37-4494-a8e0-9cc96ad62232/source",
         "type":"application/vnd.sas.microanalytic.module.source"
      },
      {  
         "method":"GET",
         "rel":"up",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
          36af8e3c-6a37-4494-a8e0-9cc96ad62232",
         "uri":"/modules/36af8e3c-6a37-4494-a8e0-9cc96ad62232",
         "type":"application/vnd.sas.microanalytic.module"
      }
   ],
   "version":1
}

application/vnd.sas.microanalytic.module.step

The application/vnd.sas.microanalytic.module.step media type describes the step that is returned by SAS Micro Analytic Service when a GET is performed on the step’s collection. Step instances are created by posting a module to the module’s collection.
Here are the link relations for the application/vnd.sas.microanalytic.module.step media type.
Relationship
HTTP Method
Description
self
GET
A link to the individual step of a specific module.
URI: SASMicroAnalyticService/rest/modules/{moduleId}/steps/{stepId}
Media type: application/vnd.sas.microanalytic.module.step
up
GET
A link back to the module's collection of steps.
URI: SASMicroAnalyticService/rest/modules/{moduleId}/steps
Media type: application/vnd.sas.collection
validate
POST
A link used to validate that the input values are correct for a specific step of a module.
URI: SASMicroAnalyticService/rest/modules/{moduleId}/steps/{stepId}/validations
Media type: application/vnd.sas.microanalytic.module.step.input.validity
execute
POST
A link used to execute a specific step of a module.
URI: SASMicroAnalyticService/rest/modules/{moduleId}/steps/{stepId}
Media type: application/vnd.sas.microanalytic.module.step.output
The application/vnd.sas.microanalytic.module.step media type contains the following members.
Name
Type
Description
version
integer
This media type's schema version number. This representation is version 1.
id
string
The name of a step that is included in the compiled module.
moduleId
string
A generated unique string identifying a module in an installation.
description
string
Text describing the rules and logic performed by the step.
inputs
array
Provides information about the specific input values that should be specified in the request body when executing a step. Here are the representation members:
name
string - The name of a variable that is expected to be passed into the step.
type
string (ENUM) - This is the data type of the variable. If the variable's type is (array of) integer, long, or decimal, the value must be a JSON (array of) number. If the variable's type is (array of) string or char, the value must be a JSON (array of) string. Only arrays with one dimension are supported. Null is used to represent missing values. The following data types are supported:
  • decimal - For DS2, this corresponds to the double data type.
  • bigint
  • integer
  • string
  • decimalArray
  • bigintArray
  • integerArray
  • stringArray
size
integer - For a string type, this field indicates the length of the string, which is at least one. For a non-string type, this field has the value of zero.
dim
integer - For an array type, this field indicates the length of the array, which is one or greater. For a non-array type, this field has a value of zero.
outputs
array
Provides information about the specific output values that should be expected in the response body of a step execution. Here are the representation members:
name
string - The name of a variable that is expected to receive output from the step.
type
string (ENUM) - This is the data type of the variable. If the variable's type is (array of) integer, long, or decimal, the value must be a JSON (array of) number. If the variable's type is (array of) string or char, the value must be a JSON (array of) string. Only arrays with one dimension are supported. The following data types are supported:
  • decimal - For DS2, this corresponds to the double data type.
  • bigint
  • integer
  • string
  • decimalArray
  • bigintArray
  • integerArray
  • stringArray
size
integer - For a string type, this field indicates the length of the string. For a non-string type, this field has the value of zero.
For DS2, the variable length is not required since an output variable is passed by reference. A zero is reported if a length is not specified. Otherwise, the length specified is reported.
dim
integer - For an array type, this field indicates the length of the array, which is one or greater. For a non-array type, this field has a value of zero.
links
array of link objects
Zero or more link objects. See the table above for a description of the link types.
Here is an example of application/vnd.sas.microanalytic.module.step+json:
{  
   "links":[  
      {  
         "method":"GET",
         "rel":"self",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 36af8e3c-6a37-4494-a8e0-9cc96ad62232/steps/copy_arrays",
         "uri":"/modules/36af8e3c-6a37-4494-a8e0-9cc96ad62232/steps/copy_arrays",
         "type":"application/vnd.sas.microanalytic.module.step"
      },
      {  
         "method":"GET",
         "rel":"up",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 36af8e3c-6a37-4494-a8e0-9cc96ad62232/steps",
         "uri":"/modules/36af8e3c-6a37-4494-a8e0-9cc96ad62232/steps",
         "type":"application/vnd.sas.collection"
      },
      {  
         "method":"POST",
         "rel":"validate",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 36af8e3c-6a37-4494-a8e0-9cc96ad62232/steps/copy_arrays/validations",
         "uri":"/modules/36af8e3c-6a37-4494-a8e0-9cc96ad62232/steps/copy_arrays/validations",
         "type":"application/vnd.sas.microanalytic.module.step.input.validity"
      },
      {  
         "method":"POST",
         "rel":"execute",
         "href":"http://www.example.com/SASMicroAnalyticService/rest/modules/
                 36af8e3c-6a37-4494-a8e0-9cc96ad62232/steps/copy_arrays",
         "uri":"/modules/36af8e3c-6a37-4494-a8e0-9cc96ad62232/steps/copy_arrays",
         "type":"application/vnd.sas.microanalytic.module.step.output"
      }
   ],
   "id":"copy_arrays",
   "moduleId":"36af8e3c-6a37-4494-a8e0-9cc96ad62232",
   "inputs":[  
      {  
         "name":"in_charN_array",
         "type":"stringArray",
         "dim":4,
         "size":12
      },
      {  
         "name":"in_varchar_array",
         "type":"stringArray",
         "dim":1,
         "size":512
      },
      {  
         "name":"in_int_array",
         "type":"integerArray",
         "dim":5,
         "size":0
      },
      {  
         "name":"in_double_array",
         "type":"decimalArray",
         "dim":2,
         "size":0
      },
      {  
         "name":"in_bigint_array",
         "type":"bigintArray",
         "dim":1,
         "size":0
      }
   ],
   "outputs":[  
      {  
         "name":"out_charN_array",
         "type":"stringArray",
         "dim":4,
         "size":12
      },
      {  
         "name":"out_varchar_array",
         "type":"stringArray",
         "dim":1,
         "size":512
      },
      {  
         "name":"out_int_array",
         "type":"integerArray",
         "dim":5,
         "size":0
      },
      {  
         "name":"out_double_array",
         "type":"decimalArray",
         "dim":2,
         "size":0
      },
      {  
         "name":"out_bigint_array",
         "type":"bigintArray",
         "dim":1,
         "size":0
      }
   ],
   "description":null,
   "version":1
}

application/vnd.sas.microanalytic.module.step.input

The application/vnd.sas.microanalytic.module.step.input media type describes the input values that are required by SAS Micro Analytic Service step when a POST is used to validate or execute a step.
The application/vnd.sas.microanalytic.module.step.input media type contains the following members.
Name
Type
Description
version
integer
This media type's schema version number. This representation is version 1.
inputs
array
Holds the values that are to be passed to the step for input validation or execution. The order of the variables should match the order presented in the input signature. Here are the representation members:
name
string - The name of an input variable for the step.
value
varies - This represents the actual value to set on the variable. If the variable's type is (array of) integer, long, or decimal, the value must be a JSON (array of) number. If the variable's type is (array of) string, the value must be a JSON (array of) string.
Here is an example of application/vnd.sas.microanalytic.module.step.input+json:
{ 
  "version" : 1,  
  "inputs":[  
      {  
         "name":"supported_browsers",
         "value":[  
            "Apple Safari",
            "Google Chrome",
            "Microsoft Internet Explorer",
            "Mozilla Firefox"
         ]
      },
      {  
         "name":"random_integers",
         "value":[  
            10,
            15,
            3
         ]
      },
      {
         "name": "AMBALANCE", 
         "value" : 1055.93
      }
  ]
}

application/vnd.sas.microanalytic.module.step.input.validity

The application/vnd.sas.microanalytic.module.step.input.validity media type describes the output values that are returned by SAS Micro Analytic Service for a POST to validate the inputs required to execute a step.
The application/vnd.sas.microanalytic.module.step.input.validity media type contains the following members.
Name
Type
Description
version
integer
This media type's schema version number. This representation is version 1.
moduleId
string
A generated unique string identifying a module in an installation.
stepId
string
The name of a step.
valid
Boolean
The value is true if all the input parameters are valid. If any parameter is invalid, the value is false.
results
objects
The object contains a member for each input parameter that is invalid. The name of the member is that of an input parameter. The value is the reason why the input is invalid. The object is empty if there is no invalid input parameter.
Here is an example of application/vnd.sas.microanalytic.module.step.input.validity+json:
{
  "version" : 1,
  "moduleId": "83e7d274-fe17-429e-92ca-93ec2153c731",
  "stepId":"predict",
  "valid":false,
  "results": 
    {
      "s2": "String value expected but found string array value [String].",
      "s4": "Bigint value expected but found double value 77.0."
    }
}

application/vnd.sas.microanalytic.module.step.output

The application/vnd.sas.microanalytic.module.step.output media type describes the output values that are returned by SAS Micro Analytic Service when a step is executed.
The application/vnd.sas.microanalytic.module.step.output media type contains the following members.
Name
Type
Description
version
integer
This media type's schema version number. This representation is version 1.
moduleId
string
A generated unique string identifying a module in an installation.
stepId
string
The name of the step.
outputs
array
Holds the output values returned from executing a step. The order of the variables matches the order presented in the output signature. Here are the representation members:
name
string - The name of the variable that is expected to receive output from the step.
value
This represents the actual value returned from the step execution.
Here is an example of application/vnd.sas.microanalytic.module.step.output+json:
{
  "moduleId": "70a58acd-5618-4dc3-9d7a-9e675e8e13bb",
  "stepId": "test_all_types",
  "outputs": [
    {
      "name": "out_string",
      "value": "This is a test..."
    },
    {
      "name": "out_bigint",
      "value": 987654321
    },
    {
      "name": "out_int",
      "value": 7654321
    },
    {
      "name": "out_double",
      "value": 0.9997
    },
    {
      "name": "string_arr",
      "value": [
        "John Jacob Hale",
        "Male",
        "Master Swimmer"
      ]
    },
    {
      "name": "bigint_arr",
      "value": [
        1078653221,
        2256390877,
        9719886300
      ]
    },
    {
      "name": "int_arr",
      "value": [
        77,
        436702,
        67552
      ]
    },
    {
      "name": "double_arr",
      "value": [
        0.9997,
        1.0,
        0.0023
      ]
    }
  ],
  "version": 1
}