If you are receiving an "Invalid Token" error when making calls through our API, the token you are using to make requests has most likely expired. The tokens provided from each APIAUTH call will only be valid for 24 hours, and each time a new AUTH call is made, the previous token will no longer be valid.


What is a Token?

Whenever you make an authentication call to the Data Zoo API, you will receive a token that you will use for requests to your available Data Sources. The input and output for the API Authentication calls are as follows:


XML (SOAP)

Input

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <Authenticate xmlns="http://svc.datazoo.co.nz">
      <UserName>Your_UserName</UserName>
      <UserPassword>Your_Password</UserPassword>
    </Authenticate>
  </soap12:Body>
</soap12:Envelope>


Output

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
        <AuthenticateResponse xmlns="http://svc.datazoo.co.nz">
            <AuthenticateResult>
                <UserName>Your_UserName</UserName>
                <Token>67CC647E-20EA-4726-8045-14C179077D2F</Token>
                <Reference />
                <Message>Success</Message>
                <DataSources>
(...)


The value returned within the <Token> tags is the Token value you will need to use for requests to different Data Sources.

EG, using this token to make a request against the Australian Residential Data Source:


EG Request

<?xml version="1.0" encoding="utf-8"?>    
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">    
  <soap12:Body>    
    <Verify xmlns="http://svc.datazoo.co.nz">    
      <Session>    
        <UserName>Your_UserName</UserName>    
        <Token>67CC647E-20EA-4726-8045-14C179077D2F</Token>    
        <Reference />    
        <DataSources>    
            <DataSource_v27>    
                <DataSourceName>Australian Residential</DataSourceName>    
                <Enabled>true</Enabled>    
                <ConsentObtained>false</ConsentObtained>    
            </DataSource_v27>    
        </DataSources>    
      </Session>    
      <Criteria>    
        <FirstName>Test</FirstName>    
        <LastName>TESTING</LastName>    
        <StreetNumber>1</StreetNumber>    
        <StreetName>Test</StreetName>    
        <Suburb>Testville</Suburb>
        <PostCode>2001</PostCode>
        <DateOfBirth>1980-01-01</DateOfBirth>
      </Criteria>    
    </Verify>    
  </soap12:Body>    
</soap12:Envelope>    


JSON(REST)

Input - https://rest.datazoo.co.nz/api/Authenticate.json || Content-Type: Application/JSON

{
    "UserName": "Your_UserName",
    "Password": "Your_Password"
}


Output

{
    "sessionToken": "6ED81779-4AD7-4F7C-A468-96382A8FB0CA",
    "countries": [
        {
            "country": "Australia",
            "dataSources": [
                "Australian Third Party Datasets",
                "Australian Experian",
                "Australian Residential"
            ]
        },
(...)



XML(REST)

Input - https://rest.datazoo.co.nz/api/Authenticate.xml || Content-Type: Application/XML

<LoginRequestModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <UserName>Your_UserName</UserName>
    <Password>Your_Password</Password>
</LoginRequestModel>


Output

<LoginResponseModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <SessionToken>15270CFD-0596-45D9-B87A-810A58E5F49B</SessionToken>
    <Countries>
        <LoginResponseCountryModel>
            <Country>Australia</Country>
            <DataSources>
                <string>Australian Third Party Datasets</string>
                <string>Australian Experian</string>
                <string>Australian Residential</string>
            </DataSources>
        </LoginResponseCountryModel>
(...)