Page 1 of 1

Api for V2

Posted: Sat Feb 17, 2018 7:50 pm
by viriisxp
hi, i would like to update my old version of bludit but in the last version i do something like this for the api :

Code: Select all

<?php
    $url = 'https://www.mywebsite.fr/api/show/all/pages/b547d5bed80a3435ba9fac89bcb34ba6';
    $result = file_get_contents($url);
        $data = json_decode($result, true);
        foreach($data as $page) {
            if (strstr($page['key'],'v2-')){ 
                echo "<section>";
                echo $page['content'];
                echo "</section>";
            }
        }
?>

with this, i can see all my pages in onepage website . But now with the new api, i can't found how i can't do this. Why did you delete the information on the api plugins ...


please, can you help me ?

Of course i check the https://docs.bludit.com/en/api/introduc ... stallation but i can't select the content from my page. that's what he say ;) .

i have a second request in the same time ( api too),

i try to see the page only if the title of page called : "bienvenue". and i would like to see the content only from this page.

thx for help

Re: Api for V2

Posted: Sat Feb 17, 2018 8:18 pm
by diego
Hi,
have you check this one: https://docs.bludit.com/en/api/read-content

Re: Api for V2

Posted: Sat Feb 17, 2018 9:59 pm
by viriisxp
yes, i check it.

i found some of my solution.

Second question, with this api is it possible to grab content by JS ?

an other question : i try to do something like this :

Code: Select all

																			$categoryKey = 'jeux';
$category = getCategory($categoryKey);
foreach ($category->pages() as $pageKey) {
$page = buildPage($pageKey);
$titre = substr($page->title(),1);
$tags = getTags();
foreach ($tags as $tag) {
if (($tag->name()) === 'CMS'){
echo $tag->list();																								}}}
but the problem is : list is a function , so how did i can do that ?

Re: Api for V2

Posted: Sun Feb 18, 2018 12:54 pm
by diego
You can use AJAX to get the content. here are some examples: https://github.com/bludit/examples/tree/master/api

Re: Api for V2

Posted: Sun Feb 18, 2018 2:19 pm
by viriisxp
hi again and thx for your answer, i will try this, but did you think that gonna work for tag ?