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

Purchasing Variables from a Catalog

The following request demonstrates how to purchase variables for a postal address. It requires an address's catalog link obtained (for example) by Getting Postal Addresses for a Postcode.

POST /world/GB/addresses/8e05p%C2%B70/catalog HTTP/1.1
Host: api.whenfresh.com
Authorization: Bearer [YOUR_ACCESS_TOKEN]
Content-Type: application/ld+json
Accept: application/ld+json
{
  "@context": "http://api.whenfresh.com/.hydra/context.jsonld",
  "@type": "PurchaseVariableAction",
  "variables": [
    "https://api.whenfresh.com/vars/WhenFresh/Property Attribute#Dwelling/Rooms/Bedrooms/Bedroom Count"
  ]
}

Variable identifiers can be found and copied from the Catalog Bowser.

The list of purchased variables is returned as JSON Variable resources:

HTTP/1.1 200 OK
Content-Type: application/ld+json
{
    "@context": "http://api.whenfresh.com/.hydra/context.jsonld",
    "@type": "hydra:Collection",
    "manages": {
        "property": "rdf:type",
        "object": "Datum"
    },
    "member": [
        {
            "@type": "https://api.whenfresh.com/ontologies/Dwelling/Rooms#Bedrooms/Bedroom Count",
            "price": {
                "value": 1,
                "currency": "GBP"
            },
            "variable": {
                "@type": "Variable",
                "@id": "https://api.whenfresh.com/vars/WhenFresh/Property Attribute#Dwelling/Rooms/Bedrooms/Bedroom Count"
            },
            "value": "2"
        }
    ],
    "totalItems": 1
}
  • Improve this Doc