Skip to content

Latest commit

 

History

History
404 lines (291 loc) · 17.2 KB

File metadata and controls

404 lines (291 loc) · 17.2 KB

swagger_client.CustomSpeechWebHooksApi

All URIs are relative to https://localhost

Method HTTP request Description
web_hooks_create POST /webhooks Creates a new web hook.
web_hooks_delete DELETE /webhooks/{id} Deletes the web hook identified by the given ID.
web_hooks_get GET /webhooks/{id} Gets the web hook identified by the given ID.
web_hooks_list GET /webhooks Gets the list of web hooks for the authenticated subscription.
web_hooks_ping POST /webhooks/{id}:ping Sends a ping event to the registered URL.
web_hooks_test POST /webhooks/{id}:test Sends a request for each registered event type to the registered URL.
web_hooks_update PATCH /webhooks/{id} Updates the web hook identified by the given ID.

web_hooks_create

WebHook web_hooks_create(api_version, web_hook)

Creates a new web hook.

If the property secret in the configuration is present and contains a non-empty string, it will be used to create a SHA256 hash of the payload with the secret as HMAC key. This hash will be set as X-MicrosoftSpeechServices-Signature header when calling back into the registered URL. When calling back into the registered URL, the request will contain a X-MicrosoftSpeechServices-Event header containing one of the registered event types. There will be one request per registered event type. After successfully registering the web hook, it will not be usable until a challenge/response is completed. To do this, a request with the event type challenge will be made with a query parameter called validationToken. Respond to the challenge with a 200 OK containing the value of the validationToken query parameter as the response body. When the challenge/response is successfully completed, the web hook will begin receiving events.

