Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

If you don't know what a sub-property is, then read the What is a sub-property? article first. Adding a sub-property to a resource is very similar to adding a property. Instead of using the AddProperty service, we will use the AddSubProperty service. They have share a nearly identical signature but the AddSubProperty service includes one additional argument to identify the parent property. Here is a simple example:

...

In the above code, the GetObject service is called without any arguments. This simply returns a handle to an empty resource object. It doesn't have to be completely empty, but for the sake of a simple demonstration we'll start with an empty resource object and use the AddSubProperty service to add our sub-properties. Note, the parent property does not have to be in the resource already. The AddSubProperty service will create this for us. We finish by calling the GetSerializedResource service so that we get a stringified JSON object that we can inspect or use in our API. Here is what our resource object looks like:

...