Skip to content

Latest commit

 

History

History
80 lines (58 loc) · 3.34 KB

WebhookApi.md

File metadata and controls

80 lines (58 loc) · 3.34 KB

mainnet.WebhookApi

All URIs are relative to https://rest-unstable.mainnet.cash

Method HTTP request Description
watch_address POST /webhook/watch_address Create a webhook to watch cashaddress balance and transactions.

watch_address

WatchAddressResponse watch_address(watch_address_request)

Create a webhook to watch cashaddress balance and transactions.

Example

  • Bearer Authentication (bearerAuth):
from __future__ import print_function
import time
import mainnet
from mainnet.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://rest-unstable.mainnet.cash
# See configuration.py for a list of all supported configuration parameters.
configuration = mainnet.Configuration(
    host = "https://rest-unstable.mainnet.cash"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = mainnet.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Enter a context with an instance of the API client
with mainnet.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = mainnet.WebhookApi(api_client)
    watch_address_request = mainnet.WatchAddressRequest() # WatchAddressRequest | Based on the 'type' parameter the webhook will be triggered to either post balance or raw transactions to the 'url': - 'transaction:in' for incoming BCH transactions - 'transaction:out' for outgoing BCH transactions - 'transaction:in,out' both for incoming and outgoing BCH transactions - 'balance' will post the object according to 'BalanceResponse' schema 

    try:
        # Create a webhook to watch cashaddress balance and transactions. 
        api_response = api_instance.watch_address(watch_address_request)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling WebhookApi->watch_address: %s\n" % e)

Parameters

Name Type Description Notes
watch_address_request WatchAddressRequest Based on the 'type' parameter the webhook will be triggered to either post balance or raw transactions to the 'url': - 'transaction:in' for incoming BCH transactions - 'transaction:out' for outgoing BCH transactions - 'transaction:in,out' both for incoming and outgoing BCH transactions - 'balance' will post the object according to 'BalanceResponse' schema

Return type

WatchAddressResponse

Authorization

bearerAuth

HTTP request headers

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

HTTP response details

Status code Description Response headers
200 Successful operation -
405 Invalid input -

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