The Live API provides published data that can be consumed and distributed to any number of endpoints. One source to manage content, distributed to mobile apps and other syndicated consumers.
Marketpath CMS provides the abiltiy to create custom API's, data feeds, and more. Because you have full control over all rendered content, you can output content into your preferred content type, such as, JSON, XML, or CSV. You can filter the results by passing query parameters or Marketpath CMS Profile fields and attributes.
The following example loops through a datastore of locations and returns the content in JSON format.
{% set_content_type "application/json" %} {% datastore_items var locations = datastore: "locations" %} [ {% for location in locations%} { "name": {{location.name | json_encode}}, "address": {{location.address | json_encode}}, "city": {{location.city | json_encode}}, "state": {{location.state | json_encode}}, "zipcode": {{location.zipcode | json_encode}} } {% endfor %} ]
The resulting data would look like this:
[ { "name": "Midwest Campus", "address": "111 Every Way", "city": "Indianapolis", "state": "IN", "zipcode": "46240" }, { "name": "South Campus", "address": "555 No Way", "city": "Chicago "state": "IL", "zipcode": "60641 }, { "name": "North Campus", "address": "333 Something Way", "city": "Tucson", "state": "AZ", "zipcode": "85713" } ]