Python

Configure your prerequisites

There are a few prerequisites that you need to complete before you can work through this tutorial. If you've already completed any of them, feel free to skip that step.


To use the Vonage Business Communications APIs, you must first request a developer account.

To request an account, contact your Vonage Business Communications account representative.

You will use the developer account to:

  1. Log in to the Business Communications Developer Portal
  2. Create API applications
  3. Subscribe to Vonage Business Communications APIs

Note: Your developer credentials are different than your Vonage Business Communications credentials and can only be used to log in to the Business Communications Developer Portal.

To use the Vonage Business Communications APIs, you must create a API application.

Note: To avoid confusion, "application" in this context refers to a logical grouping of APIs.

  1. Log in to the Business Communications Developer Portal using your developer credentials and select Vonage Business Communications from the platform drop down list.
  2. Select My Applications from the left-hand navigation menu.
  3. Click Add Application at the top of the page.
  4. On the Add Application dialog, enter a Name and an optional Description for your application so you can locate it later. You can limit the maximum number of requests each access token allows (see authentication) in the Per Token Quota drop-down menu. By default it is Unlimited.
  5. Click the Add button.

Screenshot showing the Add Application dialog
Screenshot showing the Add Application dialog

Now that you have created your Application and configured authentication, you can subscribe to the Provisioning API. This API will give you access to the account, extension and user data.

  1. Click the API Directory link in the left-hand navigation menu.
  2. Locate the Call Recording API and click Go.
  3. Select your application from the My Applications drop-down located on the right-hand corner of the page.
  4. Click Subscribe.

Authentication

Now that you have created an application and subscribed to the Call Recording API, you must generate an access token.

  1. Log-in using your Vonage Business Communications credentials. This example application uses the Requests library to call the /api/accounts/ API.

    Refer to the Making an API request guide for more details.

  2. Create a function that requests the /api/accounts API to generate an access token:

    def get_token():
      url = "https://api.vonage.com/token"
      payload = 'grant_type=password&username={}&password={}&client_id={}&client_secret={}'.format(USERNAME, PASSWORD, CLIENT_ID, SECRET)
      headers = {
        'Content-Type': 'application/x-www-form-urlencoded'
      }
    
      response = requests.request("POST", url, headers=headers, data = payload)
      return response.json()
  3. Run the function passing in the following values:

    Key Description
    USERNAME Vonage Business Communications username. Be sure to append @vbc.prod to the username. firstname.lastname@vbc.prod.
    PASSWORD Vonage Business Communications password.
    CLIENT_ID The client id of your Vonage Developer application.
    SECRET The secret to your Vonage Developer application.

    After running this function, you should see the following response:

    {'access_token': 'abc123-xxxxx-xxxxx',
    'expires_in': 9999,
    'refresh_token': 'def456-xxxx-xxxx',
    'scope': 'default',
    'token_type': 'Bearer'}
    

Next, you will make a GET request to get a list of recordings from the account.


Delete company call recordings by date

Delete call recordings and on-demand call recordings by a certain date.



Steps