Answer the question
In order to leave comments, you need to log in
How to implement simple API functionality in modx?
Hello,
How to implement api in Modx revo?
You need to output the last 4 resources in the parent with TV fields and all the charms in json.
Or the output of all resources (products) with all the information (title, tv, date, etc.) from the parent into a clear json like
[
{
"title": "Тайтл",
"tv_title": "Тайтл тв",
"tv_img_1": "/image/1.jpg"
},{
"title": "Тайтл2",
"tv_title": "Тайтл тв 2",
"tv_img_1": "/image/2.jpg"
}
]
Answer the question
In order to leave comments, you need to log in
Created a resource called "api", json format.
I wrote the following in the content:
[
]
//В место этого
return $output;
//Сделал это
return json_encode($output);
[
"{\"title\":\"9 \u043c\u0430\u044f\",\"img\":\"s_img\/news\/bd7e7ae0d30ee44784cb19c4921bb11e.jpg\"}\n{\"title\":\"\u0421 \u0434\u043d\u0435\u043c \u0442\u0440\u0443\u0434\u0430!\",\"img\":\"s_img\/news\/036e92f60687608f5f8f76db787bc54d.jpg\"}"
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question