Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2022-09-29 18:26:06

bruno.silvafiep
New member
Registered: 2022-09-28
Posts: 5

Rest API return an empty array []

Hello, I'm trying to collect some data from my Moodle database made available via webservice, but at LHC the data returns an empty array []. Doing the same in a javascript code, I get the returns. Is there a tutorial or video that demonstrates how to use it? Follow prints
1664475874_rest_api_javascript.jpg
1664475880_rest_api_lhc_1.jpg
1664475884_rest_api_lhc_2.png
1664475888_rest_api_lhc_3.png

Offline

#2 2022-09-30 03:24:57

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Rest API return an empty array []

Offline

#3 2022-10-11 14:02:54

bruno.silvafiep
New member
Registered: 2022-09-28
Posts: 5

Re: Rest API return an empty array []

Hi, I managed to get the information correctly, thank you very much.

I would like to ask another question. In that first API call, the return shows me the user ID. Would it be possible for me to store this ID in a variable, so that I can call another API request using this variable?

Example: 1665496918_a.png

use an api, collect the id and call another api using that collected id

Offline

#4 2022-10-11 14:40:56

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Rest API return an empty array []

Yes, use update current chat trigger response there is option to save variable. Also see samples in the doc…

Offline

#5 2022-10-12 14:24:12

PeopleInside
Administrator
From: Italy
Registered: 2014-04-10
Posts: 4,046
Website

Re: Rest API return an empty array []

bruno.silvafiep wrote:

Hi, I managed to get the information correctly, thank you very much.

I would like to ask another question. In that first API call, the return shows me the user ID. Would it be possible for me to store this ID in a variable, so that I can call another API request using this variable?

Example: https://forum.livehelperchat.com/img/33 … 6918_a.png

use an api, collect the id and call another api using that collected id

Please don't share on the forum pictures with email address,
thank you.

Email address exposed can be attacked by spam or malware and can be some user data that must be stay private and not public  smile


lol PeopleInside - Live helper chat - free limited forum support!
wink For commercial support or GitHub [see FAQ here]
ops If you want to support this open source project, just donate [see support page]
glasses Something wrong with the forum? [contact a superhero]

Offline

#6 2022-10-13 16:30:35

Guilherme
Member
Registered: 2022-10-11
Posts: 10

Re: Rest API return an empty array []

remdex wrote:

Yes, use update current chat trigger response there is option to save variable. Also see samples in the doc…

I'm trying to do this too.

I was unable to complete the process following the documentation.

Would it be something like this?

1665678620_captura_de_tela_2022-10-13_as_13.29.16.png

Offline

#7 2022-10-16 14:43:29

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Rest API return an empty array []

Offline

#8 2022-10-18 19:49:54

Guilherme
Member
Registered: 2022-10-11
Posts: 10

Re: Rest API return an empty array []

I'm sorry, but I'm having trouble even with the documentation

1666122226_captura_de_tela_2022-10-18_as_16.37.49.jpg

1666122262_captura_de_tela_2022-10-18_as_16.40.25.png

I managed to retrieve the value of the array through the documentation.

forum.livehelperchat.com/viewtopic.php?id=4127

I just can't save the value in a variable, to reuse it in a new REST API query

remdex if you can direct me I would be very grateful

Offline

#9 2022-10-19 06:58:45

remdex
Administrator
From: Lithuania
Registered: 2012-09-23
Posts: 3,661
Website

Re: Rest API return an empty array []

https://doc.livehelperchat.com/docs/bot … out-coding

See above how variables are set and reused smile

Offline

#10 2022-10-22 02:48:41

Guilherme
Member
Registered: 2022-10-11
Posts: 10

Re: Rest API return an empty array []

remax, thank you for the answer, and I really tried and read the link you sent me, but I really wasn't able to save the return I have from the REST API query, which I get correctly with Contract ID after consulting the User ID, to perform a new one User Agreement REST API query.

So I'm going to change (create) my API, a method to return the values in a single block. I don't think it's the right way to do it, but it will be the way I know how to do it.

Offline

Board footer