REST API - ADDRESS

Get Started. It's Free
or sign up with your email address
Rocket clouds
REST API - ADDRESS by Mind Map: REST API - ADDRESS

1. [POST] Add Address

1.1. 201 Created Customer address successfully created for the customer ID supplied.

1.1.1. SAMPLE { "addressId":"SWER567Y-FR56-89II-R4FR-YHT54RFDDE45", "addressLine1":"8 The Milky Way", "addressLine2":"Galatica", "suburb":"Albany", "state":"", "city":"Auckland", "postcode":"0600", "countryISOCode":"NZL", "type":"Home", "isPrimary": true }

1.1.1.1. All existing Address will set isPrimary to FALSE

1.1.1.2. allow to create with existing same Address different Type

1.2. 400 Bad Request Bad Request - Request failed due to validation errors.

1.2.1. "field":"addresses.addressLine1"

1.2.1.1. Empty/just space Address1 "message":"Address Line1 is required."

1.2.1.2. Exceed Max Length of Address1 "message":"Address Line1 must not exceed 60 characters."

1.2.2. "field":"addresses.addressLine2"

1.2.2.1. Exceed Max Length of Address2 "message":"Address Line2 must not exceed 60 characters."

1.2.3. "field":"addresses.suburb"

1.2.3.1. Exceed Max Length of Suburb "message":"Address suburb must not exceed 50 characters."

1.2.4. "field":"addresses.state"

1.2.4.1. Invalid State or more than 3 strings "message":"Address state is invalid."

1.2.4.2. If country = AUS, USA or any other country that has states

1.2.4.2.1. State is not provided - message : Address state is required

1.2.4.2.2. State value is not from the list of Country's states - message: State is invalid

1.2.5. "field":"addresses.city"

1.2.5.1. Exceed Max Length of City "message":"City must not exceed 50 characters."

1.2.6. "field":"addresses.postcode"

1.2.6.1. Empty/just space Postcode "message":"Address postcode is required."

1.2.6.2. Exceed Max Length of Postcode "message":"Address postcode must not exceed 10 characters."

1.2.7. "field":"addresses.countryISOCode"

1.2.7.1. Empty/just space Address Country Code "message":"Country ISO code is required."

1.2.7.2. Country code not supported "message":"Country ISO code is invalid."

1.2.8. "field":"addresses.type"

1.2.8.1. Empty/just space Address Type "message":"Address type is required."

1.2.8.2. Invalid Address Type "message":"Address type is invalid."

1.2.8.2.1. Valid Address Types: "Business" "Home" "Physical" "Postal" "Legal"

1.2.8.3. with existing different Address but same Type "message":"AddressType provided already exists."

2. [DELETE] Delete Address

2.1. 200 OK Successful delete customer address based on customer ID and address ID supplied

2.1.1. Provided customer ID and address ID "message":"Address successfully deleted"

2.1.2. Provided just customer ID - it will throw "Unsupported method" ex.{ "Error": { "Code": "UnsupportedApiVersion", "Message": "The HTTP resource that matches the request URI 'https://oc-qa-chaosriders.debitsuccess.com/CustomerServices/v1.0/customerIndividuals/024102D3-BF9C-41B3-9D00-08FED674D3BC/addresses/' with API version '1.0' does not support HTTP method 'DELETE'.", "InnerError": null } }

2.2. 403 Forbidden - Invalid CustomerID

2.2.1. { "errorCode":"access_denied", "message":"Unable to process this request as you do not have access to the customer associated to this request." }

2.3. 404 Not Found - Invalid AddressID

2.3.1. "message":"The requested resource could not be found."

2.4. 400 Bad Request - delete Primary Address

2.4.1. { "errorCode":"validation", "message":"Unable to process request due to validation errors.", "errors":[ { "field":"addressId", "message":"Deletion of Primary address is not allowed." } ] }

3. Get Address/Addresses

3.1. Get Address

3.1.1. 200 OK Successful response customer address based on customer ID and/or address ID supplied

