contenta_jsonapi
contenta_jsonapi copied to clipboard
Kind of difficult to make progress here.
Hello,
I am considering taking over the https://github.com/contentacms/contenta_vue_nuxt project but have a couple of questions. The contenta_vue_nuxt configuration ask two very simple question:
-
What is your API ServerBaseUrl, easy, http://mysite.com/api
-
What is your ServerFilesUrl, not so easy, my guess would be http://mysite.com/api/files
When I give these Url's to the configuration file of the Vue_nuxt project and run the NPM servers I get error: NuxtServerError Cannot read property 'data' of undefined
I am aware that the developer has left the Vue_Nuxt project, so getting answers is a tricky business, but here goes:
Lets take a look at the 'data' property:
<?php include_once 'connection.php' ; $url = "http://contenta.com/api/files"; $jsondata = file_get_contents($url); $response = json_decode($jsondata, true); $myarray = $response['data'] ; // this what we are after!!! foreach ($myarray as $k => $v) { $newarr[$k] = $v['attributes']['filename']; } echo "<pre>"; print_r( $newarr ); "</pre>";
I look in the files directory of mysite.com and see /chili-sauce-umami.jpg, I would expect to see the file in my $newarr array:
Array ( [0] => simple-oauth-2.png [1] => subrequests.jpg [2] => decoupled-three_cs.png [3] => veggie-pasta-bake-umami.jpg [4] => ben-cliff.jpg [5] => johnson-wang-515951-unsplash.jpg [6] => jsonapi-9.png [7] => default-article.png [8] => simple-oauth-3.png [9] => with-gatsby.png [10] => jsonapi-4.png [11] => jsonapi-14.png [12] => heritage-carrots.jpg [13] => simple-oauth-4.png [14] => jsonapi-8.png [15] => image_styles.jpg [16] => schemas.jpg [17] => lando-contenta-nuxt.png [18] => jsonapi-10.png [19] => jsonapi-11.png [20] => jsonapi-13.png [21] => angular.png [22] => umami-bundle.png [23] => routing.jpg [24] => veggie-pasta-bake-hero-umami.jpg [25] => thai-green-curry-umami.jpg [26] => supermarket-savvy-umami.jpg [27] => vue.png [28] => ember.png [29] => simple-oauth-5.png [30] => home-grown-herbs.jpg [31] => jsonapi-6.png [32] => pizza-umami.jpg [33] => jsonapi-3.png [34] => reactjs.png [35] => jsonapi-15.png [36] => jsonapi-2.png [37] => jsonapi-7.png [38] => jsonapi-5.png [39] => json-api-drupal-youtube.jpg [40] => crema-catalana-umami.jpg [41] => victoria-sponge-umami.jpg [42] => mushrooms-umami.jpg [43] => simple-oauth-7.png [44] => chocolate-brownie-umami.jpg [45] => watercress-soup-umami.jpg [46] => jsonapi-12.png [47] => simple-oauth-1.png [48] => elm.png [49] => simple-oauth-8.png ) It's not there, I don't get it?
Can someone on the development team please take a look at this issue and provide some clues as to what is going on.
Thanks
1. What is your API ServerBaseUrl, easy, http://mysite.com/api
Have you tried with http://mysite.com
instead?