{ "swagger": "2.0", "info": { "title": "Azure Web PubSub Service REST API", "version": "2024-12-01", "description": "WebPubSubServiceClient", "x-typespec-generated": [ { "emitter": "@azure-tools/typespec-autorest" } ] }, "schemes": [ "https" ], "x-ms-parameterized-host": { "hostTemplate": "{endpoint}", "useSchemePrefix": false, "parameters": [ { "name": "endpoint", "in": "path", "description": "HTTP or HTTPS endpoint for the Web PubSub service instance", "required": true, "type": "string", "format": "uri", "x-ms-skip-url-encoding": true } ] }, "produces": [ "application/json" ], "consumes": [ "application/json" ], "security": [ { "OAuth2Auth": [ "https://webpubsub.azure.com/.default" ] } ], "securityDefinitions": { "OAuth2Auth": { "type": "oauth2", "flow": "implicit", "authorizationUrl": "https://login.microsoftonline.com/common/oauth2/authorize", "scopes": { "https://webpubsub.azure.com/.default": "" } } }, "tags": [ { "name": "general" }, { "name": "webpubsub" } ], "paths": { "/api/health": { "head": { "operationId": "GetServiceStatus", "tags": [ "general" ], "summary": "Get service health status.", "description": "Get service health status.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" } ], "responses": { "200": { "description": "The service is healthy." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "GetServiceStatus": { "$ref": "./examples/HealthApi_GetServiceStatus.json" } } } }, "/api/hubs/{hub}/:addToGroups": { "post": { "operationId": "AddConnectionsToGroups", "tags": [ "webpubsub" ], "summary": "Add filtered connections to multiple groups.", "description": "Add filtered connections to multiple groups.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "groupsToAdd", "in": "body", "description": "Target groups and connection filter.", "required": true, "schema": { "$ref": "#/definitions/AddToGroupsRequest" } } ], "responses": { "200": { "description": "The request has succeeded." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "AddConnectionsToGroups": { "$ref": "./examples/WebPubSub_AddConnectionsToGroups.json" } } } }, "/api/hubs/{hub}/:closeConnections": { "post": { "operationId": "CloseAllConnections", "tags": [ "webpubsub" ], "summary": "Close the connections in the hub.", "description": "Close the connections in the hub.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "excluded", "in": "query", "description": "Exclude these connectionIds when closing the connections in the hub.", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "reason", "in": "query", "description": "The reason closing the client connection.", "required": false, "type": "string" } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "CloseAllConnections": { "$ref": "./examples/WebPubSub_CloseAllConnections.json" } } } }, "/api/hubs/{hub}/:generateToken": { "post": { "operationId": "GenerateClientToken", "tags": [ "webpubsub" ], "summary": "Generate token for the client to connect Azure Web PubSub service.", "description": "Generate token for the client to connect Azure Web PubSub service.", "produces": [ "text/plain", "application/json", "text/json" ], "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "userId", "in": "query", "description": "User Id.", "required": false, "type": "string" }, { "name": "role", "in": "query", "description": "Roles that the connection with the generated token will have.", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "minutesToExpire", "in": "query", "description": "The expire time of the generated token.", "required": false, "type": "integer", "format": "int32", "default": 60, "minimum": 1 }, { "name": "group", "in": "query", "description": "Groups that the connection will join when it connects.", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "clientType", "in": "query", "description": "The type of client. Case-insensitive. If not set, it's \"Default\". For Web PubSub for Socket.IO, only the default value is supported. For Web PubSub, the valid values are 'Default' and 'MQTT'.", "required": false, "type": "string", "default": "Default", "enum": [ "Default", "MQTT" ], "x-ms-enum": { "name": "WebPubSubClientType", "modelAsString": true, "values": [ { "name": "Default", "value": "Default", "description": "Default value." }, { "name": "MQTT", "value": "MQTT", "description": "MQTT client." } ] } } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/ClientTokenResponse" } }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "GenerateClientToken": { "$ref": "./examples/WebPubSub_GenerateClientToken.json" } } } }, "/api/hubs/{hub}/:removeFromGroups": { "post": { "operationId": "RemoveConnectionsFromGroups", "tags": [ "webpubsub" ], "summary": "Remove filtered connections from multiple groups.", "description": "Remove filtered connections from multiple groups.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "groupsToRemove", "in": "body", "description": "Target groups and connection filter.", "required": true, "schema": { "$ref": "#/definitions/RemoveFromGroupsRequest" } } ], "responses": { "200": { "description": "The request has succeeded." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "RemoveConnectionsFromGroups": { "$ref": "./examples/WebPubSub_RemoveConnectionsFromGroups.json" } } } }, "/api/hubs/{hub}/:send": { "post": { "operationId": "SendToAll", "tags": [ "webpubsub" ], "summary": "Broadcast content inside request body to all the connected client connections.", "description": "Broadcast content inside request body to all the connected client connections.", "consumes": [ "application/json", "application/octet-stream", "text/plain" ], "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "excluded", "in": "query", "description": "Excluded connection Ids.", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "filter", "in": "query", "description": "Following OData filter syntax to filter out the subscribers receiving the messages.", "required": false, "type": "string" }, { "name": "messageTtlSeconds", "in": "query", "description": "The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited.", "required": false, "type": "integer", "format": "int32", "minimum": 0, "maximum": 300 }, { "name": "message", "in": "body", "description": "The payload body.", "required": true, "schema": { "type": "string", "format": "byte" } } ], "responses": { "202": { "description": "The request has been accepted for processing, but processing has not yet completed." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "SendToAll": { "$ref": "./examples/WebPubSub_SendToAll.json" } } } }, "/api/hubs/{hub}/connections/{connectionId}": { "delete": { "operationId": "CloseConnection", "tags": [ "webpubsub" ], "summary": "Close the client connection.", "description": "Close the client connection.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "connectionId", "in": "path", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "name": "reason", "in": "query", "description": "The reason closing the client connection.", "required": false, "type": "string" } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "CloseConnection": { "$ref": "./examples/WebPubSub_CloseConnection.json" } } }, "head": { "operationId": "ConnectionExists", "tags": [ "webpubsub" ], "summary": "Check if the connection with the given connectionId exists.", "description": "Check if the connection with the given connectionId exists.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "connectionId", "in": "path", "description": "The connection Id.", "required": true, "type": "string", "minLength": 1 } ], "responses": { "200": { "description": "The request has succeeded." }, "404": { "description": "The server cannot find the requested resource." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "ConnectionExists": { "$ref": "./examples/WebPubSub_ConnectionExists.json" } } } }, "/api/hubs/{hub}/connections/{connectionId}/:send": { "post": { "operationId": "SendToConnection", "tags": [ "webpubsub" ], "summary": "Send content inside request body to the specific connection.", "description": "Send content inside request body to the specific connection.", "consumes": [ "application/json", "application/octet-stream", "text/plain" ], "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "connectionId", "in": "path", "description": "The connection Id.", "required": true, "type": "string", "minLength": 1 }, { "name": "messageTtlSeconds", "in": "query", "description": "The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited.", "required": false, "type": "integer", "format": "int32", "minimum": 0, "maximum": 300 }, { "name": "message", "in": "body", "description": "The payload body.", "required": true, "schema": { "type": "string", "format": "byte" } } ], "responses": { "202": { "description": "The request has been accepted for processing, but processing has not yet completed." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "SendToConnection": { "$ref": "./examples/WebPubSub_SendToConnection.json" } } } }, "/api/hubs/{hub}/connections/{connectionId}/groups": { "delete": { "operationId": "RemoveConnectionFromAllGroups", "tags": [ "webpubsub" ], "summary": "Remove a connection from all groups.", "description": "Remove a connection from all groups.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "connectionId", "in": "path", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "RemoveConnectionFromAllGroups": { "$ref": "./examples/WebPubSub_RemoveConnectionFromAllGroups.json" } } } }, "/api/hubs/{hub}/groups/{group}": { "head": { "operationId": "GroupExists", "tags": [ "webpubsub" ], "summary": "Check if there are any client connections inside the given group", "description": "Check if there are any client connections inside the given group", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "group", "in": "path", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!\\s+$).+$" } ], "responses": { "200": { "description": "The request has succeeded." }, "404": { "description": "The server cannot find the requested resource." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "GroupExists": { "$ref": "./examples/WebPubSub_GroupExists.json" } } } }, "/api/hubs/{hub}/groups/{group}/:closeConnections": { "post": { "operationId": "CloseGroupConnections", "tags": [ "webpubsub" ], "summary": "Close connections in the specific group.", "description": "Close connections in the specific group.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "group", "in": "path", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!\\s+$).+$" }, { "name": "excluded", "in": "query", "description": "Exclude these connectionIds when closing the connections in the group.", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "reason", "in": "query", "description": "The reason closing the client connection.", "required": false, "type": "string" } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "CloseGroupConnections": { "$ref": "./examples/WebPubSub_CloseGroupConnections.json" } } } }, "/api/hubs/{hub}/groups/{group}/:send": { "post": { "operationId": "SendToGroup", "tags": [ "webpubsub" ], "summary": "Send content inside request body to a group of connections.", "description": "Send content inside request body to a group of connections.", "consumes": [ "application/json", "application/octet-stream", "text/plain" ], "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "group", "in": "path", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!\\s+$).+$" }, { "name": "excluded", "in": "query", "description": "Excluded connection Ids", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "filter", "in": "query", "description": "Following OData filter syntax to filter out the subscribers receiving the messages.", "required": false, "type": "string" }, { "name": "messageTtlSeconds", "in": "query", "description": "The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited.", "required": false, "type": "integer", "format": "int32", "minimum": 0, "maximum": 300 }, { "name": "message", "in": "body", "description": "The payload body.", "required": true, "schema": { "type": "string", "format": "byte" } } ], "responses": { "202": { "description": "The request has been accepted for processing, but processing has not yet completed." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "SendToGroup": { "$ref": "./examples/WebPubSub_SendToGroup.json" } } } }, "/api/hubs/{hub}/groups/{group}/connections": { "get": { "operationId": "ListConnectionsInGroup", "tags": [ "webpubsub" ], "summary": "List connections in a group.", "description": "List connections in a group.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "group", "in": "path", "description": "Target group name, whose length should be greater than 0 and less than 1025.", "required": true, "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!\\s+$).+$" }, { "name": "maxpagesize", "in": "query", "description": "The maximum number of connections to include in a single response. It should be between 1 and 200.", "required": false, "type": "integer", "format": "int32", "minimum": 1, "maximum": 200 }, { "name": "top", "in": "query", "description": "The maximum number of connections to return. If the value is not set, then all the connections in a group are returned.", "required": false, "type": "integer", "format": "int32", "minimum": 1, "maximum": 2147483647 }, { "name": "continuationToken", "in": "query", "description": "A token that allows the client to retrieve the next page of results. This parameter is provided by the service in the response of a previous request when there are additional results to be fetched. Clients should include the continuationToken in the next request to receive the subsequent page of data. If this parameter is omitted, the server will return the first page of results.", "required": false, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/GroupMemberPagedValues" } }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "ListConnectionsInGroup": { "$ref": "./examples/WebPubSub_ListConnectionsInGroup.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, "/api/hubs/{hub}/groups/{group}/connections/{connectionId}": { "put": { "operationId": "AddConnectionToGroup", "tags": [ "webpubsub" ], "summary": "Add a connection to the target group.", "description": "Add a connection to the target group.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "group", "in": "path", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!\\s+$).+$" }, { "name": "connectionId", "in": "path", "description": "Target connection Id", "required": true, "type": "string", "minLength": 1 } ], "responses": { "200": { "description": "The request has succeeded." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "AddConnectionToGroup": { "$ref": "./examples/WebPubSub_AddConnectionToGroup.json" } } }, "delete": { "operationId": "RemoveConnectionFromGroup", "tags": [ "webpubsub" ], "summary": "Remove a connection from the target group.", "description": "Remove a connection from the target group.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "group", "in": "path", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!\\s+$).+$" }, { "name": "connectionId", "in": "path", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "RemoveConnectionFromGroup": { "$ref": "./examples/WebPubSub_RemoveConnectionFromGroup.json" } } } }, "/api/hubs/{hub}/permissions/{permission}/connections/{connectionId}": { "put": { "operationId": "GrantPermission", "tags": [ "webpubsub" ], "summary": "Grant permission to the connection.", "description": "Grant permission to the connection.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "permission", "in": "path", "description": "The permission: current supported actions are joinLeaveGroup and sendToGroup.", "required": true, "type": "string", "enum": [ "sendToGroup", "joinLeaveGroup" ], "x-ms-enum": { "name": "WebPubSubPermission", "modelAsString": true, "values": [ { "name": "SendToGroup", "value": "sendToGroup", "description": "The permission to send messages to groups." }, { "name": "JoinLeaveGroup", "value": "joinLeaveGroup", "description": "The permission to join/leave groups." } ] } }, { "name": "connectionId", "in": "path", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "name": "targetName", "in": "query", "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.", "required": false, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "GrantPermission": { "$ref": "./examples/WebPubSub_GrantPermission.json" } } }, "delete": { "operationId": "RevokePermission", "tags": [ "webpubsub" ], "summary": "Revoke permission for the connection.", "description": "Revoke permission for the connection.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "permission", "in": "path", "description": "The permission: current supported actions are joinLeaveGroup and sendToGroup.", "required": true, "type": "string", "enum": [ "sendToGroup", "joinLeaveGroup" ], "x-ms-enum": { "name": "WebPubSubPermission", "modelAsString": true, "values": [ { "name": "SendToGroup", "value": "sendToGroup", "description": "The permission to send messages to groups." }, { "name": "JoinLeaveGroup", "value": "joinLeaveGroup", "description": "The permission to join/leave groups." } ] } }, { "name": "connectionId", "in": "path", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "name": "targetName", "in": "query", "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.", "required": false, "type": "string" } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "RevokePermission": { "$ref": "./examples/WebPubSub_RevokePermission.json" } } }, "head": { "operationId": "CheckPermission", "tags": [ "webpubsub" ], "summary": "Check if a connection has permission to the specified action.", "description": "Check if a connection has permission to the specified action.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "permission", "in": "path", "description": "The permission: current supported actions are joinLeaveGroup and sendToGroup.", "required": true, "type": "string", "enum": [ "sendToGroup", "joinLeaveGroup" ], "x-ms-enum": { "name": "WebPubSubPermission", "modelAsString": true, "values": [ { "name": "SendToGroup", "value": "sendToGroup", "description": "The permission to send messages to groups." }, { "name": "JoinLeaveGroup", "value": "joinLeaveGroup", "description": "The permission to join/leave groups." } ] } }, { "name": "connectionId", "in": "path", "description": "Target connection Id.", "required": true, "type": "string", "minLength": 1 }, { "name": "targetName", "in": "query", "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.", "required": false, "type": "string" } ], "responses": { "200": { "description": "The request has succeeded." }, "404": { "description": "The server cannot find the requested resource." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "CheckPermission": { "$ref": "./examples/WebPubSub_CheckPermission.json" } } } }, "/api/hubs/{hub}/users/{userId}": { "head": { "operationId": "UserExists", "tags": [ "webpubsub" ], "summary": "Check if there are any client connections connected for the given user.", "description": "Check if there are any client connections connected for the given user.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "userId", "in": "path", "description": "Target user Id.", "required": true, "type": "string", "minLength": 1 } ], "responses": { "200": { "description": "The request has succeeded." }, "404": { "description": "The server cannot find the requested resource." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "UserExists": { "$ref": "./examples/WebPubSub_UserExists.json" } } } }, "/api/hubs/{hub}/users/{userId}/:closeConnections": { "post": { "operationId": "CloseUserConnections", "tags": [ "webpubsub" ], "summary": "Close connections for the specific user.", "description": "Close connections for the specific user.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "userId", "in": "path", "description": "The user Id.", "required": true, "type": "string", "minLength": 1 }, { "name": "excluded", "in": "query", "description": "Exclude these connectionIds when closing the connections for the user.", "required": false, "type": "array", "items": { "type": "string" }, "collectionFormat": "multi" }, { "name": "reason", "in": "query", "description": "The reason closing the client connection.", "required": false, "type": "string" } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "CloseUserConnections": { "$ref": "./examples/WebPubSub_CloseUserConnections.json" } } } }, "/api/hubs/{hub}/users/{userId}/:send": { "post": { "operationId": "SendToUser", "tags": [ "webpubsub" ], "summary": "Send content inside request body to the specific user.", "description": "Send content inside request body to the specific user.", "consumes": [ "application/json", "application/octet-stream", "text/plain" ], "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "userId", "in": "path", "description": "The user Id.", "required": true, "type": "string", "minLength": 1 }, { "name": "filter", "in": "query", "description": "Following OData filter syntax to filter out the subscribers receiving the messages.", "required": false, "type": "string" }, { "name": "messageTtlSeconds", "in": "query", "description": "The time-to-live (TTL) value in seconds for messages sent to the service. 0 is the default value, which means the message never expires. 300 is the maximum value. If this parameter is non-zero, messages that are not consumed by the client within the specified TTL will be dropped by the service. This parameter can help when the client's bandwidth is limited.", "required": false, "type": "integer", "format": "int32", "minimum": 0, "maximum": 300 }, { "name": "message", "in": "body", "description": "The payload body.", "required": true, "schema": { "type": "string", "format": "byte" } } ], "responses": { "202": { "description": "The request has been accepted for processing, but processing has not yet completed." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "SendToUser": { "$ref": "./examples/WebPubSub_SendToUser.json" } } } }, "/api/hubs/{hub}/users/{userId}/groups": { "delete": { "operationId": "RemoveUserFromAllGroups", "tags": [ "webpubsub" ], "summary": "Remove a user from all groups.", "description": "Remove a user from all groups.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "userId", "in": "path", "description": "Target user Id.", "required": true, "type": "string", "minLength": 1 } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "RemoveUserFromAllGroups": { "$ref": "./examples/WebPubSub_RemoveUserFromAllGroups.json" } } } }, "/api/hubs/{hub}/users/{userId}/groups/{group}": { "put": { "operationId": "AddUserToGroup", "tags": [ "webpubsub" ], "summary": "Add a user to the target group.", "description": "Add a user to the target group.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "group", "in": "path", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!\\s+$).+$" }, { "name": "userId", "in": "path", "description": "Target user Id.", "required": true, "type": "string", "minLength": 1 } ], "responses": { "200": { "description": "The request has succeeded." }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "AddUserToGroup": { "$ref": "./examples/WebPubSub_AddUserToGroup.json" } } }, "delete": { "operationId": "RemoveUserFromGroup", "tags": [ "webpubsub" ], "summary": "Remove a user from the target group.", "description": "Remove a user from the target group.", "parameters": [ { "$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter" }, { "name": "hub", "in": "path", "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}$" }, { "name": "group", "in": "path", "description": "Target group name, which length should be greater than 0 and less than 1025.", "required": true, "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!\\s+$).+$" }, { "name": "userId", "in": "path", "description": "Target user Id.", "required": true, "type": "string", "minLength": 1 } ], "responses": { "204": { "description": "There is no content to send for this request, but the headers may be useful. " }, "default": { "description": "The error response.", "schema": { "$ref": "#/definitions/ErrorDetail" }, "headers": { "x-ms-error-code": { "type": "string", "description": "The error code." } } } }, "x-ms-examples": { "RemoveUserFromGroup": { "$ref": "./examples/WebPubSub_RemoveUserFromGroup.json" } } } } }, "definitions": { "AddToGroupsRequest": { "type": "object", "description": "Request object to add connections to groups", "properties": { "groups": { "type": "array", "description": "Target groups", "items": { "type": "string" } }, "filter": { "type": "string", "description": "Following OData filter syntax to filter out the subscribers receiving the messages" } }, "required": [ "groups" ] }, "ClientDetail": { "type": "object", "description": "Details about the client.", "properties": { "userId": { "type": "string", "description": "User Id" }, "roles": { "type": "array", "description": "Roles that the connection with the user id has", "items": { "type": "string" } } } }, "ClientTokenResponse": { "type": "object", "description": "The response object containing the client access token", "properties": { "token": { "type": "string", "description": "Access token for the client to connect Azure Web PubSub service" } }, "required": [ "token" ] }, "ContentType": { "type": "string", "description": "Content type for upload", "enum": [ "application/json", "application/octet-stream", "text/plain" ], "x-ms-enum": { "name": "ContentType", "modelAsString": true, "values": [ { "name": "application/json", "value": "application/json", "description": "Content Type 'application/json'" }, { "name": "application/octet-stream", "value": "application/octet-stream", "description": "Content Type 'application/octet-stream'" }, { "name": "text/plain", "value": "text/plain", "description": "Content Type 'text/plain'" } ] } }, "ErrorDetail": { "type": "object", "description": "The error object.", "properties": { "code": { "type": "string", "description": "One of a server-defined set of error codes." }, "message": { "type": "string", "description": "A human-readable representation of the error." }, "target": { "type": "string", "description": "The target of the error." }, "details": { "type": "array", "description": "An array of details about specific errors that led to this reported error.", "items": { "$ref": "#/definitions/ErrorDetail" } }, "inner": { "$ref": "#/definitions/InnerError", "description": "An object containing more specific information about the error." } } }, "ErrorResponse": { "type": "object", "description": "The error response.", "properties": { "body": { "$ref": "#/definitions/ErrorDetail", "description": "The error detail body." } }, "required": [ "body" ] }, "GetServiceStatusOkResponse": { "type": "object", "description": "The service is healthy." }, "GroupMember": { "type": "object", "description": "Group member", "properties": { "connectionId": { "type": "string", "description": "Connection Id" }, "userId": { "type": "string", "description": "User Id" } }, "required": [ "connectionId" ] }, "GroupMemberPagedValues": { "type": "object", "description": "Paged response for group members", "properties": { "value": { "type": "array", "description": "The group members", "items": { "$ref": "#/definitions/GroupMember" } }, "nextLink": { "type": "string", "description": "The link to the next page of results" } }, "required": [ "value" ] }, "InnerError": { "type": "object", "description": "Inner error detail.", "properties": { "code": { "type": "string", "description": "A more specific error code than was provided by the containing error." }, "inner": { "$ref": "#/definitions/InnerError", "description": "Inner error." } } }, "MessageContentType": { "type": "string", "description": "Content type for HTTP headers in message operations (closed union for HTTP compliance)", "enum": [ "application/json", "application/octet-stream", "text/plain" ], "x-ms-enum": { "name": "MessageContentType", "modelAsString": false, "values": [ { "name": "application/json", "value": "application/json", "description": "Content Type 'application/json'" }, { "name": "application/octet-stream", "value": "application/octet-stream", "description": "Content Type 'application/octet-stream'" }, { "name": "text/plain", "value": "text/plain", "description": "Content Type 'text/plain'" } ] } }, "RemoveFromGroupsRequest": { "type": "object", "description": "Request object to remove connections from groups", "properties": { "groups": { "type": "array", "description": "Target groups", "items": { "type": "string" } }, "filter": { "type": "string", "description": "Following OData filter syntax to filter out the subscribers receiving the messages" } }, "required": [ "groups" ] }, "ResponseContentType": { "type": "string", "description": "Content type for response headers (closed union for HTTP compliance)", "enum": [ "text/plain", "application/json", "text/json" ], "x-ms-enum": { "name": "ResponseContentType", "modelAsString": false, "values": [ { "name": "text/plain", "value": "text/plain", "description": "Content Type 'text/plain'" }, { "name": "application/json", "value": "application/json", "description": "Content Type 'application/json'" }, { "name": "text/json", "value": "text/json", "description": "Content Type 'text/json'" } ] } }, "WebPubSubClientType": { "type": "string", "description": "Web PubSub client type", "enum": [ "Default", "MQTT" ], "x-ms-enum": { "name": "WebPubSubClientType", "modelAsString": true, "values": [ { "name": "Default", "value": "Default", "description": "Default value." }, { "name": "MQTT", "value": "MQTT", "description": "MQTT client." } ] } }, "WebPubSubPermission": { "type": "string", "description": "Web PubSub permission", "enum": [ "sendToGroup", "joinLeaveGroup" ], "x-ms-enum": { "name": "WebPubSubPermission", "modelAsString": true, "values": [ { "name": "SendToGroup", "value": "sendToGroup", "description": "The permission to send messages to groups." }, { "name": "JoinLeaveGroup", "value": "joinLeaveGroup", "description": "The permission to join/leave groups." } ] } } }, "parameters": { "Azure.Core.Foundations.ApiVersionParameter": { "name": "api-version", "in": "query", "description": "The API version to use for this operation.", "required": true, "type": "string", "minLength": 1, "x-ms-parameter-location": "method", "x-ms-client-name": "apiVersion" } } }