API Data shows only in Toddle

  • vanishklift-1326318360509550654

    vanishklift

    4 months ago

    Hey everyone!

    I’ve connected one API endpoint without any input, and it’s displaying correctly both in the Builder and on the branch site in Chrome. However, the API endpoint where I provide an item_id to retrieve only objects matching that item_id is behaving differently. It shows everything as expected in the Builder but doesn’t display anything on the branch site in Chrome.

    I hope this explanation makes sense! Any ideas on what might be causing this?
    1326318360769859615-image.png
    😭1
  • max.kayr-1328335098105303110

    Max

    4 months ago

    Is there an error in your browser console?
  • vanishklift-1328354101263863868

    vanishklift

    4 months ago

    no there isnt :/
  • vanishklift-1328356148247658590

    vanishklift

    4 months ago

    In Scources there is only one API endpoint (it should be 2 I use 1 endpoint for the businesses and one for their services, I give the businessid as an input in xano)

    Also in the Network-tab no signs of the service api

    And the console is empty (also when I refresh with the Info-Window open)
    1328356147492683867-image.png
    1328356148146868274-image.png
    1328356147777900604-image.png
  • uunicode-1328360051660030002

    unicodes

    4 months ago

    Make sure to respect the same conditions of the Test Values. I would recommend console log all the API's inputs in order to understand if the API call is the same as in test mode.
  • uunicode-1328360663646732384

    unicodes

    4 months ago

    Popular services make me think that there are some conditions set in test mode (maybe dependent on a specific user ID that has certain data), and in the live environment, the user is different or the conditions are not the same as in test mode. As for the API system, everything is working fine; I do not have any issues with the API system.
  • uunicode-1328361203575296052

    unicodes

    4 months ago

    @vanishklift share please some API's screens for better understanding your situation.
  • vanishklift-1328361481036890142

    vanishklift

    4 months ago

    sure thing, give me a sec
  • vanishklift-1328363810720972800

    vanishklift

    4 months ago

    whuch screens do you need, those in toddle or xano
  • uunicode-1328366635014164501

    unicodes

    4 months ago

    from toddle (inputs, Parammeters, Headers)
  • vanishklift-1328366725128912936

    vanishklift

    4 months ago

    On the feed page, I list businesses using the Businesses API endpoint. Each business is displayed on a card, and the card has a link. That link includes the current business index (from the API) in the URL.

    When you click the link, it opens the business page. On that page, I use the Services API to fetch the services for the business. Here's the tricky part: since my services table starts indexing at 1 (not 0 like the Businesses API), I add +1 to the business index before passing it to the Services API.

    So, I’m basically saying:

    For business index 0 → fetch services with index 1,
    For business index 1 → fetch services with index 2, and so on.
    I know this isn’t great because if a business or service gets deleted, the indices won’t match anymore, and everything breaks. 😅 But it was just a quick way to test the setup.

    In the future, I’ll switch to using a unique identifier (like business ID) instead of the index so it’s more stable and doesn’t depend on the order. Let me know if you spot something else I should fix!
    1328366724415754290-image.png
    1328366723128229918-image.png
    1328366724772528228-image.png
    1328366723442937886-image.png
    1328366723963031612-image.png
    1328366722201161828-image.png
    1328366722683637960-image.png
  • vanishklift-1328366989290377290

    vanishklift

    4 months ago

    this ?
    1328366989265080330-image.png
  • 1328367051441574061-image.png
  • this are the headers for the services api (above)
  • uunicode-1328369006121320601

    unicodes

    4 months ago

    Can you please go on your right panel (On Load") and add Log to Console, and in data adding your api call for services (please select Services API then data) and try to see what it shows in Console on Chrome.
  • uunicode-1328369369570611210

    unicodes

    4 months ago

    In services Parameters please try to add formula - concatenate on position 1 "eq." on position 2 "1" or your business value.
  • vanishklift-1328369557504655422

    vanishklift

    4 months ago

    1328369557211185152-image.png
  • uunicode-1328370096564994121

    unicodes

    4 months ago

    "On Load" you have selected like this?
    1328370096338636800-Screenshot_2025-01-13_at_16.28.08.png
  • vanishklift-1328370213187489853

    vanishklift

    4 months ago

    sure
    1328370213116182569-image.png
  • vanishklift-1328370242518253701

    vanishklift

    4 months ago

    dont get this part tho
  • 1328370316895977555-image.png
  • uunicode-1328370453349404723

    unicodes

    4 months ago

    try like this
    1328370453152268439-Screenshot_2025-01-13_at_16.29.41.png
  • vanishklift-1328370769276960809

    vanishklift

    4 months ago

    i did
    1328370769222303817-image.png
  • 1328370815586144266-image.png
  • gives me 0
  • and in toddle the services vansih
  • 1328370933299413002-image.png
  • uunicode-1328371016459878472

    unicodes

    4 months ago

    I'm not familiar with xano at all, but usually you need Headers like Content type, or Authorization if it is private (your is public as I noticed from screen).
    1328371016191311902-Screenshot_2025-01-13_at_16.31.13.png
  • vanishklift-1328371108813996083

    vanishklift

    4 months ago

    yeah Im public because these data is for non users
  • Tod-1328371111045501131

    Tod

    4 months ago

    Great energy @vanishklift! Your continuous contribution to the toddle Community just made you advance to Community Level 4!
  • vanishklift-1328371309503057960

    vanishklift

    4 months ago

    as I understood i only need those for auth n stuff, but im also very new to this
  • uunicode-1328371368689143869

    unicodes

    4 months ago

    try content type
  • vanishklift-1328371534997229641

    vanishklift

    4 months ago

    i can delete the eq. now right?+
  • uunicode-1328371820532863006

    unicodes

    4 months ago

    If it doesn't work anymore yes, please delete, but usually you need it for making the API know if the value you provide should be equal, or gr. (greater, etc). In supabase is mandatory.
  • Please do one more thing, in businesses success, call the services
  • vanishklift-1328371893618610219

    vanishklift

    4 months ago

    I see
  • uunicode-1328371945594687641

    unicodes

    4 months ago

    and switch off autofetch on services
  • vanishklift-1328372403260227728

    vanishklift

    4 months ago

    still null on console log
  • but in toddle it works fine
  • vanishklift-1328372475725353053

    vanishklift

    4 months ago

    thit that too
  • did*
  • thanks for that advice already seems logic
  • uunicode-1328372573267820656

    unicodes

    4 months ago

    regarding the business selection, it pass most probably null in input and not 0 or 1
  • can you please console log just that value?
  • vanishklift-1328372660065013822

    vanishklift

    4 months ago

    the inputvalue ?
  • uunicode-1328372678175883345

    unicodes

    4 months ago

    yes
  • 1328372823277703251-Screenshot_2025-01-13_at_16.39.14.png
  • here, most probably it doesn't get 1 on chrome, but for some sistuation on test mode it gets 1.
  • screen also how you get that value "1".
  • vanishklift-1328373135577190540

    vanishklift

    4 months ago

    i think i found the problem
  • as you are saying
  • it gets null
  • i switchet to string
  • instead of number
  • it gets 1
  • uunicode-1328373260068458617

    unicodes

    4 months ago

    Nice!
  • vanishklift-1328373332135120968

    vanishklift

    4 months ago

    now i try to give it as a string to the api
  • uunicode-1328373449860579549

    unicodes

    4 months ago

    do you use index for selecting services based on business id?
  • vanishklift-1328373494852878428

    vanishklift

    4 months ago

    yes currently
  • I know not good but was for tetsing porpuse only
  • I checked manually the forst business is 0 an the services start at 1
  • sorry
  • the businesses start at 1 and the index at 0
  • uunicode-1328373783979102349

    unicodes

    4 months ago

    Ok, make sure to pass the right value, you can try to add just a manual value for seeing if works on chrome, then try to get the right value from business id
  • vanishklift-1328374114221817913

    vanishklift

    4 months ago

    still doesnt work even with manually inputtet data
  • soory
  • sorry
  • it work swith manually inputet data
  • but as an integer
  • and string
  • I will be back in an hour I have to go to a metting, Thank you already for your time !! appreciate it
    ❤️1
  • vanishklift-1328396536794579068

    vanishklift

    4 months ago

    it seems that the Index I got from toddle of the database was a string, I added the +1 to a string so it was always null
  • "in Chrome"
  • but why did it work in Toddle without changing it to an Integer?
  • uunicode-1328633228243763240

    unicodes

    4 months ago

    I do not know. I'm happy you found the issue and you fixed it.