• Home
  • My Account
  • Docs
  • Catalog Browser
  • API Status
Show / Hide Table of Contents

Purchasing Variables from a Catalog

A Postal Address has a Catalog of purchasable Variables.

You can purchase the available variables from the catalog for a particular address as follows.

Get Address

Get the address for a specified Postal Address File (PAF) key:

// 10 Downing Street, London, SW1A 2AA
var postalAddress = await client.GetAddressAsync(new PostalAddressFileKey(23747771));

Purchase a subset of the available variables

Variables can be purchased by passing in a list of variable identifiers copied from the Catalog Bowser.

Using variable identifiers copied from the Catalog Browser

var variableIdentifiersToPurchase = new List<VariableId>
{
    new VariableId("...first variable identifier..."),
    new VariableId("...second variable identifier...")
};
var purchasedVariables = await client.PurchaseVariablesAsync(postalAddress.CatalogId, variableIdentifiersToPurchase);

Purchasing functions (1.1 beta and above)

You can purchase functions by leveraging the specific Functions property on the PurchaseVariablesRequest type.

The following example demonstrates a theoretical function, https://api.whenresh.com/vars/BritishBank/CanLoan, taking a parameter, requestedLoanAmount.

client.PurchaseVariablesAsync(new PurchaseVariableRequest()
{
    Functions = {
        ["https://api.whenresh.com/vars/BritishBank/CanLoan"] = new Dictionary<string,  object>() 
        {
            ["requestedLoanAmount"] = 240000
        }
    }
})

This can of course be combined, and we encourage you to, with other variables and any other functions you may need in your purchase.

  • Improve this Doc