Question

Photo of Nate Hoffman

0

Rock API Access to ContentChannelItems Attributes

Hello,

As we are continuing to play with Rock I had some questions about the API come up. Perhaps it is just because I do not fully understand it yet. Is it possible to get the Content Channel Items along with their custom item attributes in the API? From watching the video and reading some of the documentation I have found I would think that this command should work: http://localhost/api/ContentChannelItems?$expand=Attributes, AttributeValues. However, all I get back is "Bad Request," is there somewhere I can look to see why it is coming back Bad Request or perhaps someone knows the proper API call to be able to get Channel Items and their attributes back? I am new to Odata, so perhaps it is something easy that I just don't understand yet. Thank you!

  • Photo of Rock RMS

    0

    Normally the OData expand would work to include any child objects of the objects returned by a REST GET method.  However, Attributes and Attribute values are a bit different because they are not 'navigable' properties of the objects. In other words, there are no foreign key relationships between the object (e.g. ChannelItem ) and the Attributes. Because of this, we've made some enhancements to the REST API for the next update that makes including attributes much easier. Until then, you really can't get the channel items and their attributes in one REST call. You would need to use the actual api/Attributes and api/AttributeValues endpoints to get the values for a particular Channel Item.