{"swagger":"2.0","info":{"version":"0.0.5","title":"AAINZ CRM Customer API","description":"The AAINZ CRM Customer API provides an interface to the customer record in GCIS."},"basePath":"/aaicrm/api","tags":[{"name":"Customer","description":"Customer APIs"}],"schemes":["https"],"paths":{"/customers/updateCustomer":{"post":{"tags":["Customer"],"summary":"Edit customer and brand consent for AAINZ customer","description":"Supports editing of customers (Individual or Organisation) in GCIS.\nThere is no restriction on which fields should be editable. You only need to populate customer attributes that you intend to edit, and don't need to populate the complete customer.","operationId":"editCustomerUsingPATCH","consumes":["application/vnd.api+json"],"produces":["application/vnd.api+json"],"parameters":[{"name":"X-Request-ID","in":"header","description":"The correlation id for the request","required":false,"type":"string"},{"name":"X-API-Version","in":"header","description":"Minor version of the API","required":false,"type":"string"},{"name":"X-Client-Version","in":"header","description":"Client application version","required":false,"type":"string"},{"name":"X-Client-Id","in":"header","description":"Client application details","required":false,"type":"string"},{"in":"body","name":"customer","description":"customer","required":true,"schema":{"$ref":"#/definitions/CustomerRequest"}}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/CustomerUpdateResponse"}},"400":{"description":"Code: 008 - Bad request","schema":{"$ref":"#/definitions/Errors"}},"500":{"description":"Code: 999 Internal Server Error","schema":{"$ref":"#/definitions/Errors"}}}}},"/customers/{customerId}/consents":{"get":{"tags":["Customer"],"summary":"Get AAINZ Brand Consent by Customer Id","description":"Returns global concent information for an AAINZ customer","operationId":"getConsentByCustomerIdUsingGET","consumes":["application/json"],"produces":["application/vnd.api+json"],"parameters":[{"name":"X-Request-ID","in":"header","description":"The correlation id for the request","required":false,"type":"string"},{"name":"X-API-Version","in":"header","description":"Minor version of the API","required":false,"type":"string"},{"name":"X-Client-Version","in":"header","description":"Client application version","required":false,"type":"string"},{"name":"X-Client-Id","in":"header","description":"Client application details","required":false,"type":"string"},{"name":"customerId","in":"path","description":"Customer Id","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"OK","schema":{"$ref":"#/definitions/ConsentResponse"}},"400":{"description":"Code: 008 - Bad request","schema":{"$ref":"#/definitions/Errors"}},"404":{"description":"Code: 003 - Customer does not exist","schema":{"$ref":"#/definitions/Errors"}},"500":{"description":"Code: 999 - Internal server error","schema":{"$ref":"#/definitions/Errors"}},"502":{"description":"Code: 009 - Error with downstream service","schema":{"$ref":"#/definitions/Errors"}},"504":{"description":"Code: 001 - Timeout with downstream service","schema":{"$ref":"#/definitions/Errors"}}}}}},"definitions":{"Brand Consent Attributes":{"type":"object","required":["brand","consent"],"properties":{"consent":{"type":"string","example":true,"description":"Brand Consent Value","enum":["YES","NO","DETAIL","NULL"]},"audit":{"description":"Audit details for the resource","$ref":"#/definitions/Brand Consent Audit"}}},"Brand Consent Data":{"type":"object","properties":{"id":{"type":"string","example":"123","description":"Brand Customer's ID"},"type":{"type":"string","example":"Brand Consent","description":"Type"},"attributes":{"description":"Brand Consent Attribute","$ref":"#/definitions/Brand Consent Attributes"}}},"Brand Consent Request Data":{"type":"object","required":["id","attributes"],"properties":{"id":{"type":"string","example":"123","description":"Customer ID"},"type":{"type":"string","example":"Brand Consent","description":"Type"},"attributes":{"description":"Brand Consent Attribute","$ref":"#/definitions/Brand Consent Request Attributes"}}},"Brand Consent Request Attributes":{"type":"object","required":["consent","audit"],"properties":{"consent":{"type":"string","example":true,"description":"Brand Consent Value","enum":["YES","NO","NULL"]},"audit":{"description":"Audit details for the resource","$ref":"#/definitions/Brand Consent Request Audit"}}},"ConsentRequest":{"type":"object","required":["data"],"properties":{"data":{"description":"Data","$ref":"#/definitions/Brand Consent Request Data"}}},"ConsentResponse":{"type":"object","properties":{"data":{"description":"Data","$ref":"#/definitions/Brand Consent Data"}}},"CustomerRequest":{"type":"object","properties":{"customerData":{"$ref":"#/definitions/Customer Request Data"},"brandConsentData":{"description":"Data","$ref":"#/definitions/Brand Consent Request Data"}}},"CustomerUpdateResponse":{"type":"object","required":["updateStatus"],"properties":{"updateStatus":{"$ref":"#/definitions/Customer Update Response Data"}}},"Customer Request Data":{"type":"object","required":["id","attributes"],"properties":{"id":{"type":"string","example":"123","description":"Customer ID"},"type":{"type":"string","example":"Customer","description":"Type"},"attributes":{"description":"Customer's Attributes","$ref":"#/definitions/Customer Request Attributes"}}},"Customer Request Attributes":{"type":"object","required":["customerType","audit"],"properties":{"customerType":{"type":"string","description":"Customer's Type","enum":["INDIVIDUAL","ORGANISATION"]},"individual":{"description":"Customer's Individual specific information","$ref":"#/definitions/Individual"},"addresses":{"description":"Customer's Addresses","$ref":"#/definitions/Addresses"},"contactMethods":{"description":"Customer's Contact Methods","$ref":"#/definitions/Contact Methods"},"audit":{"description":"Audit details for the resource","$ref":"#/definitions/Customer Request Audit"}}},"Customer Update Response Data":{"type":"object","required":["customerStatus","customerConsentStatus"],"properties":{"customerStatus":{"description":"Customer update response status","$ref":"#/definitions/Response status"},"customerConsentStatus":{"description":"Customer consent update response status","$ref":"#/definitions/Response status"}}},"Customer Request Audit":{"type":"object","required":["lastModifiedDateTime"],"properties":{"lastModifiedDateTime":{"type":"string","example":"2016-03-17T02:29:54+0000","description":"The time when the customer was last modified"}}},"Brand Consent Audit":{"type":"object","required":["lastModifiedBy","sourceSystemModified"],"properties":{"lastModifiedBy":{"type":"string","example":"U123456","description":"The user who triggered the update"},"lastModifiedDateTime":{"type":"string","format":"date-time","example":"2016-03-17T18:29:54+1000","description":"The time when the update happened"},"sourceSystemModified":{"type":"string","example":"NPR","description":"The source system where the update has been triggered"}}},"Brand Consent Request Audit":{"type":"object","required":["lastModifiedDateTime"],"properties":{"lastModifiedDateTime":{"type":"string","format":"date-time","example":"2016-03-17T18:29:54+1000","description":"The time when the update happened"}}},"Response status":{"type":"object","required":["status"],"properties":{"status":{"type":"string","example":"ERROR","description":"Status code","enum":["OK","ERROR","NA"]},"detail":{"type":"string","example":"Update failed"}}},"Individual":{"type":"object","required":["name"],"properties":{"name":{"description":"The customer's name","$ref":"#/definitions/Individual Name"}}},"Individual Name":{"type":"object","properties":{"preferredName":{"type":"string","example":"THOR","description":"The name which the customer prefers to be referred as"},"title":{"type":"string","example":"MS","description":"The customer's title"},"suffix":{"type":"string","example":"SNR","description":"The customer's name suffix"}}},"Organisation":{"type":"object","required":["name"],"properties":{"name":{"description":"The customer's name","$ref":"#/definitions/Organisation Name"}}},"Organisation Name":{"type":"object","required":["standardised"],"properties":{"organisationName":{"type":"string","example":"ROSTERING UNLIMITED PTY LTD","description":"The customer's name"},"unstandardisedName":{"type":"string","example":"ROSTERING UNLIMITED PTY !23123 LTD","description":"If the name can not be standardised it will appear here"},"standardised":{"type":"boolean","example":false,"description":"Indicates if the value was successfully standaridsed"}}},"Addresses":{"type":"object","properties":{"physicalAddress":{"description":"The customer's physical address (residential or business)","$ref":"#/definitions/Address"}}},"Address":{"type":"object","required":["addressLine1","countryCode"],"properties":{"addressLine1":{"type":"string","example":"UNIT 33","description":"The first address line"},"addressLine2":{"type":"string","example":"305 EVANS BAY PARADE","description":"The second address line"},"addressLine3":{"type":"string","example":"ADDRESS LINE 3","description":"The third address line"},"addressLine4":{"type":"string","example":"ADDRESS LINE 4","description":"The fourth address line"},"addressLine5":{"type":"string","example":"ADDRESS LINE 5","description":"NZ Locality"},"suburb":{"type":"string","example":"HATAITAI","description":"NZ Locality or Suburb"},"townCity":{"type":"string","example":"WELLINGTON","description":"NZ town or city"},"postcode":{"type":"string","example":"6021","description":"The postal code"},"countryCode":{"type":"string","example":"NZ","description":"The two character country ISO ALPHA-2 Code where the address resides"}}},"Contact":{"type":"object","required":["detail"],"properties":{"detail":{"type":"string","example":"+61-408192910","description":"The contact detail"}}},"Contact Methods":{"type":"object","properties":{"preferredContactMethod":{"type":"string","description":"The customer's preferred method to be contacted","enum":["WORK_PHONE","MOBILE_PHONE","FAX","HOME_PHONE","EMAIL"]}}},"Brand Consent Channel":{"type":"object","properties":{"channelType":{"type":"string","example":"EMAIL","description":"Channel","enum":["EMAIL","MAIL","PHONE","SMS","ONLINE"]},"consent":{"type":"string","example":"YES","description":"Channel Consent","enum":["YES","NO"]}}},"Error":{"type":"object","required":["code","status","title"],"properties":{"code":{"type":"string","example":"API-008","description":"Error code"},"detail":{"type":"string","example":"A field is invalid","description":"Error detail"},"links":{"description":"A link to more information about this error","$ref":"#/definitions/Error Link"},"source":{"description":"The source of the error","$ref":"#/definitions/Error Source"},"status":{"type":"string","example":"400","description":"Error HTTP status code"},"title":{"type":"string","example":"Validation Error","description":"Error short description"}}},"Error Link":{"type":"object","required":["about"],"properties":{"about":{"type":"string","description":"A link to more information about the error","readOnly":true}}},"Error Source":{"type":"object","properties":{"parameter":{"type":"string","example":"firstName","description":"Indicates which URI query parameter caused the error"},"pointer":{"type":"string","example":"/data/attributes/brand","description":"A JSON Pointer [RFC6901] to the associated entity in the request document"}}},"Errors":{"type":"object","properties":{"errors":{"type":"array","items":{"$ref":"#/definitions/Error"}}}}}}