Not able to use Talk API

Hi, I am new with nextcloud and I would like to use the Talk API but I am totally messed up with the way it works, tried many things but impossible to find a way…

For instance to get conversation it is mentionned :

Base endpoint is: /ocs/v2.php/apps/spreed/api/v1
Method: GET
Endpoint: /chat/{token}

If I have my nexcloud on my unraid on http://192.168.1.66:8666, does it mean I should use : http://192.168.1.66:8666/ocs/v2.php/apps/spreed/api/v1/chat/{token}
(https://nextcloud-talk.readthedocs.io/en/turn_doc/chat/#chat-api)
Right ?

Where I can find the token and the chat id ?

Thanks a lot for help.

Each conversation has a token. It is generated/returned when the conversation is created: https://nextcloud-talk.readthedocs.io/en/turn_doc/conversation/#creating-a-new-conversation. You can also see it as part of the URL when you enter a conversation in the browser.

Not sure what you mean by chat id?!

take a look here for some discussions and references:

Thanks for the token. Forget about chat id I mixed up with another API. Thx

Thanks for help. Tried everything prensnted in these post but no lock…
is https mandatory because my currently in am with http as shown in my first post ?
Thanks

Can you post the complete request you are sending? Also it makes sense to look at what the browser sends when using the talk app :slight_smile:

Thanks again for your time…
Tried many things but this is an example
Tried to insert a picture but it does not work
This is the postman request:

{
	"info": {
		"_postman_id": "666666666666666666666666666666",
		"name": "Talk",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "6666666666666666666666"
	},
	"item": [
		{
			"name": "Get Chat",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "OCS-APIRequest",
						"value": "true",
						"type": "text"
					}
				],
				"url": {
					"raw": "http://192.168.1.55:8666/ocs/v2.php/apps/spreed/api/v1/chat/srg5ozy8",
					"protocol": "http",
					"host": [
						"192",
						"168",
						"1",
						"55"
					],
					"port": "8666",
					"path": [
						"ocs",
						"v2.php",
						"apps",
						"spreed",
						"api",
						"v1",
						"chat",
						"srg5ozy8"
					]
				}
			},
			"response": []
		}
	]
}

{ā€œocsā€:{ā€œmetaā€:{ā€œstatusā€:ā€œfailureā€,ā€œstatuscodeā€:404,ā€œmessageā€:ā€œā€},ā€œdataā€:}}

You didn’t add any parameters to your request. I think lookIntoFuture is not optional here.

What are you trying to achieve in the end?

Add this to body but nothing better, is https mandatory ?

{
ā€œlookIntoFutureā€: 0
}

I would like to use Talk like a clipboard between my iphone, ipad, and pc’s…

No, I don’t think so.

So I tried your request, added lookIntoFuture=0 (as a query param!), added basic auth with my login and ran the request, worked perfectly.

Postman:

{
	"info": {
		"_postman_id": "c7ca79c1-a0c4-4f75-81f3-3c71f2d23c6e",
		"name": "Talk",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Get Chat",
			"request": {
				"auth": {
					"type": "basic",
					"basic": [
						{
							"key": "password",
							"value": "password",
							"type": "string"
						},
						{
							"key": "username",
							"value": "username",
							"type": "string"
						}
					]
				},
				"method": "GET",
				"header": [
					{
						"key": "Accept",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "OCS-APIRequest",
						"value": "true",
						"type": "text"
					}
				],
				"url": {
					"raw": "http://<yourhost>/ocs/v2.php/apps/spreed/api/v1/chat/<token>?lookIntoFuture=0",
					"protocol": "http",
					"host": [
						"<yourhost>"
					],
					"path": [
						"ocs",
						"v2.php",
						"apps",
						"spreed",
						"api",
						"v1",
						"chat",
						"<token>"
					],
					"query": [
						{
							"key": "lookIntoFuture",
							"value": "0"
						}
					]
				}
			},
			"response": []
		}
	]
}
1 Like

You are brilliant and I am dumb! I did not use basic auth…, that’s better with user/password…

Last question, I did not find a download command to download attached documents… did I miss something? thx again

Well you did not miss it, it’s not there ;-). When a file is shared, you get the corresponding parameters (ID, link, etc) in the messageParameters object (see Rich Object String in the Talk docu/ Nextcloud Rich Object Strings Ā· Issue #1706 Ā· nextcloud/server Ā· GitHub). You can use WebDAV then to download the file. Or maybe https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#direct-download helps you. But download itself is not part of Talk.

Again I can only recommend you to take a look at the requests a browser does, that helps alot.

Thanks! I will see that.