Skip to content

postman collection

Diego Martínez Sánchez edited this page Apr 30, 2023 · 3 revisions

Below the postman collection in which you can find examples of requests to consume the API.

{
	"info": {
		"_postman_id": "976f7599-e0d9-41bb-b373-7304468969da",
		"name": "Websocket API",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "6293891"
	},
	"item": [
		{
			"name": "Topics",
			"item": [
				{
					"name": "Get topics",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "http://localhost:5001/api/v1/topics?topic_name=gdcode",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"topics"
							],
							"query": [
								{
									"key": "topic_name",
									"value": "gdcode"
								}
							]
						}
					},
					"response": [
						{
							"name": "Get topics gdcode",
							"originalRequest": {
								"method": "GET",
								"header": [],
								"url": {
									"raw": "http://localhost:5001/api/v1/topics?topic_name=gdcode",
									"protocol": "http",
									"host": [
										"localhost"
									],
									"port": "5001",
									"path": [
										"api",
										"v1",
										"topics"
									],
									"query": [
										{
											"key": "topic_name",
											"value": "gdcode"
										}
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Server",
									"value": "Werkzeug/2.2.2 Python/3.10.7"
								},
								{
									"key": "Date",
									"value": "Sun, 23 Apr 2023 15:43:30 GMT"
								},
								{
									"key": "Content-Type",
									"value": "application/json"
								},
								{
									"key": "Content-Length",
									"value": "113"
								},
								{
									"key": "Connection",
									"value": "close"
								}
							],
							"cookie": [],
							"body": "{\n    \"creator\": \"memoor\",\n    \"is_private\": true,\n    \"is_user\": false,\n    \"members\": [\n        \"memoor\",\n        \"omar\",\n        \"diego\"\n    ],\n    \"topic_name\": \"gdcode\"\n}"
						}
					]
				},
				{
					"name": "Subscribe private topic",
					"request": {
						"method": "PUT",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\r\n    \"topic_name\": \"gdcode\",\r\n    \"user\": \"eder\",\r\n    \"user_source\": \"diego\"\r\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "http://localhost:5001/api/v1/topics",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"topics"
							]
						}
					},
					"response": [
						{
							"name": "Subscribe private topic",
							"originalRequest": {
								"method": "PUT",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\r\n    \"topic_name\": \"gdcode\",\r\n    \"user\": \"eder\",\r\n    \"user_source\": \"diego\"\r\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "http://localhost:5001/api/v1/topics",
									"protocol": "http",
									"host": [
										"localhost"
									],
									"port": "5001",
									"path": [
										"api",
										"v1",
										"topics"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Server",
									"value": "Werkzeug/2.2.2 Python/3.10.7"
								},
								{
									"key": "Date",
									"value": "Mon, 24 Apr 2023 14:18:53 GMT"
								},
								{
									"key": "Content-Type",
									"value": "application/json"
								},
								{
									"key": "Content-Length",
									"value": "30"
								},
								{
									"key": "Connection",
									"value": "close"
								}
							],
							"cookie": [],
							"body": "{\n    \"message\": \"User subscribed\"\n}"
						}
					]
				},
				{
					"name": "Subscribe public topic",
					"request": {
						"method": "PUT",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\r\n    \"topic_name\": \"noticias\",\r\n    \"user\": \"eder\"\r\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "http://localhost:5001/api/v1/topics",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"topics"
							]
						}
					},
					"response": [
						{
							"name": "Subscribe public topic",
							"originalRequest": {
								"method": "PUT",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\r\n    \"topic_name\": \"noticias\",\r\n    \"user\": \"eder\"\r\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "http://localhost:5001/api/v1/topics",
									"protocol": "http",
									"host": [
										"localhost"
									],
									"port": "5001",
									"path": [
										"api",
										"v1",
										"topics"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Server",
									"value": "Werkzeug/2.2.2 Python/3.10.7"
								},
								{
									"key": "Date",
									"value": "Sun, 30 Apr 2023 15:41:21 GMT"
								},
								{
									"key": "Content-Type",
									"value": "application/json"
								},
								{
									"key": "Content-Length",
									"value": "30"
								},
								{
									"key": "Connection",
									"value": "close"
								}
							],
							"cookie": [],
							"body": "{\n    \"message\": \"User subscribed\"\n}"
						}
					]
				},
				{
					"name": "Create topic",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\r\n    \"topic_name\": \"new_topic\",\r\n    \"user\": \"diego\",\r\n    \"is_private\": true\r\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "http://localhost:5001/api/v1/topics",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"topics"
							]
						}
					},
					"response": [
						{
							"name": "Create topic",
							"originalRequest": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\r\n    \"topic_name\": \"new_topic\",\r\n    \"user\": \"diego\",\r\n    \"is_private\": true\r\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "http://localhost:5001/api/v1/topics",
									"protocol": "http",
									"host": [
										"localhost"
									],
									"port": "5001",
									"path": [
										"api",
										"v1",
										"topics"
									]
								}
							},
							"status": "CREATED",
							"code": 201,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Server",
									"value": "Werkzeug/2.2.2 Python/3.10.7"
								},
								{
									"key": "Date",
									"value": "Fri, 28 Apr 2023 14:34:49 GMT"
								},
								{
									"key": "Content-Type",
									"value": "application/json"
								},
								{
									"key": "Content-Length",
									"value": "28"
								},
								{
									"key": "Connection",
									"value": "close"
								}
							],
							"cookie": [],
							"body": "{\n    \"message\": \"Topic created\"\n}"
						}
					]
				},
				{
					"name": "Delete topic",
					"request": {
						"method": "DELETE",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\r\n    \"topic_name\": \"new_topic\"\r\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "http://localhost:5001/api/v1/topics",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"topics"
							]
						}
					},
					"response": [
						{
							"name": "Delete topic",
							"originalRequest": {
								"method": "DELETE",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\r\n    \"topic_name\": \"new_topic\"\r\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "http://localhost:5001/api/v1/topics",
									"protocol": "http",
									"host": [
										"localhost"
									],
									"port": "5001",
									"path": [
										"api",
										"v1",
										"topics"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Server",
									"value": "Werkzeug/2.2.2 Python/3.10.7"
								},
								{
									"key": "Date",
									"value": "Sat, 29 Apr 2023 03:55:08 GMT"
								},
								{
									"key": "Content-Type",
									"value": "application/json"
								},
								{
									"key": "Content-Length",
									"value": "28"
								},
								{
									"key": "Connection",
									"value": "close"
								}
							],
							"cookie": [],
							"body": "{\n    \"message\": \"Topic deleted\"\n}"
						}
					]
				}
			]
		},
		{
			"name": "Messages",
			"item": [
				{
					"name": "Create message queue",
					"request": {
						"method": "POST",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\r\n    \"user\": \"diego\",\r\n    \"topic_name\": \"test_create_message\",\r\n    \"content\": \"test_message_unittest\"\r\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "http://localhost:5001/api/v1/messages",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"messages"
							]
						}
					},
					"response": [
						{
							"name": "Create message queue",
							"originalRequest": {
								"method": "POST",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\r\n    \"user\": \"diego\",\r\n    \"topic_name\": \"test_create_message\",\r\n    \"content\": \"test_message_unittest\"\r\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "http://localhost:5001/api/v1/messages",
									"protocol": "http",
									"host": [
										"localhost"
									],
									"port": "5001",
									"path": [
										"api",
										"v1",
										"messages"
									]
								}
							},
							"status": "CREATED",
							"code": 201,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Server",
									"value": "Werkzeug/2.2.2 Python/3.10.7"
								},
								{
									"key": "Date",
									"value": "Sun, 30 Apr 2023 15:45:17 GMT"
								},
								{
									"key": "Content-Type",
									"value": "application/json"
								},
								{
									"key": "Content-Length",
									"value": "30"
								},
								{
									"key": "Connection",
									"value": "close"
								}
							],
							"cookie": [],
							"body": "{\n    \"message\": \"Message created\"\n}"
						}
					]
				},
				{
					"name": "Update messages queue",
					"request": {
						"method": "PUT",
						"header": [],
						"body": {
							"mode": "raw",
							"raw": "{\r\n    \"messages\": [\r\n        {\r\n            \"action\": \"message\",\r\n            \"content\": \"Content of the message 1\",\r\n            \"topic_name\": \"general\"\r\n        },\r\n        {\r\n            \"action\": \"message\",\r\n            \"content\": \"Content of the message 2\",\r\n            \"topic_name\": \"noticias\"\r\n        },\r\n        {\r\n            \"action\": \"message\",\r\n            \"content\": \"Content of the message 3\",\r\n            \"topic_name\": \"noticias\"\r\n        }\r\n    ],\r\n    \"user\": \"omar\"\r\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": {
							"raw": "http://localhost:5001/api/v1/messages",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"messages"
							]
						}
					},
					"response": [
						{
							"name": "Update messages queue",
							"originalRequest": {
								"method": "PUT",
								"header": [],
								"body": {
									"mode": "raw",
									"raw": "{\r\n    \"messages\": [\r\n        {\r\n            \"action\": \"message\",\r\n            \"content\": \"Content of the message 1\",\r\n            \"topic_name\": \"general\"\r\n        },\r\n        {\r\n            \"action\": \"message\",\r\n            \"content\": \"Content of the message 2\",\r\n            \"topic_name\": \"noticias\"\r\n        },\r\n        {\r\n            \"action\": \"message\",\r\n            \"content\": \"Content of the message 3\",\r\n            \"topic_name\": \"noticias\"\r\n        }\r\n    ],\r\n    \"user\": \"omar\"\r\n}",
									"options": {
										"raw": {
											"language": "json"
										}
									}
								},
								"url": {
									"raw": "http://localhost:5001/api/v1/messages",
									"protocol": "http",
									"host": [
										"localhost"
									],
									"port": "5001",
									"path": [
										"api",
										"v1",
										"messages"
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Server",
									"value": "Werkzeug/2.2.2 Python/3.10.7"
								},
								{
									"key": "Date",
									"value": "Sun, 30 Apr 2023 15:48:34 GMT"
								},
								{
									"key": "Content-Type",
									"value": "application/json"
								},
								{
									"key": "Content-Length",
									"value": "30"
								},
								{
									"key": "Connection",
									"value": "close"
								}
							],
							"cookie": [],
							"body": "{\n    \"message\": \"Message deleted\"\n}"
						}
					]
				},
				{
					"name": "Get messages",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "http://localhost:5001/api/v1/messages?user=diego",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"messages"
							],
							"query": [
								{
									"key": "user",
									"value": "diego"
								}
							]
						}
					},
					"response": [
						{
							"name": "Get messages",
							"originalRequest": {
								"method": "GET",
								"header": [],
								"url": {
									"raw": "http://localhost:5001/api/v1/messages?user=diego",
									"protocol": "http",
									"host": [
										"localhost"
									],
									"port": "5001",
									"path": [
										"api",
										"v1",
										"messages"
									],
									"query": [
										{
											"key": "user",
											"value": "diego"
										}
									]
								}
							},
							"status": "OK",
							"code": 200,
							"_postman_previewlanguage": "json",
							"header": [
								{
									"key": "Server",
									"value": "Werkzeug/2.2.2 Python/3.10.7"
								},
								{
									"key": "Date",
									"value": "Sun, 30 Apr 2023 15:51:02 GMT"
								},
								{
									"key": "Content-Type",
									"value": "application/json"
								},
								{
									"key": "Content-Length",
									"value": "417"
								},
								{
									"key": "Connection",
									"value": "close"
								}
							],
							"cookie": [],
							"body": "{\n    \"messages\": [\n        {\n            \"action\": \"message\",\n            \"content\": \"Content of the message\",\n            \"not_delivered_to_user_id_topic\": [\n                \"diego\",\n                \"omar\"\n            ],\n            \"topic_name\": \"general\"\n        },\n        {\n            \"action\": \"message\",\n            \"content\": \"Content of the message\",\n            \"not_delivered_to_user_id_topic\": [\n                \"diego\",\n                \"omar\",\n                \"satoshi\"\n            ],\n            \"topic_name\": \"noticias\"\n        },\n        {\n            \"action\": \"message\",\n            \"content\": \"test_message_unittest\",\n            \"not_delivered_to_user_id_topic\": [\n                \"diego\"\n            ],\n            \"topic_name\": \"test_create_message\"\n        }\n    ]\n}"
						}
					]
				}
			]
		},
		{
			"name": "Generate token",
			"request": {
				"method": "GET",
				"header": [],
				"url": {
					"raw": "http://localhost:5001/api/v1/gen_token?user=omar&description=A token to authenticate to websocket server",
					"protocol": "http",
					"host": [
						"localhost"
					],
					"port": "5001",
					"path": [
						"api",
						"v1",
						"gen_token"
					],
					"query": [
						{
							"key": "user",
							"value": "omar"
						},
						{
							"key": "description",
							"value": "A token to authenticate to websocket server"
						}
					]
				}
			},
			"response": [
				{
					"name": "Generate token",
					"originalRequest": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "http://localhost:5001/api/v1/gen_token?user=diego&description=A token to authenticate to websocket server",
							"protocol": "http",
							"host": [
								"localhost"
							],
							"port": "5001",
							"path": [
								"api",
								"v1",
								"gen_token"
							],
							"query": [
								{
									"key": "user",
									"value": "diego"
								},
								{
									"key": "description",
									"value": "A token to authenticate to websocket server"
								}
							]
						}
					},
					"status": "OK",
					"code": 200,
					"_postman_previewlanguage": "json",
					"header": [
						{
							"key": "Server",
							"value": "Werkzeug/2.2.2 Python/3.10.7"
						},
						{
							"key": "Date",
							"value": "Tue, 25 Apr 2023 15:25:02 GMT"
						},
						{
							"key": "Content-Type",
							"value": "application/json"
						},
						{
							"key": "Content-Length",
							"value": "256"
						},
						{
							"key": "Connection",
							"value": "close"
						}
					],
					"cookie": [],
					"body": "{\n    \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2ODI1MjI3MDIsImlhdCI6MTY4MjQzNjMwMiwic3ViIjoiZGllZ28iLCJwYXlsb2FkIjp7ImRlc2NyaXB0aW9uIjoiQSB0b2tlbiB0byBhdXRoZW50aWNhdGUgdG8gd2Vic29ja2V0IHNlcnZlciJ9fQ.r4qMb0C2gk5S9N2RG6QjFIFbJBKR6iIes8dXN4qHOdM\"\n}"
				}
			]
		}
	]
}

Wiki

The project

Clone this wiki locally