PricingBlog

What's the right way of setting API output in a formula in preview mode

  • prettycold_-1285937958180094073

    Sam B

    1 year ago

    I think I'm missing something fundamental. One of my APIs returns an id which is an integer. I'm wanting to set this in session storage.

    I test the flow in preview mode. When I come to the step of setting the id variable, I don't see that in the formula editor. It just stops with API name -> data -> null. But I can see that my Xano API did return the id.

    Is there a standard way of fetching an API's return values (inside of data) when testing in preview mode?
    1285937958297407538-image.png
  • prettycold_-1286196933785948164

    Sam B

    1 year ago

    Knock knock, anyone ? 🧐
  • lucasg-1286312104483094619

    Lucas G

    1 year ago

    I'm not sure what you mean by standard
  • But to get data in the editor, you have to make the call
  • You can toggle the auto fetch checkbox to trigger it or add a temporary button to trigger it via click event, etc
  • Either way
  • prettycold_-1286563444127957072

    Sam B

    1 year ago

    @Lucas G Yeah I do have a form that I submit that takes me through multiple pages. I test stuff in Preview mode and not in editor.

    Assuming my API returns an id, say book_id, and I want to set this value in session storage in toddle. So in the formula editor for my variable, I choose the API and then click on data and ideally the book_id, as that gets returned.

    What I meant was, most of the time it just stops with data and so I'm unable to set the book_id and thus in further steps it gets passed as an object.

    I found a workaround of disabling authentication and invoke the form submit through the editor and in such a case I see the book_id under data. So I set it. I then enable authentication and it continues to work.

    I'll probably record a loom video, that'd be much easier 😄