Dela via


Communication Identity - Create

Skapa en ny identitet och eventuellt en åtkomsttoken.

POST {endpoint}/identities?api-version=2023-10-01

URI-parametrar

Name I Obligatorisk Typ Description
endpoint
path True

string

Kommunikationsresursen, till exempel https://my-resource.communication.azure.com

api-version
query True

string

Version av API som ska anropas.

Begärandetext

Name Typ Description
createTokenWithScopes

CommunicationIdentityTokenScope[]

Skapa även åtkomsttoken för den skapade identiteten.

expiresInMinutes

integer

Valfri anpassad giltighetsperiod för token inom [60 1440] minuters intervall. Om det inte anges används standardvärdet 1 440 minuter (24 timmar).

Svar

Name Typ Description
201 Created

CommunicationIdentityAccessTokenResult

Skapad – returnerar den skapade identiteten.

Other Status Codes

CommunicationErrorResponse

Fel

Exempel

Create an Identity and optionally an access token with custom expiration time within the [60-1440] minutes range. If expiration time is not specified, the default value of 1440 minutes (24 hours) will be used.

Exempelbegäran

POST https://my-resource.communication.azure.com/identities?api-version=2023-10-01

{
  "createTokenWithScopes": [
    "chat",
    "voip",
    "chat.join",
    "chat.join.limited",
    "voip.join"
  ],
  "expiresInMinutes": 60
}

Exempelsvar

{
  "identity": {
    "id": "8:acs:2dee53b4-368b-45b4-ab52-8493fb117652_00000005-14a2-493b-8a72-5a3a0d000081"
  },
  "accessToken": {
    "token": "token",
    "expiresOn": "2023-10-10T21:39:39.3244584+00:00"
  }
}

Definitioner

Name Description
CommunicationError

Kommunikationstjänstens fel.

CommunicationErrorResponse

Kommunikationstjänstens fel.

CommunicationIdentity

En kommunikationsidentitet.

CommunicationIdentityAccessToken

En åtkomsttoken.

CommunicationIdentityAccessTokenResult

En kommunikationsidentitet med åtkomsttoken.

CommunicationIdentityCreateRequest
CommunicationIdentityTokenScope

Lista över omfång för en åtkomsttoken.

CommunicationError

Kommunikationstjänstens fel.

Name Typ Description
code

string

Felkoden.

details

CommunicationError[]

Mer information om specifika fel som ledde till det här felet.

innererror

CommunicationError

Det inre felet om det finns något.

message

string

Felmeddelandet.

target

string

Felmålet.

CommunicationErrorResponse

Kommunikationstjänstens fel.

Name Typ Description
error

CommunicationError

Kommunikationstjänstens fel.

CommunicationIdentity

En kommunikationsidentitet.

Name Typ Description
id

string

Identifierare för identiteten.

CommunicationIdentityAccessToken

En åtkomsttoken.

Name Typ Description
expiresOn

string

Förfallotiden för token.

token

string

Den åtkomsttoken som utfärdats för identiteten.

CommunicationIdentityAccessTokenResult

En kommunikationsidentitet med åtkomsttoken.

Name Typ Description
accessToken

CommunicationIdentityAccessToken

En åtkomsttoken.

identity

CommunicationIdentity

En kommunikationsidentitet.

CommunicationIdentityCreateRequest

Name Typ Standardvärde Description
createTokenWithScopes

CommunicationIdentityTokenScope[]

Skapa även åtkomsttoken för den skapade identiteten.

expiresInMinutes

integer

1440

Valfri anpassad giltighetsperiod för token inom [60 1440] minuters intervall. Om det inte anges används standardvärdet 1 440 minuter (24 timmar).

CommunicationIdentityTokenScope

Lista över omfång för en åtkomsttoken.

Name Typ Description
chat

string

Använd detta för fullständig åtkomst till chatt-API:er.

chat.join

string

Åtkomst till chatt-API:er men utan behörighet att skapa, ta bort eller uppdatera chatttrådar.

chat.join.limited

string

En mer begränsad version av chat.join som inte tillåter att deltagare läggs till eller avlägsnas. Använd det här omfånget när tokenbäraren inte är helt betrodd, till exempel i gästscenarier.

voip

string

Använd detta för fullständig åtkomst till anropande API:er.

voip.join

string

Åtkomst till anropande API:er men utan behörighet att starta nya anrop.