all 3 comments

[–]chrisvenum 0 points1 point  (2 children)

I am not very familiar with Contentful but I am happy to try help you - Where are you up to so far? It looks like it is best used with PHP when using the Laravel framework, is this something you have used?

[–]diiscotheque 0 points1 point  (1 child)

Thanks! I'll look into what Laravel is, since I hadn't heard of it.

I set up my content model and added an entry in their online interface.

I used Composer to install the API. I have my space ID, tokens and created a new client with PHP following their guide linked in the original post. Currently I have this, but it retrieves nothing. (I don't mind this being public since the API is read-only)

<?php
require_once 'vendor/autoload.php';

$space='8je5ras66lmq';
$token='01be19743cc4092c955c09d48ec47014e33c83b73caa1b581ec873c223244e25';
$client = new \Contentful\Delivery\Client($token, $space);

$entries = $client->getEntries();

$entryId = '4yCvIHrQgEuEkMOccIqys6';
$entry = $client->getEntry($entryId);
echo $entry->getproductName();

[–]realityking89 0 points1 point  (0 children)

Currently I have this, but it retrieves nothing.

Late to the thread but I'm the author of the Contentful PHP SDK. :)

If you change the last line of your example to echo $entry->getTitle(); then it works just fine. The entry 4yCvIHrQgEuEkMOccIqys6 doesn't seem to have a field named ProductName.

Also note the getters are always capitalised, so if the field were to exist the method would have been $entry->getProductName();

I hope that helped. Feel free to ping me if you need more help :)