3.1.1.1. Provided customer ID and address ID SAMPLE { "addressId":"1E23CE1D-55FA-4CEA-B88E-71861FE24583", "addressLine1":"5 The warehouse way", "addressLine2":"Northcote", "suburb":"Northcote", "state":"", "city":"Auckland", "postcode":"1062", "countryCode":"NZL", "type":"Home", "isPrimary": false }

3.1.1.2. Provided customer ID SAMPLE { "addressId":"1E23CE1D-55FA-4CEA-B88E-71861FE24583", "addressLine1":"5 The warehouse way", "addressLine2":"Northcote", "suburb":"Northcote", "state":"", "city":"Auckland", "postcode":"1062", "countryCode":"NZL", "type":"Home", "isPrimary": false }

3.1.2. 404 Not Found - Invalid AddressID

3.1.2.1. "message":"The requested resource could not be found."

3.1.3. 403 Forbidden - Invalid CustomerID

3.1.3.1. "errorCode":"required_claims", "message":"Unable to process this request due to insufficient client claims.", "errors":[ { "claim":"The name of the claim required." } ]

3.2. Get Addresses

3.2.1. 200 OK Successful response with customer addresses associated to the customer ID supplied

3.2.1.1. If AddressID not supplied - all address belongs to the CustomerID provided will populate

3.2.1.1.1. Customer's Addresses "addresses":[ { "addressId":"1E23CE1D-55FA-4CEA-B88E-71861FE24583", "addressLine1":"5 The warehouse way", "addressLine2":"Northcote", "suburb":"Northcote", "state":"", "city":"Auckland", "postcode":"1062", "countryCode":"NZL", "type":"home", "isPrimary": false }, { "addressId":"5T4REW37-GT54-566Y-8JJH-STUJHG56YHT4", "addressLine1":"8 The Milky way", "addressLine2":"Galatica", "suburb":"Albany", "state":"", "city":"Auckland", "postcode":"0600", "countryCode":"NZL", "type":"postal", "isPrimary": true } ], "responseMetadata":{ "nextCursor":"TmV4dEl0ZW1JZDoz", "hasNext": true }

3.2.1.2. Limit/nextCursor

3.2.1.2.1. If limit and next cursor are not provided

3.2.1.2.2. If limit is provided

3.2.2. 404 Not Found - Invalid AddressID

3.2.2.1. "message":"The requested resource could not be found."

3.2.3. 403 Forbidden - Invalid CustomerID

3.2.3.1. "errorCode":"required_claims", "message":"Unable to process this request due to insufficient client claims.", "errors":[ { "claim":"The name of the claim required." } ]

4. [PUT] Update Address

4.1. 201 Created Customer address successfully updated for the customer ID supplied.

4.1.1. SAMPLE { "addressId":"1E23CE1D-55FA-4CEA-B88E-71861FE24583", "addressLine1":"5 The warehouse way", "addressLine2":"Northcote", "suburb":"Northcote", "state":"", "city":"Auckland", "postcode":"1062", "countryISOCode":"NZL", "type":"Home", "isPrimary": true }

4.1.1.1. All existing Address will set isPrimary to FALSE

4.1.1.2. allow to update with existing same Address different Type

4.1.1.3. allow to update with existing same Address same Type

4.2. 400 Bad Request Request failed due to validation errors

4.2.1. "field":"addresses.addressLine1"

4.2.1.1. Empty/just space Address1 "message":"Address Line1 is required."

4.2.1.2. Exceed Max Length of Address1 "message":"Address Line1 must not exceed 60 characters."

4.2.2. "field":"addresses.addressLine2"

4.2.2.1. Exceed Max Length of Address2 "message":"Address Line2 must not exceed 60 characters."

4.2.3. "field":"addresses.suburb"

4.2.3.1. Exceed Max Length of Suburb "message":"Address suburb must not exceed 50 characters."

4.2.4. "field":"addresses.state"

4.2.4.1. Invalid State or more than 3 strings "message":"Address state is invalid."

4.2.4.2. If country = AUS, USA or any other country that has states

