Headless I hear you try to say? Yep. It basically means that unlike a normal CMS where we store data, provide a means to manage it and also a method to display it, we just take the first two - storage and a UI which allows you to create, update, delete the data etc. There are lots of touted advantages, of course, but the basic idea is that having just the data means we have maximum flexibility in how we use it. Want to write for mobile? No problem. Desktop? Here you go. You get the idea?
A UI to manage the data is fine, but how do you get it back out for that myriad of devices? Well, that’s where the API comes in and in the case of Contentful, it has various on offer. In our case, using .NET, we needed to make a series of HTTP requests which made things slightly more painful (at the time - things have changed somewhat). What I wanted to write about here though are some of the quirks we have encountered in using Contentful in the hope that it might make things easier for others. We’ve created thousands of entries, deleted them, added them, updated and published them, so have some battle-hardened experience!
This is quite a key one to begin with. Watch out when you look at your data in Contentful; it sometimes doesn’t show you the latest version (meaning, state). In this case, just get into the habit of reloading the page. Frequently.
Sadly, there isn’t a delete all which is such a pain when you are creating hundreds of entries that are linked. My advice is, if you are developing a solution which is creating lots of entries repeatedly, start with a programmatic way to delete them because the alternative is RSI and a whole lot of clicking in the UI. I’ve suggested this as an API improvement to them; hopefully it will happen.
A good one to move onto! Sometimes things go wrong on the Contentful side and we’ve had situations where neither our code not the UI will let us delete entries. If this happens to you, and I hope it doesn’t, just raise a support ticket and they can take care of it. They are pretty good at responsiveness (at least for us) but the main point is don’t fret and think it is something you have done. It might not be.
If you use images, you will also need a way of uploading them. Unfortunately, you can’t just send an image directly - you need to make sure it is hosted somewhere because the parameter they need for it is a URL. In our case, we used HTTP to send the image to another service which then saved it and returned a URL which we then sent onto Contentful. Another way is you could upload it to another website.
If you are linking entities, understand that if you delete the child element, the link will remain in the parent, but it will be in a kind of zombie state. It can still be read but you will need to remove that to keep things nice and clean.
The documentation states that you can’t send more than ten requests a second or you will exceed your rates. For a long time, we didn’t manage that, but it is real, and it is something you need to cater for. If you do go too far, expect an error about a rate limit being exceeded.
It can be really handy to search for your ID but have you tried? You can’t - or, to be precise, you can’t unless you use a modifier in the search bar. Instead, consider creating a text field and copying the ID into that too - that will make it much easier to search for items. That’s all for now. Good luck being Content.
Hi! Did you find this useful or interesting? I have an email list coming soon, but in the meantime, if you ready anything you fancy chatting about, I would love to hear from you. You can contact me here or at stephen ‘at’ logicalmoon.com