Public
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Esteemed Contributor

Getting an API V1 call into JSON I can use in Javascript?

I want to get a V1 API call back in a format that I can use as JSON in Javascript in a component. How do I do that? For example:

(/categories/id/categoryName/labels)

<#assign someLabels = restadmin("/${context}/id/${contextId}/labels?restapi.response_format=json").labels.label?sort_by("text")/>
<script>
let someVar = [${someLabels}];
</script>

I know that V2 has the apiv2.toJson() method, but in this case V1 is the only way I know of to get a list of labels from a category, for example. 

20 Replies 20
Highlighted
Esteemed Contributor

Thanks for all your help. Shouldn't have been that hard to begin with but ... some things are just a pain in Khoros Community... Thanks