Skip to content

Working with SCIM Paths

Jacob Childress edited this page Apr 26, 2016 · 5 revisions

Path objects are used pervasively when working with GenericScimResource objects or PATCH requests. Paths are used to target specific data in a SCIM resource.

A path is most often specified as an attribute name or as an attribute with sub-attribute (using the form "attribute.sub-attribute"), though it may even include a value filter.

Bear in mind that a SCIM resource is a JSON document. Once resolved, a valid path specifies one or more nodes in the JSON document, which will be one of the following types:

  • String
  • Boolean
  • Decimal
  • Integer
  • DateTime
  • Binary
  • Reference
  • Complex
  • Array

Note the last two types — a path may not necessarily resolve to a node representing a primitive type.

Examples

Consider the following JSON object:

{  
   "firstName": "Bill",
   "lastName": "Smith",
   "shoeSize": 13,
   "addresses": [  
      {  
         "street": "123 1st Street",
         "city": "Austin",
         "state": "TX"
      },
      {  
         "street": "234 2nd Street",
         "city": "Round Rock",
         "state": "TX"
      },
      {  
         "street": "345 3rd Street",
         "city": "Cedar Park",
         "state": "TX"
      }
   ],
   "phoneNumber": 
      {  
         "areaCode": "512",
         "prefix": "555",
         "number": "1212"
      },
   "arrayOfStrings": [  
      "red",
      "green",
      "blue"
   ]
}

Given this example:

  • A path of firstName would match the TextNode in the document with the value of "Bill".
  • A path of shoeSize would match the IntNode in the document with the value of 13.
  • A path of addresses would match a list of complex values.

Sub-attributes

A path may have a sub-attribute component, which specifies a sub-attribute of a complex object.

For example:

  • phoneNumber.areacode would match a TextNode containing "512".

Such a path could match multiple nodes:

  • address.city would match all of the TextNodes in the addresses list that have a sub-attribute named "city": TextNode "Austin", TextNode "Cedar Park", and TextNode "Round Rock".

Value filters

An additional component of the path is a value filter. A value filter may be used with or without the sub-attribute component. Without the attribute component, the filter returns the complete complex object that was matched.

Example with attribute component:

  • addresses[city ne "Austin"].city would select two TextNodes: TextNode "Round Rock" and TextNode "Cedar Park".

Example without attribute component:

  • addresses[city ne "Austin"] would select two address complex objects. These are the two addresses where the city is not equal to "Austin".

Special cases for simple multivalued attributes: Simple multivalued attributes, such as "arrayOfStrings" in this example, have a special implicit sub-attribute called "value". This can be used to form value filters that select specific members of a simple multivalued attribute.

For example:

  • arrayOfStrings[value eq "green"] would select "green" from the simple multivalued attribute in the example.

This implied sub-attribute may only be used in value filters, however. For example, the path arrayOfStrings[value eq "green"].value is invalid.

Clone this wiki locally