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.