Googl books API

my google API is just saying nullwhen i use it

help pls

Hello @lisibrani5612ugds8 welcome to Thunkable! what have you tried so far?

It seems that the API is a element with a combi of js/html so are you using the API blocks or using a web viewer connected to your project?

i am not using a web viewer

Hello, i am using API blocks and i get the response but i can’t accces the properties. I tried turing the response to json, turning it into an object, nesting the get properties but everytime its coming up as null.

This is my project here it is you can see it for yourself
https://x.thunkable.com/copy/b0ebcffe2e7c3680a8504f077ab9faf5

Thanks!

I would need two things to be able to help you:

Edit: I was able to get these from the project link. Thanks for including that.

  1. The full JSON response as text (not a screenshot). You can assign the green response block to a text input’s text and then copy and paste it into a post here. Make sure to format it using the </> button in the forums toolbar above the post. That will remove smart quotes.

  2. The name(s) of the properties you are trying to get the values for.

1 Like

One big problem you have is that you are using variables incorrectly. You should not use a variable block as the name of a variable. When setting a variable’s value, use the set app variable block at the top of the Variables drawer. Avoid using the set app variable " " block.

1 Like

Thank you so much man because I am not very familiar with Thunkable and the reply was insanely quick!

Hey man sorry to bother you but i have one more question. I can’t seem to put the bookthumbnail its not showing in my project and when i try to debug it(put the image url link in a text )it shows blank could you help me as I really don’t know a lot about thunkable. heres the url again Thunkable

Please post the JSON response as I described above and the exact property name you’re trying to get from it.

{
    "kind": "books#volumes",
    "totalItems": 2467,
    "items": [
        {
            "kind": "books#volume",
            "id": "fFCjDQAAQBAJ",
            "etag": "m7lO2M29Jas",
            "selfLink": "https://www.googleapis.com/books/v1/volumes/fFCjDQAAQBAJ",
            "volumeInfo": {
                "title": "Atomic Habits",
                "subtitle": "the life-changing million-copy #1 bestseller",
                "authors": [
                    "James Clear"
                ],
                "publisher": "Random House",
                "publishedDate": "2018-10-18",
                "description": "THE PHENOMENAL INTERNATIONAL BESTSELLER: OVER 15 MILLION COPIES SOLD WORLDWIDE Transform your life with tiny changes in behaviour, starting now. People think that when you want to change your life, you need to think big. But world-renowned habits expert James Clear has discovered another way. He knows that real change comes from the compound effect of hundreds of small decisions: doing two push-ups a day, waking up five minutes early, or holding a single short phone call. He calls them atomic habits. In this ground-breaking book, Clears reveals exactly how these minuscule changes can grow into such life-altering outcomes. He uncovers a handful of simple life hacks (the forgotten art of Habit Stacking, the unexpected power of the Two Minute Rule, or the trick to entering the Goldilocks Zone), and delves into cutting-edge psychology and neuroscience to explain why they matter. Along the way, he tells inspiring stories of Olympic gold medalists, leading CEOs, and distinguished scientists who have used the science of tiny habits to stay productive, motivated, and happy. These small changes will have a revolutionary effect on your career, your relationships, and your life. ________________________________ A NEW YORK TIMES AND SUNDAY TIMES BESTSELLER 'A supremely practical and useful book.' Mark Manson, author of The Subtle Art of Not Giving A F*ck 'James Clear has spent years honing the art and studying the science of habits. This engaging, hands-on book is the guide you need to break bad routines and make good ones.' Adam Grant, author of Originals 'Atomic Habits is a step-by-step manual for changing routines.' Books of the Month, Financial Times 'A special book that will change how you approach your day and live your life.' Ryan Holiday, author of The Obstacle is the Way Number 1 Sunday Times Bestseller, May 2023",
                "industryIdentifiers": [
                    {
                        "type": "ISBN_13",
                        "identifier": "9781473537804"
                    },
                    {
                        "type": "ISBN_10",
                        "identifier": "1473537800"
                    }
                ],
                "readingModes": {
                    "text": true,
                    "image": false
                },
                "pageCount": 234,
                "printType": "BOOK",
                "categories": [
                    "Self-Help"
                ],
                "averageRating": 4,
                "ratingsCount": 4,
                "maturityRating": "NOT_MATURE",
                "allowAnonLogging": true,
                "contentVersion": "2.14.14.0.preview.2",
                "panelizationSummary": {
                    "containsEpubBubbles": false,
                    "containsImageBubbles": false
                },
                "imageLinks": {
                    "smallThumbnail": "http://books.google.com/books/content?id=fFCjDQAAQBAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api",
                    "thumbnail": "http://books.google.com/books/content?id=fFCjDQAAQBAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api"
                },
                "language": "en",
                "previewLink": "http://books.google.com/books?id=fFCjDQAAQBAJ&dq=Atomic+Habits&hl=&cd=1&source=gbs_api",
                "infoLink": "http://books.google.com/books?id=fFCjDQAAQBAJ&dq=Atomic+Habits&hl=&source=gbs_api",
                "canonicalVolumeLink": "https://books.google.com/books/about/Atomic_Habits.html?hl=&id=fFCjDQAAQBAJ"
            },
            "saleInfo": {
                "country": "XK",
                "saleability": "NOT_FOR_SALE",
                "isEbook": false
            },
            "accessInfo": {
                "country": "XK",
                "viewability": "NO_PAGES",
                "embeddable": false,
                "publicDomain": false,
                "textToSpeechPermission": "ALLOWED",
                "epub": {
                    "isAvailable": true
                },
                "pdf": {
                    "isAvailable": true
                },
                "webReaderLink": "http://play.google.com/books/reader?id=fFCjDQAAQBAJ&hl=&source=gbs_api",
                "accessViewStatus": "NONE",
                "quoteSharingAllowed": false
            },
            "searchInfo": {
                "textSnippet": "He calls them atomic habits. In this ground-breaking book, Clears reveals exactly how these minuscule changes can grow into such life-altering outcomes."
            }
        }
    ]
}

The exact one is smallThumbnail

Thanks!

1 Like

When I format that JSON with the </> toolbar button and copy and paste it into Best JSON Viewer and JSON Beautifier Online and then click on smallThumbnail, I can see the path at the top:

So that property is located at items[1].volumeInfo.imageLinks.smallThumbnail. We leave out object because we are converting the JSON to an object and we use 1 as the array index because Thunkable lists start at 1 whereas JSON arrays start at 0.

So to get that value, you would get property "items[1].volumeInfo.imageLinks.smallThumbnail" of object. Some people prefer to use several get property of object blocks and list blocks to parse JSON. I don’t care for that at all. I find it easier to think linearly and use a single text string for the property path.

If you still can’t get it to work, post a screenshot of your blocks or a new link to your project.

1 Like

thank you so much man. i apreaciate you

1 Like