Nextcloud talk API randomly returns 404

Hello,

Iā€™m setting up an application which trigger a call. The user running the app has a dedicated account ā€œalarmā€.
When i am executing :
curl -d ā€˜{ā€œflagsā€:1}ā€™ -H ā€œOCS-APIRequest: trueā€ -u ā€œalarm:passwordā€ ā€œhttps://MYDOMAIN/ocs/v2.php/apps/spreed/api/v1/call/CONVERSATIONTOKENā€

It sometimes works (returns 200 and trigger a nextcloud talk call) and sometimes doesnt : nextcloud returns a 404 failure (same in apache logs)

I noticed that this is only working if the specific conversation has been open by the user alarm through a browser in the last ~2 minutes.
I then checked all calls a browser was building when opening this conversation in order to perform the same call with curlā€¦ (/participants/activeā€¦) but with no successā€¦ I tried aswell to set the user agent or things like this

What could be wrong ?

Weirdest thing is that when I perform a call to get the userā€™s conversation list, this specific conversation is returned. I can even return the content of the conversation using curl -H ā€œOCS-APIRequest: trueā€ -u ā€œalarm:passwordā€ https://MYDOMAIN/ocs/v2.php/apps/spreed/api/v1/chat/TOKEN?lookIntoFuture=0&lastKnownMessageId=1&limit=1

As you almost found out yourself, you need to be active in a channel to be able to start a call.
But as you are performing very hackish things here (joining without listening to signaling api, etc) I just want you to be aware that this could break any time.

1 Like

Thank you for your reply

Iā€™m trying to set up a script that would trigger a call, I donā€™t get what I should do then

My script actually :
Perform the curl call with flags:1
Sleep 10 seconds
Perform the delete call to leave the call

I am missing something ? I donā€™t get what I need to do with the signaling API. I tried to reproduce the calls a browser is doing

I managed to get it to works, thanks to someone on the cloud.nextcloud.com public discussion !
I guess I was doing the POST call to room/token/participants/active in a wrong wayā€¦
So, executing this POST request :

curl -X POST -H ā€œOCS-APIRequest: trueā€ -u ā€œalarm:passā€ ā€œhttps://MYDOMAIN/ocs/v2.php/apps/spreed/api/v1/room/{token}/participants/activeā€

Followed by

curl -d ā€˜{ā€œflagsā€:ā€œ1ā€}ā€™ -H ā€œOCS-APIRequest: trueā€ -u ā€œalarm:passā€ https://MYDOMAIN/ocs/v2.php/apps/spreed/api/v1/call/{token}

did the trick !

1 Like

Hi! Do you know, how to use API to post anonymous topics in the conversations where guests are allowed? I mean, without password provision.