API Integration

(deftopic
 collect-basic-info-from-gui_4
 []
 {:pre-condition [],
  :pre-action [],
  :post-action []}
 []
 [(ask-question-gui (-<- dynamic-choice (make-single-choice-question "Is it one of the wine you are looking for ?" (format-my-data (>- request-results)))))]
(handle-collect-basic-info-from-gui_4 (>- dynamic-choice)))

(deftopic
handle-collect-basic-info-from-gui_4
[?q]
{:default-rules
({:include-after
[(juji.topics.interviewing.v4/handle-gui-completion-default
?q)]}),
:include-after
[(juji.topics.interviewing.v4/handle-gui-fallback ?q)],
:include-before [],
:pre-action [],
:post-action []}
[(-<- choice (user-move-received?))]
[(<- answer-text (get-in (>- choice) [:move 0 :text]))
(make-request "http://aaa72784.ngrok.io/Api/get-answer.php" (into {} [[:wine-selected (answer-text)]]))])

I am trying to send the selected value to back to our server but its not working. Please help.

If I send this html as response of

(make-request "http://aaa72784.ngrok.io/Api/get-answer.php" (into {} [[:wine-selected (answer-text)]]))])

its not showing anything.

answer-text here is used as variable (maybe we can change the name to answer-text-var so it does not coincide with the built-in function name, sorry about the confusion). So you can do this:

[(-<- choice (user-move-received?))]
[(<- answer-text-var (get-in (>- choice) [:move 0 :text]))
(make-request "http://aaa72784.ngrok.io/Api/get-answer.php" (into {} [[:wine-selected (>- answer-text-var)]]))]

<- assigns value into a variable, and >- retrieve’s value (refer to: https://docs.juji.io/function/)