How can I access content_type entries via Locomotive CMS RESTful API? I can find only limited documentation.
I've managed to get my auth token using the following:
curl -v -H 'Content-Type: Application/json' -d '{"email":"your@email.abc", "password":"foo"}' 'https://your.locomotive.instance.tld/locomotive/api/v3/tokens.json'
But now I want to access my content_entries and display their data on a page.
Background
I'm building a custom navigation snippet in Locomotive CMS and I want content_type entries to be listed in the navigation along with pages.
Specifically (and obviously) I only want entries listed if the content_type has a content_type_template set up.
I initially thought that I could simply loop through through my pages, locate any with the slug content_type_template
, grab the handle of that page and set it as a variable and then use the variable to get the entries like so:
{% for loopPage in page.children %}
{% assign myContentType = '' %}
{% if page.slug == 'content_type_template' %}
{% assign myContentType = loopPage.handle %}
{% for item in contents.myContentType %}
<li>a href="{{ item._slug }}">{{ item.name }}</a></li>
{% endfor %}
{% else %}
<li><a href="{% path_to loopPage %}">{{ loopPage.title }}</a></li>
{% endif %}
{% endfor %}
But this doesn't work. As per my StackOverflow Q & A here, it seems it isn't possible to use a Liquid varibale in this way.
Hence the need to access content_type entries via some other method, e.g. the Locomotive CMS REST API.