Created
March 2, 2017 23:06
-
-
Save ardeay/cdcfed6dd2c1ddb672ded64b2478ece5 to your computer and use it in GitHub Desktop.
Custom Zesty.io JSON API endpoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{{if {get_var.start} }} {{ $start = {get_var.start} }} {{else}} {{$start = 0}} {{end-if}} | |
{{if {get_var.limit} }} {{ $limit = {get_var.limit} }} {{else}} {{$limit = 100}} {{end-if}} | |
{{each blog_article as art limit {$start},{$limit} }} | |
{ | |
"zid" : {{art.zid}}, | |
"name" : "{{art.title}}", | |
"body" : "{{art.article_body.escapeForJs()}}", | |
"tags" : [ | |
{{each blog_tag as tag where find_in_set(tag.zid,'{art.tags}') }} | |
{ | |
"zid" : {{tag.zid}}, | |
"name" : "{{tag.name}}" | |
} | |
(** echo a the comma unless it is the last item **) | |
{{if {tag._length} != {tag._num} }},{{end-if}} | |
{{end-each}} | |
] | |
} | |
(** echo a the comma unless it is the last item **) | |
{{if {art._length} != {art._num} }},{{end-if}} | |
{{end-each}} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment