sensitive-blue
sensitive-blueβ€’17mo ago

Issue with returned response from API

Hello, I'm trying to integrate Stack AI API within VF. Everything is working fine (or seems to), I'm getting "status:" 200, returned. However, when I run flow test, I'm getting "0" as an answer and I don't understand why. I have mapped the correct variable and everything.
No description
12 Replies
sensitive-blue
sensitive-blueOPβ€’17mo ago
No description
wise-white
wise-whiteβ€’17mo ago
Can you share a screenshot of the full API call step? We're also using stack
sensitive-blue
sensitive-blueOPβ€’17mo ago
There you go @MikeG
No description
No description
wise-white
wise-whiteβ€’17mo ago
In the capture response step, make it response.out-0 πŸ™‚
sensitive-blue
sensitive-blueOPβ€’17mo ago
So I tried replacing "out-0" with "response.out-0", but it is still returning "0"
No description
No description
wise-white
wise-whiteβ€’17mo ago
sorry, make it outputs.out-0 My bad ^^
sensitive-blue
sensitive-blueOPβ€’17mo ago
Now it worked thanks! What's the logic behind? Why does it work with outputs.out-0 rather than response.out-0 or simply out-0?
wise-white
wise-whiteβ€’17mo ago
because stack AI wraps it's response in a outputs object So the response is
{
"outputs": {
"out-0": "Message"
}
}
{
"outputs": {
"out-0": "Message"
}
}
And thus to get to out-0, you need to go through outputs. outputs.out-0
sensitive-blue
sensitive-blueOPβ€’17mo ago
Actually question was more "Where did you see that Stack wraps its response as outputs.out-0, but I suppose it's all in the docs Anyways, thanks for your time @MikeG !
wise-white
wise-whiteβ€’17mo ago
Ye in the docs, but also if you make an API step, you can test it out within VF itself, which will show the response πŸ™‚
sensitive-blue
sensitive-blueOPβ€’17mo ago
Hmmm, I do not have the developer reflexes. I should quickly acquire those aha! Thanks a lot again πŸ™‚
wise-white
wise-whiteβ€’17mo ago
No worries! Aways happy to help if you run in to something!

Did you find this page helpful?