Land registry API - Price Paid Linked data , querying the api

23 Views Asked by At

I have coded some lines to GET request from the API (https://landregistry.data.gov.uk/app/root/doc/ppd)

The code:

baseUrl = 'http://landregistry.data.gov.uk/data/ppi/address.csv'

# parameters for api request 
parameters = {'postcode': postcode}

#  the api request
response = requests.get(baseUrl, params=parameters)

# is the request successful ?
if response.status_code == 200:
    # if yes save the response as a CSV 
    filePath = 'csvf.csv'
  #open in binary format
    with open(filePath, 'wb') as csvFile:
        csvFile.write(response.content)

else:
    st.error({response.status_code})

So I need to get the price paid for the addresses within the postcode assigned. However, I realise my code is just outputting the addresses under that postal code but it was a mission to get this starting point and I really can't decipher how the API query and transaction tags can work together to return the price paid data.

Any help would be appreciated.

1

There are 1 best solutions below

0
John A On

I believe you are after the "transaction-record" endpoint.

baseUrl = 'http://landregistry.data.gov.uk/data/ppi/transaction-record.csv'

# parameters for api request 
parameters = {'propertyAddress.postcode': postcode}