4.2.4.2.1. State is not provided - message : Address state is required

4.2.4.2.2. State value is not from the list of Country's states - message: Address state is invalid

4.2.5. "field":"addresses.city"

4.2.5.1. Exceed Max Length of City "message":"City must not exceed 50 characters."

4.2.6. "field":"addresses.postcode"

4.2.6.1. Empty/just space Postcode "message":"Address postcode is required."

4.2.6.2. Exceed Max Length of Postcode "message":"Address postcode must not exceed 10 characters."

4.2.7. "field":"addresses.countryISOCode"

4.2.7.1. Empty/just space Address Country Code "message":"Country ISO code is required."

4.2.7.2. Country code not supported/invalid "message":"Country ISO code is invalid."

4.2.8. "field":"addresses.type"

4.2.8.1. Empty/just space Address Type "message":"Address type is required."

4.2.8.2. Invalid Address Type "message":"Address type is invalid."

4.2.8.2.1. Valid Address Types: "Business" "Home" "Physical" "Postal" "Legal"

4.2.8.3. with existing different Address but same Type - should allow to update but not in add

4.2.9. "field":"addresses.isPrimary"

4.2.9.1. updating the primary address to isPrimary = false/NULL

4.2.9.1.1. "message":"Each customer must have 1 primary address."

4.2.9.2. updating the non-primary to isPrimary = True

4.2.9.2.1. update successfully and the rest will set to isPrimary = false

4.2.9.3. existing false then updating to isPrimary = false/Null

4.2.9.3.1. will set the address isPrimary = False

4.3. 404 Not Found - Invalid AddressID

4.3.1. "message":"The requested resource could not be found."

4.4. 403 Forbidden - Invalid CustomerID

4.4.1. { "errorCode": "access_denied", "message": "Unable to process this request as you do not have access to the customer associated to this request." }

5. Common API Errors

5.1. 401 Unauthorized Unauthorized - Occurs when the authorization token provided is either expired or invalid

5.1.1. Expired/Invalid

5.1.1.1. "message": "Authorization has been denied for this request."

5.2. 403 Forbidden - when the identity server client does not have access to the business - insufficient claims

5.2.1. Required Claims - not applicable at this moment ex. user read only access but trying to update

5.2.1.1. "errorCode": "required_claims", "message": "Unable to process this request due to insufficient client claims.", "errors": [ { "claim": "The name of the claim required." } ]

5.2.2. Business Access Denied

5.2.2.1. "errorCode": "access_denied", "message": "Unable to process this request as you do not have access to the business associated to this request."

5.3. 404 Not Found Not Found - Occurs when the resource provided is not found

5.3.1. "message":"The resource provided could not be found"

5.4. 429 Too many requests More requests than the allowed request limit

5.4.1. "message": "You have exceeded the maximum limit of request allowed. Please try your request again in a moment."

5.4.2. Configuration, to be confirmed with Dev

5.5. 500 Internal Server Error Internal Server Error - Something went wrong on our end ex. Database locked

5.5.1. "message": "Something went wrong while processing your request. We’re sorry for the trouble. We’ve been notified of the error and will correct it as soon as possible. Please try your request again in a moment."

5.6. 503: Service Unavailable Turn off CustomerServices in Application Pool to Test

5.6.1. "message": "The API is currently unavailable due to a scheduled outage – please try again soon."

6. Database Validation

6.1. Delete Successfully - specific record will be deleted

6.2. [POST] Add Address successfully - new record added in Account's address - correct value added - spaces before/after word/s should be trim

6.3. [PUT] Update Address successfully - updated record will reflect in DB - spaces before/after word/s should be trim

6.4. [GET] Address/Addresses successfully - correct record/s are reflecting - no duplicate/skipped records - order by Address.AddressNo ASC

6.5. countryISOcode = NZL will save NZ in DB

7. ELK CRM

7.1. Add Address successfully - audit trail created

7.2. Update Address successfully - audit trail created

7.3. Delete Address successfully - audit trail created