PricingBlog

Assign API query results to a variable

  • uunicode-1265008000733806622

    unicodes

    1 year ago

    I have an API request that fetches some data. I created a new variable and, as an initial value, I copied and pasted the values of the query just to have all the fields right. Upon the success of the API call, I selected the variable and, assigned similar values to the initial value of the variable. However, the variable does not get the new values, even though the API returns the data correctly. Why?
  • lucasg-1265012100997320764

    Lucas G

    1 year ago

    Try setting the variable onSuccess of the API call instead of as an initial value
  • lucasg-1265012355016818843

    Lucas G

    1 year ago

    1265012354987462666-image.png
  • uunicode-1265015404653318226

    unicodes

    1 year ago

    It does not work. Fetch correct data, but the variable is empty. I can not figure out why is empty.
    1265015404523163738-Screenshot_2024-07-22_at_21.38.26.png
  • lucasg-1265017724141179042

    Lucas G

    1 year ago

    Does it work correctly on the frontend/preview site?
  • You're right in that something is off if the variable isn't being set on a successful API call
  • Sometimes a hard refresh sorts things out
  • Hard to know what could be the issue without taking a look at the editor
  • uunicode-1265020437838954691

    unicodes

    1 year ago

    A refresh with Shift pressed solved everything this time 😂
    👍1
  • uunicode-1265021270492319815

    unicodes

    1 year ago

    Thank you Lucas! I love toddle and the community is awesome!
    🔥1
  • lucasg-1265026786631221379

    Lucas G

    1 year ago

    It really is