{ "swagger": "2.0", "info": { "title": "Azure Web PubSub Service REST API", "version": "2021-05-01-preview" }, "x-ms-parameterized-host": { "hostTemplate": "{Endpoint}", "useSchemePrefix": false, "parameters": [ { "$ref": "#/parameters/Endpoint" } ] }, "paths": { "/api/health": { "head": { "tags": [ "general" ], "summary": "Get service health status.", "operationId": "HealthApi_GetServiceStatus", "parameters": [ { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "The service is healthy" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/:send": { "post": { "tags": [ "webpubsub" ], "summary": "Broadcast content inside request body to all the connected client connections.", "operationId": "WebPubSub_SendToAll", "consumes": [ "application/octet-stream", "text/plain", "application/json" ], "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "query", "name": "excluded", "description": "Excluded connection Ids.", "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" }, { "in": "body", "name": "message", "description": "The payload body.", "required": true, "schema": { "format": "binary", "type": "string" } } ], "responses": { "202": { "description": "The message is accepted. The service follows fire-and-forget pattern when sending messages." }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/connections/{connectionId}": { "head": { "tags": [ "webpubsub" ], "summary": "Check if the connection with the given connectionId exists.", "operationId": "WebPubSub_ConnectionExists", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "connectionId", "description": "The connection Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "404": { "description": "Not Found" }, "default": { "description": "Error response", "x-ms-error-response": true } } }, "delete": { "tags": [ "webpubsub" ], "summary": "Close the client connection.", "operationId": "WebPubSub_CloseConnection", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "connectionId", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "reason", "description": "The reason closing the client connection.", "type": "string" }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/connections/{connectionId}/:send": { "post": { "tags": [ "webpubsub" ], "summary": "Send content inside request body to the specific connection.", "operationId": "WebPubSub_SendToConnection", "consumes": [ "application/octet-stream", "text/plain", "application/json" ], "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "connectionId", "description": "The connection Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" }, { "in": "body", "name": "message", "description": "The payload body.", "required": true, "schema": { "format": "binary", "type": "string" } } ], "responses": { "202": { "description": "Success" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/groups/{group}": { "head": { "tags": [ "webpubsub" ], "summary": "Check if there are any client connections inside the given group", "operationId": "WebPubSub_GroupExists", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "group", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "maxLength": 1024, "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "404": { "description": "Not Found" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/groups/{group}/:send": { "post": { "tags": [ "webpubsub" ], "summary": "Send content inside request body to a group of connections.", "operationId": "WebPubSub_SendToGroup", "consumes": [ "application/octet-stream", "text/plain", "application/json" ], "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "group", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "maxLength": 1024, "minLength": 1 }, { "in": "query", "name": "excluded", "description": "Excluded connection Ids", "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" }, { "in": "body", "name": "message", "description": "The payload body.", "required": true, "schema": { "format": "binary", "type": "string" } } ], "responses": { "202": { "description": "Success" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/groups/{group}/connections/{connectionId}": { "put": { "tags": [ "webpubsub" ], "summary": "Add a connection to the target group.", "operationId": "WebPubSub_AddConnectionToGroup", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "group", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "maxLength": 1024, "minLength": 1 }, { "in": "path", "name": "connectionId", "description": "Target connection Id", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "404": { "description": "Not Found" }, "default": { "description": "Error response", "x-ms-error-response": true } } }, "delete": { "tags": [ "webpubsub" ], "summary": "Remove a connection from the target group.", "operationId": "WebPubSub_RemoveConnectionFromGroup", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "group", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "maxLength": 1024, "minLength": 1 }, { "in": "path", "name": "connectionId", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/users/{userId}": { "head": { "tags": [ "webpubsub" ], "summary": "Check if there are any client connections connected for the given user.", "operationId": "WebPubSub_UserExists", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "userId", "description": "Target user Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "404": { "description": "Not Found" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/users/{userId}/:send": { "post": { "tags": [ "webpubsub" ], "summary": "Send content inside request body to the specific user.", "operationId": "WebPubSub_SendToUser", "consumes": [ "application/octet-stream", "text/plain", "application/json" ], "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "userId", "description": "The user Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" }, { "in": "body", "name": "message", "description": "The payload body.", "required": true, "schema": { "format": "binary", "type": "string" } } ], "responses": { "202": { "description": "Success" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/users/{userId}/groups/{group}": { "put": { "tags": [ "webpubsub" ], "summary": "Add a user to the target group.", "operationId": "WebPubSub_AddUserToGroup", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "group", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "maxLength": 1024, "minLength": 1 }, { "in": "path", "name": "userId", "description": "Target user Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "404": { "description": "Not Found" }, "default": { "description": "Error response", "x-ms-error-response": true } } }, "delete": { "tags": [ "webpubsub" ], "summary": "Remove a user from the target group.", "operationId": "WebPubSub_RemoveUserFromGroup", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "group", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "maxLength": 1024, "minLength": 1 }, { "in": "path", "name": "userId", "description": "Target user Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/users/{userId}/groups": { "delete": { "tags": [ "webpubsub" ], "summary": "Remove a user from all groups.", "operationId": "WebPubSub_RemoveUserFromAllGroups", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "userId", "description": "Target user Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "The user is deleted." }, "default": { "description": "Error response", "x-ms-error-response": true } } } }, "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}": { "put": { "tags": [ "webpubsub" ], "summary": "Grant permission to the connection.", "operationId": "WebPubSub_GrantPermission", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "permission", "description": "The permission: current supported actions are joinLeaveGroup and sendToGroup.", "required": true, "type": "string", "enum": [ "sendToGroup", "joinLeaveGroup" ], "x-ms-enum": { "name": "WebPubSubPermission", "modelAsString": true } }, { "in": "path", "name": "connectionId", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "targetName", "description": "The meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.", "type": "string" }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "default": { "description": "Error response", "x-ms-error-response": true } } }, "delete": { "tags": [ "webpubsub" ], "summary": "Revoke permission for the connection.", "operationId": "WebPubSub_RevokePermission", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "permission", "description": "The permission: current supported actions are joinLeaveGroup and sendToGroup.", "required": true, "type": "string", "enum": [ "sendToGroup", "joinLeaveGroup" ], "x-ms-enum": { "name": "WebPubSubPermission", "modelAsString": true } }, { "in": "path", "name": "connectionId", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "targetName", "description": "The meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.", "type": "string" }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "default": { "description": "Error response", "x-ms-error-response": true } } }, "head": { "tags": [ "webpubsub" ], "summary": "Check if a connection has permission to the specified action.", "operationId": "WebPubSub_CheckPermission", "parameters": [ { "in": "path", "name": "hub", "description": "Target hub name, which should start with alphabetic characters and only contain alpha-numeric characters or underscore.", "required": true, "type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_`,.[\\]]{0,127}$" }, { "in": "path", "name": "permission", "description": "The permission: current supported actions are joinLeaveGroup and sendToGroup.", "required": true, "type": "string", "enum": [ "sendToGroup", "joinLeaveGroup" ], "x-ms-enum": { "name": "WebPubSubPermission", "modelAsString": true } }, { "in": "path", "name": "connectionId", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "in": "query", "name": "targetName", "description": "The meaning of the target depends on the specific permission. For joinLeaveGroup and sendToGroup, targetName is a required parameter standing for the group name.", "type": "string" }, { "in": "query", "name": "api-version", "description": "The version of the REST APIs.", "type": "string", "default": "2021-05-01-preview" } ], "responses": { "200": { "description": "Success" }, "404": { "description": "Not Found" }, "default": { "description": "Error response", "x-ms-error-response": true } } } } }, "parameters": { "Endpoint": { "name": "Endpoint", "description": "HTTP or HTTPS endpoint for the Web PubSub service instance.", "x-ms-parameter-location": "client", "required": true, "type": "string", "in": "path", "x-ms-skip-url-encoding": true } } }