Address REST API

Working with a single address

MethodResult
URIhttps://[CompanyID].crittah.com/ws/apiv2/[json or xml]/address/[idaddress]
DELETENot supported
GETReturns data for one address
POSTCreate or modify only the supplied data for one address; returns address data after request
PUTNot supported

Data fields

FieldValue typeMandatoryDescriptionExample
IDAddressstring Unique identifier of the address.7090fad1-c4da-4488-9ceb-55ee9847edcc
AddressLine1string Line 1 of the addressUnit 21
AddressLine2string Line 2 of the address376 John Street
Citystring CitySydney
Statestring State

NSW

Countrystring CountryAustralia
PostCodestring PostCode2000
LocRefLocRef Object Location reference object containing the Longitude and Latitude

{ "IDLocation": "e97c85a5-62c0-4e13-bb63-ed8a43050360",
"LatLng": {
"Lat": -33.869738,
"Lng": 151.209448 }

Examples

Get a address details

Sample cURL call:

curl -H "Content-Type: application/json" \
-H "API-AppID: ce207c9e-8508-4913-9589-2bd5077845fe" \
-H "Api-Username: jskurray3" \
-H "API-Password: abc123" \
http://YourCompanyID.crittah.com/ws/apiv2/xml/address/[Address ID]
 

JSON Rsponse:

 {
  "IDAddress": "04cec8bb-d612-4dff-b838-ae8ff2504383",
  "AddressLine1": "26 Wolongong ROad",
  "AddressLine2": null,
  "City": "ARNCLIFFE",
  "State": "NSW",
  "IDCountry": 1013,
  "Country": "Australia",
  "PostCode": "2225",
  "LocRef": {
    "IDLocation": "2fc43358-378c-438c-953e-f3e69cc5c97f",
    "LatLng": {
      "Lat": -33.22813,
      "Lng": 151.146104
    }
  }
}

XML Response: 

 <?xml version="1.0" encoding="UTF-8"?>
<AddressObj xmlns="http://schemas.datacontract.org/2004/07/Spinifex.lib.objects" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <IDAddress>04cec8bb-d612-4dff-b838-ae8ff2504383</IDAddress>
   <AddressLine1>26 Wolongong ROad</AddressLine1>
   <AddressLine2 i:nil="true" />
   <City>ARNCLDDDDE</City>
   <State>NSW</State>
   <IDCountry>1013</IDCountry>
   <Country>Australia</Country>
   <PostCode>2225</PostCode>
   <LocRef>
      <IDLocation>2fc43358-378c-438c-953e-f3e69cc5c97f</IDLocation>
      <LatLng>
         <Lat>-33.22813</Lat>
         <Lng>151.146104</Lng>
      </LatLng>
   </LocRef>
</AddressObj>

Create Address

Add the follow contents to a file called "address.data"

{
  "AddressLine1": "26 Wolongong ROad",
  "AddressLine2": null,
  "City": "ARNCLIFFE",
  "State": "NSW",
  "IDCountry": 1013,
  "Country": "Australia",
  "PostCode": "2225",
  "LocRef": {
    "IDLocation": "2fc43358-378c-438c-953e-f3e69cc5c97f",
    "LatLng": {
      "Lat": -33.22813,
      "Lng": 151.146104
    }
  }
}

Run the following command

curl -X POST -d address.data  \
-H "Content-Type: application/json"  \
-H "API-AppID: 7090fad1-c4da-4488-9ceb-55ee9847edcc" \
-H "Api-Username: jsmith" \
-H "API-Password: abc123" \
http://YourCompanyID.crittah.com/ws/apiv2/json/address

 

Update Address

Add the following contents to a file calles "update_address.data"

{
  "AddressLine1": "26 Wolongong Street",
  "City": "EARLWOOD"
}

Run the follow cURL command

curl -X POST -d update_address.data  \
-H "Content-Type: application/json"  \
-H "API-AppID: 7090fad1-c4da-4488-9ceb-55ee9847edcc" \
-H "Api-Username: jsmith" \
-H "API-Password: abc123" \
http://YourCompanyID.crittah.com/ws/apiv2/json/address/[idaddress to update]