Example

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = swagger_client.Configuration()
configuration.api_key['Ocp-Apim-Subscription-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Ocp-Apim-Subscription-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.CustomSpeechWebHooksApi(swagger_client.ApiClient(configuration))
api_version = 'api_version_example' # str | The requested api version.
web_hook = swagger_client.WebHook() # WebHook | The details of the new web hook.

try:
    # Creates a new web hook.
    api_response = api_instance.web_hooks_create(api_version, web_hook)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CustomSpeechWebHooksApi->web_hooks_create: %s\n" % e)

Parameters

Name Type Description Notes
api_version str The requested api version.
web_hook WebHook The details of the new web hook.

Return type

WebHook

Authorization

api_key

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

web_hooks_delete

web_hooks_delete(id, api_version)

Deletes the web hook identified by the given ID.

Example

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = swagger_client.Configuration()
configuration.api_key['Ocp-Apim-Subscription-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Ocp-Apim-Subscription-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.CustomSpeechWebHooksApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | The identifier of the web hook.
api_version = 'api_version_example' # str | The requested api version.

try:
    # Deletes the web hook identified by the given ID.
    api_instance.web_hooks_delete(id, api_version)
except ApiException as e:
    print("Exception when calling CustomSpeechWebHooksApi->web_hooks_delete: %s\n" % e)

Parameters

Name Type Description Notes
id str The identifier of the web hook.
api_version str The requested api version.

Return type

void (empty response body)

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

web_hooks_get

WebHook web_hooks_get(id, api_version)

Gets the web hook identified by the given ID.

Example

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = swagger_client.Configuration()
configuration.api_key['Ocp-Apim-Subscription-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Ocp-Apim-Subscription-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.CustomSpeechWebHooksApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | The identifier of the web hook.
api_version = 'api_version_example' # str | The requested api version.

try:
    # Gets the web hook identified by the given ID.
    api_response = api_instance.web_hooks_get(id, api_version)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CustomSpeechWebHooksApi->web_hooks_get: %s\n" % e)

Parameters

Name Type Description Notes
id str The identifier of the web hook.
api_version str The requested api version.

Return type

WebHook

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

web_hooks_list

PaginatedWebHooks web_hooks_list(api_version, skip=skip, top=top, filter=filter)

Gets the list of web hooks for the authenticated subscription.

Example

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = swagger_client.Configuration()
configuration.api_key['Ocp-Apim-Subscription-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Ocp-Apim-Subscription-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.CustomSpeechWebHooksApi(swagger_client.ApiClient(configuration))
api_version = 'api_version_example' # str | The requested api version.
skip = 56 # int | Number of datasets that will be skipped. (optional)
top = 56 # int | Number of datasets that will be included after skipping. (optional)
filter = 'filter_example' # str | A filtering expression for selecting a subset of the available hooks.              Supported properties: displayName, description, createdDateTime, lastActionDateTime, status and webUrl.              - Operators:                - eq, ne are supported for all properties.                - gt, ge, lt, le are supported for createdDateTime and lastActionDateTime.                - and, or, not are supported.              - Example:                filter=displayName eq 'test' (optional)

try:
    # Gets the list of web hooks for the authenticated subscription.
    api_response = api_instance.web_hooks_list(api_version, skip=skip, top=top, filter=filter)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CustomSpeechWebHooksApi->web_hooks_list: %s\n" % e)

Parameters

Name Type Description Notes
api_version str The requested api version.
skip int Number of datasets that will be skipped. [optional]
top int Number of datasets that will be included after skipping. [optional]
filter str A filtering expression for selecting a subset of the available hooks. Supported properties: displayName, description, createdDateTime, lastActionDateTime, status and webUrl. - Operators: - eq, ne are supported for all properties. - gt, ge, lt, le are supported for createdDateTime and lastActionDateTime. - and, or, not are supported. - Example: filter=displayName eq 'test' [optional]

Return type

PaginatedWebHooks

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

web_hooks_ping

web_hooks_ping(id, api_version)

Sends a ping event to the registered URL.

The request body of the POST request sent to the registered web hook URL is of the same shape as in the GET request for a specific hook. The Swagger Schema ID of the model is WebHookV3. The request will contain a X-MicrosoftSpeechServices-Event header with the value ping. If the web hook was registered with a secret it will contain a X-MicrosoftSpeechServices-Signature header with an SHA256 hash of the payload with the secret as HMAC key. The hash is base64 encoded.

Example

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = swagger_client.Configuration()
configuration.api_key['Ocp-Apim-Subscription-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Ocp-Apim-Subscription-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.CustomSpeechWebHooksApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | The identifier of the web hook to ping.
api_version = 'api_version_example' # str | The requested api version.

try:
    # Sends a ping event to the registered URL.
    api_instance.web_hooks_ping(id, api_version)
except ApiException as e:
    print("Exception when calling CustomSpeechWebHooksApi->web_hooks_ping: %s\n" % e)

Parameters

Name Type Description Notes
id str The identifier of the web hook to ping.
api_version str The requested api version.

Return type

void (empty response body)

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

web_hooks_test

web_hooks_test(id, api_version)

Sends a request for each registered event type to the registered URL.

The payload will be generated from the last entity that would have invoked the web hook. If no entity is present for none of the registered event types, the POST will respond with 204. If a test request can be made, it will respond with 200. The request will contain a X-MicrosoftSpeechServices-Event header with the respective registered event type. If the web hook was registered with a secret it will contain a X-MicrosoftSpeechServices-Signature header with an SHA256 hash of the payload with the secret as HMAC key. The hash is base64 encoded.

Example

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = swagger_client.Configuration()
configuration.api_key['Ocp-Apim-Subscription-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Ocp-Apim-Subscription-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.CustomSpeechWebHooksApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | The identifier of the web hook to ping.
api_version = 'api_version_example' # str | The requested api version.

try:
    # Sends a request for each registered event type to the registered URL.
    api_instance.web_hooks_test(id, api_version)
except ApiException as e:
    print("Exception when calling CustomSpeechWebHooksApi->web_hooks_test: %s\n" % e)

Parameters

Name Type Description Notes
id str The identifier of the web hook to ping.
api_version str The requested api version.

Return type

void (empty response body)

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

web_hooks_update

WebHook web_hooks_update(id, api_version, web_hook_update)

Updates the web hook identified by the given ID.

If the property secret in the configuration is omitted or contains an empty string, future callbacks won't contain X-MicrosoftSpeechServices-Signature headers. If the property contains a non-empty string, it will be used to create a SHA256 hash of the payload with the secret as HMAC key. This hash will be set as X-MicrosoftSpeechServices-Signature header when calling back into the registered URL. If the URL changes, the web hook will stop receiving events until a challenge/response is completed. To do this, a request with the event type challenge will be made with a query parameter called validationToken. Respond to the challenge with a 200 OK containing the value of the validationToken query parameter as the response body. When the challenge/response is successfully completed, the web hook will begin receiving events.

Example

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: api_key
configuration = swagger_client.Configuration()
configuration.api_key['Ocp-Apim-Subscription-Key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['Ocp-Apim-Subscription-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.CustomSpeechWebHooksApi(swagger_client.ApiClient(configuration))
id = 'id_example' # str | The identifier of the web hook.
api_version = 'api_version_example' # str | The requested api version.
web_hook_update = swagger_client.WebHookUpdate() # WebHookUpdate | The updated values for the web hook.

try:
    # Updates the web hook identified by the given ID.
    api_response = api_instance.web_hooks_update(id, api_version, web_hook_update)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CustomSpeechWebHooksApi->web_hooks_update: %s\n" % e)

Parameters

Name Type Description Notes
id str The identifier of the web hook.
api_version str The requested api version.
web_hook_update WebHookUpdate The updated values for the web hook.

Return type

WebHook

Authorization

api_key

HTTP request headers

  • Content-Type: application/json, application/merge-patch+json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]